mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	#3157 create user path before rename repository while transfer
os.Rename does not create parent directory automatically when not exist
This commit is contained in:
		@@ -3,7 +3,7 @@ Gogs - Go Git Service [
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### Current tip version: 0.9.49 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
 | 
					##### Current tip version: 0.9.50 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Web | UI  | Preview  |
 | 
					| Web | UI  | Preview  |
 | 
				
			||||||
|:-------------:|:-------:|:-------:|
 | 
					|:-------------:|:-------:|:-------:|
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -17,7 +17,7 @@ import (
 | 
				
			|||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.9.49.0723"
 | 
					const APP_VER = "0.9.50.0723"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1187,6 +1187,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Rename remote repository to new path and delete local copy.
 | 
						// Rename remote repository to new path and delete local copy.
 | 
				
			||||||
 | 
						os.MkdirAll(UserPath(newOwner.Name), os.ModePerm)
 | 
				
			||||||
	if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
 | 
						if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
 | 
				
			||||||
		return fmt.Errorf("rename repository directory: %v", err)
 | 
							return fmt.Errorf("rename repository directory: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
0.9.49.0723
 | 
					0.9.50.0723
 | 
				
			||||||
		Reference in New Issue
	
	Block a user