diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-08 15:30:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 15:30:10 +0800 |
commit | 25b842df261452a29570ba89ffc3a4842d73f68c (patch) | |
tree | 225cddc07630f491e3efb9976fb57d0d31adb38a /modules/git | |
parent | a1f5dd767729e30d07ab42fda80c19f30a72679f (diff) | |
download | gitea-25b842df261452a29570ba89ffc3a4842d73f68c.tar.gz gitea-25b842df261452a29570ba89ffc3a4842d73f68c.zip |
Move get/set default branch from git package to gitrepo package to hide repopath (#29126)
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/repo_branch.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/modules/git/repo_branch.go b/modules/git/repo_branch.go index 979c5dec91..552ae2bb8c 100644 --- a/modules/git/repo_branch.go +++ b/modules/git/repo_branch.go @@ -55,15 +55,8 @@ func (repo *Repository) GetHEADBranch() (*Branch, error) { }, nil } -// SetDefaultBranch sets default branch of repository. -func (repo *Repository) SetDefaultBranch(name string) error { - _, _, err := NewCommand(repo.Ctx, "symbolic-ref", "HEAD").AddDynamicArguments(BranchPrefix + name).RunStdString(&RunOpts{Dir: repo.Path}) - return err -} - -// GetDefaultBranch gets default branch of repository. -func (repo *Repository) GetDefaultBranch() (string, error) { - stdout, _, err := NewCommand(repo.Ctx, "symbolic-ref", "HEAD").RunStdString(&RunOpts{Dir: repo.Path}) +func GetDefaultBranch(ctx context.Context, repoPath string) (string, error) { + stdout, _, err := NewCommand(ctx, "symbolic-ref", "HEAD").RunStdString(&RunOpts{Dir: repoPath}) if err != nil { return "", err } |