mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-14 04:36:05 +00:00
Move some functions to gitrepo package (#35543)
Refactor Git command functions to use WithXXX methods instead of exposing RunOpts. This change simplifies reuse across gitrepo and improves consistency, encapsulation, and maintainability of command options. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -10,12 +10,10 @@ import (
|
||||
)
|
||||
|
||||
func UpdateRef(ctx context.Context, repo Repository, refName, newCommitID string) error {
|
||||
_, _, err := gitcmd.NewCommand("update-ref").AddDynamicArguments(refName, newCommitID).RunStdString(ctx, &gitcmd.RunOpts{Dir: repoPath(repo)})
|
||||
return err
|
||||
return RunCmd(ctx, repo, gitcmd.NewCommand("update-ref").AddDynamicArguments(refName, newCommitID))
|
||||
}
|
||||
|
||||
func RemoveRef(ctx context.Context, repo Repository, refName string) error {
|
||||
_, _, err := gitcmd.NewCommand("update-ref", "--no-deref", "-d").
|
||||
AddDynamicArguments(refName).RunStdString(ctx, &gitcmd.RunOpts{Dir: repoPath(repo)})
|
||||
return err
|
||||
return RunCmd(ctx, repo, gitcmd.NewCommand("update-ref", "--no-deref", "-d").
|
||||
AddDynamicArguments(refName))
|
||||
}
|
||||
|
Reference in New Issue
Block a user