aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhinav Gupta <mail@abhinavg.net>2021-11-27 16:38:20 -0800
committerAbhinav Gupta <mail@abhinavg.net>2021-11-27 16:39:09 -0800
commit557a1fdcaabd51899b9213175762ed9603409985 (patch)
treec40aaee30282b996cbb09a1acdca93fcaff53935
parent977668a25d210e8985a55ede0f2382a48b8ad2e2 (diff)
downloadgo-git-557a1fdcaabd51899b9213175762ed9603409985.tar.gz
remote/addReachableTags: Remove guard before delete
The membership check before attempting to `delete` from the `tags` map is unnecessary because the operation is a no-op if the item does not already exist in the map.
-rw-r--r--remote.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/remote.go b/remote.go
index d54693e..9e710a3 100644
--- a/remote.go
+++ b/remote.go
@@ -247,10 +247,7 @@ func (r *Remote) addReachableTags(localRefs []*plumbing.Reference, remoteRefs st
// remove any that are already on the remote
if err := remoteRefIter.ForEach(func(reference *plumbing.Reference) error {
- if _, ok := tags[*reference]; ok {
- delete(tags, *reference)
- }
-
+ delete(tags, *reference)
return nil
}); err != nil {
return err