mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-07 20:32:02 +00:00
Refactor calc mergebase
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -220,3 +221,14 @@ func (ref RefName) RefWebLinkPath() string {
|
||||
}
|
||||
return string(refType) + "/" + util.PathEscapeSegments(ref.ShortName())
|
||||
}
|
||||
|
||||
func UpdateRef(ctx context.Context, repoPath, refName, newCommitID string) error {
|
||||
_, _, err := NewCommand("update-ref").AddDynamicArguments(refName, newCommitID).RunStdString(ctx, &RunOpts{Dir: repoPath})
|
||||
return err
|
||||
}
|
||||
|
||||
func RemoveRef(ctx context.Context, repoPath, refName string) error {
|
||||
_, _, err := NewCommand("update-ref", "--no-deref", "-d").
|
||||
AddDynamicArguments(refName).RunStdString(ctx, &RunOpts{Dir: repoPath})
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user