Skip to content

Commit 2801bc2

Browse files
committed
Try to handle issues with detached head and tag searches
1 parent 148f4d1 commit 2801bc2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.go

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"errors"
45
"flag"
56
"fmt"
67
"log"
@@ -63,6 +64,9 @@ func main() {
6364
var hash string
6465
tag, count, hash, err = getLatestTagFromRepository(r)
6566
if err != nil {
67+
if errors.Is(err, plumbing.ErrObjectNotFound) {
68+
tag = ""
69+
}
6670
log.Fatalf("Failed to get latest tag from %s, err %s\n", path, err.Error())
6771
}
6872
if count != 0 && !ignoreUncleanTag && !getBranch && !getCommit {

0 commit comments

Comments
 (0)