mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-09-26 01:06:46 +08:00
Move updateref and removeref to gitrepo and remove unnecessary open repository (#35511)
Extracted from #35077 `UpdateRef` and `RemoveRef` will call git commands even for gogit version.
This commit is contained in:
@ -38,16 +38,6 @@ 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))
|
||||
}
|
||||
|
||||
// ConvertToHash returns a Hash object from a potential ID string
|
||||
func (repo *Repository) ConvertToGitID(commitID string) (ObjectID, error) {
|
||||
objectFormat, err := repo.GetObjectFormat()
|
||||
|
Reference in New Issue
Block a user