aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorChris Marchesi <chrism@vancluevertech.com>2018-09-07 08:55:43 -0700
committerChris Marchesi <chrism@vancluevertech.com>2018-09-07 09:00:42 -0700
commitb19b3b84745ea2e2af13a859ff7943c6de20fe4e (patch)
tree8605304c55e5756a9bae346ab36aacf711fa7e13 /repository.go
parent1000bc0ef82a87049c6f01cebacd7aa9d06824c6 (diff)
downloadgo-git-b19b3b84745ea2e2af13a859ff7943c6de20fe4e.tar.gz
git: Don't touch tag objects orphaned by tag deletion
Deleting a tag ref for an annotated tag in normal git behavior does not delete the tag object right away. This is handled by the normal GC process. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/repository.go b/repository.go
index 67bc96a..096ec13 100644
--- a/repository.go
+++ b/repository.go
@@ -617,26 +617,12 @@ func (r *Repository) Tag(name string) (*plumbing.Reference, error) {
// DeleteTag deletes a tag from the repository.
func (r *Repository) DeleteTag(name string) error {
- ref, err := r.Tag(name)
+ _, err := r.Tag(name)
if err != nil {
return err
}
- obj, err := r.TagObject(ref.Hash())
- if err != nil && err != plumbing.ErrObjectNotFound {
- return err
- }
-
- if err = r.Storer.RemoveReference(plumbing.ReferenceName(path.Join("refs", "tags", name))); err != nil {
- return err
- }
-
- // Delete the tag object if this was an annotated tag.
- if obj != nil {
- return r.DeleteObject(obj.Hash)
- }
-
- return nil
+ return r.Storer.RemoveReference(plumbing.ReferenceName(path.Join("refs", "tags", name)))
}
func (r *Repository) resolveToCommitHash(h plumbing.Hash) (plumbing.Hash, error) {