aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-09-14 00:52:45 +0700
committerShulhan <ms@kilabit.info>2018-09-14 04:09:00 +0700
commiteab628b6f1404d6a38542ec0034adb7345c3eeb4 (patch)
tree48613d9f3128eb167f6add04ffc1849bb867710f
parentf5c1dc9ae7c49d7cb6d1e2b85de1801b1818a96d (diff)
downloadpakakeh.go-eab628b6f1404d6a38542ec0034adb7345c3eeb4.tar.xz
lib/git: return immediately if we can't found latest tag revision
-rw-r--r--lib/git/git.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/git/git.go b/lib/git/git.go
index c68fce02..ff29d341 100644
--- a/lib/git/git.go
+++ b/lib/git/git.go
@@ -267,6 +267,9 @@ func LatestTag(repoDir string) (tag string, err error) {
}
out := string(bytes.TrimSpace(bout))
+ if len(out) == 0 {
+ return
+ }
cmd = exec.Command("git")
cmd.Args = append(cmd.Args, "describe", "--tags", "--abbrev=0", out)
@@ -294,7 +297,7 @@ func LatestTag(repoDir string) (tag string, err error) {
//
func LatestVersion(repoDir string) (version string, err error) {
version, err = LatestTag(repoDir)
- if err == nil {
+ if err == nil && len(version) > 0 {
return
}