mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Make git.OpenRepository accept Context (#19260)
* OpenRepositoryCtx -> OpenRepository * OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
This commit is contained in:
		@@ -35,13 +35,13 @@ type Repository struct {
 | 
			
		||||
	Ctx context.Context
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OpenRepository opens the repository at the given path.
 | 
			
		||||
func OpenRepository(repoPath string) (*Repository, error) {
 | 
			
		||||
	return OpenRepositoryCtx(DefaultContext, repoPath)
 | 
			
		||||
// openRepositoryWithDefaultContext opens the repository at the given path with DefaultContext.
 | 
			
		||||
func openRepositoryWithDefaultContext(repoPath string) (*Repository, error) {
 | 
			
		||||
	return OpenRepository(DefaultContext, repoPath)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OpenRepositoryCtx opens the repository at the given path within the context.Context
 | 
			
		||||
func OpenRepositoryCtx(ctx context.Context, repoPath string) (*Repository, error) {
 | 
			
		||||
// OpenRepository opens the repository at the given path within the context.Context
 | 
			
		||||
func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) {
 | 
			
		||||
	repoPath, err := filepath.Abs(repoPath)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user