Skip to content

Commit

Permalink
remote/addReachableTags: Remove guard before delete
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
abhinav committed Nov 28, 2021
1 parent 977668a commit 557a1fd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 557a1fd

Please sign in to comment.