mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Refactor Branch struct in package modules/git (#33980)
The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
This commit is contained in:
		| @@ -11,14 +11,14 @@ import ( | ||||
|  | ||||
| // GetBranchesByPath returns a branch by its path | ||||
| // if limit = 0 it will not limit | ||||
| func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]*git.Branch, int, error) { | ||||
| func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]string, int, error) { | ||||
| 	gitRepo, err := OpenRepository(ctx, repo) | ||||
| 	if err != nil { | ||||
| 		return nil, 0, err | ||||
| 	} | ||||
| 	defer gitRepo.Close() | ||||
|  | ||||
| 	return gitRepo.GetBranches(skip, limit) | ||||
| 	return gitRepo.GetBranchNames(skip, limit) | ||||
| } | ||||
|  | ||||
| func GetBranchCommitID(ctx context.Context, repo Repository, branch string) (string, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao