Fetch tags if none are found

This commit is contained in:
Zachary Yedidia 2020-02-11 14:14:34 -05:00
parent 695d4c2b1b
commit a938917b9b
2 changed files with 7 additions and 2 deletions

View file

@ -17,7 +17,7 @@ enjoyable to use full time, whether you work in the terminal because you prefer
.SH OPTIONS .SH OPTIONS
.PP .PP
\-clean \-clean
.RS4 .RS 4
Cleans the configuration directory Cleans the configuration directory
.RE .RE
@ -28,7 +28,7 @@ Specify a custom location for the configuration directory
.RE .RE
.PP .PP
\-[FILE]:LINE:COL [FILE]:LINE:COL
.RS 4 .RS 4
Specify a line and column to start the cursor at when opening a buffer Specify a line and column to start the cursor at when opening a buffer
.RE .RE

View file

@ -15,6 +15,11 @@ func getTag(match ...string) (string, *semver.PRVersion) {
if tag, err := exec.Command("git", args...).Output(); err != nil { if tag, err := exec.Command("git", args...).Output(); err != nil {
return "", nil return "", nil
} else { } else {
if len(tag) == 0 {
if _, err := exec.Command("git", "fetch", "tags").Output(); err != nil {
return "", nil
}
}
tagParts := strings.Split(string(tag), "-") tagParts := strings.Split(string(tag), "-")
if len(tagParts) == 3 { if len(tagParts) == 3 {
if ahead, err := semver.NewPRVersion(tagParts[1]); err == nil { if ahead, err := semver.NewPRVersion(tagParts[1]); err == nil {