mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Ensure that git daemon export ok is created for mirrors (#17243)
* Ensure that git daemon export ok is created for mirrors There is an issue with #16508 where it appears that create repo requires that the repo does not exist. This causes #17241 where an error is reported because of this. This PR fixes this and also runs update-server-info for mirrors and generated repos. Fix #17241 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -275,5 +275,16 @@ func GenerateRepository(ctx context.Context, doer, owner *models.User, templateR
 | 
			
		||||
		return generateRepo, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = generateRepo.CheckDaemonExportOK(ctx); err != nil {
 | 
			
		||||
		return generateRepo, fmt.Errorf("checkDaemonExportOK: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stdout, err := git.NewCommandContext(ctx, "update-server-info").
 | 
			
		||||
		SetDescription(fmt.Sprintf("GenerateRepository(git update-server-info): %s", repoPath)).
 | 
			
		||||
		RunInDir(repoPath); err != nil {
 | 
			
		||||
		log.Error("GenerateRepository(git update-server-info) in %v: Stdout: %s\nError: %v", generateRepo, stdout, err)
 | 
			
		||||
		return generateRepo, fmt.Errorf("error in GenerateRepository(git update-server-info): %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return generateRepo, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user