diff options
Diffstat (limited to 'modules/git/repo_commit_gogit.go')
-rw-r--r-- | modules/git/repo_commit_gogit.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/git/repo_commit_gogit.go b/modules/git/repo_commit_gogit.go index f00b340d15..39be183f30 100644 --- a/modules/git/repo_commit_gogit.go +++ b/modules/git/repo_commit_gogit.go @@ -31,6 +31,16 @@ func (repo *Repository) GetRefCommitID(name string) (string, error) { return ref.Hash().String(), nil } +// SetReference sets the commit ID string of given reference (e.g. branch or tag). +func (repo *Repository) SetReference(name, commitID string) error { + return repo.gogitRepo.Storer.SetReference(plumbing.NewReferenceFromStrings(name, commitID)) +} + +// RemoveReference removes the given reference (e.g. branch or tag). +func (repo *Repository) RemoveReference(name string) error { + return repo.gogitRepo.Storer.RemoveReference(plumbing.ReferenceName(name)) +} + // ConvertToSHA1 returns a Hash object from a potential ID string func (repo *Repository) ConvertToSHA1(commitID string) (SHA1, error) { if len(commitID) == 40 { |