diff options
author | vince <vincetiu8@gmail.com> | 2020-07-24 11:25:38 +0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-07-28 14:30:06 +0200 |
commit | 4e5f377d75824e31a058313cad2d2e478f348c28 (patch) | |
tree | cb2066a1b528a691589478a2260c1fbfbd681c96 /bug/bug.go | |
parent | 9436cf4b8983699ef7a164f4036686dd83d345d4 (diff) | |
download | git-bug-4e5f377d75824e31a058313cad2d2e478f348c28.tar.gz |
Remove need to specify remote
This commit makes the removeBug command use the listRefs repo command to search for the bug, eliminating the need to input the remote the bug came from.
Diffstat (limited to 'bug/bug.go')
-rw-r--r-- | bug/bug.go | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -243,15 +243,18 @@ func readBug(repo repository.ClockedRepo, ref string) (*Bug, error) { } // RemoveLocalBug will remove a local bug from its hash -func RemoveLocalBug(repo repository.ClockedRepo, id entity.Id) error { - ref := bugsRefPattern + id.String() - return repo.RemoveRef(ref) -} - -// RemoveRemoteBug will remove a remote bug locally from its hash -func RemoveRemoteBug(repo repository.ClockedRepo, remote string, id entity.Id) error { - ref := fmt.Sprintf(bugsRemoteRefPattern, remote) + id.String() - return repo.RemoveRef(ref) +func RemoveBug(repo repository.ClockedRepo, id entity.Id) error { + refs, err := repo.ListRefs(id.String()) + if err != nil { + return err + } + for _, ref := range refs { + err = repo.RemoveRef(ref) + if err != nil { + return err + } + } + return nil } type StreamedBug struct { |