mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Backport #18049 Repository Transfer requires that the repository directory is renamed - which is not possible on Windows if the git repository is open. Fix #17885 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -96,6 +96,11 @@ func Transfer(ctx *context.APIContext) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ctx.Repo.GitRepo != nil {
 | 
			
		||||
		ctx.Repo.GitRepo.Close()
 | 
			
		||||
		ctx.Repo.GitRepo = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := repo_service.StartRepositoryTransfer(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
 | 
			
		||||
		if models.IsErrRepoTransferInProgress(err) {
 | 
			
		||||
			ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
 | 
			
		||||
 
 | 
			
		||||
@@ -319,6 +319,11 @@ func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if accept {
 | 
			
		||||
		if ctx.Repo.GitRepo != nil {
 | 
			
		||||
			ctx.Repo.GitRepo.Close()
 | 
			
		||||
			ctx.Repo.GitRepo = nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if err := repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user