summaryrefslogtreecommitdiff
path: root/currentVersions.go
diff options
context:
space:
mode:
Diffstat (limited to 'currentVersions.go')
-rw-r--r--currentVersions.go37
1 files changed, 12 insertions, 25 deletions
diff --git a/currentVersions.go b/currentVersions.go
index 0f09cdf..6ddebda 100644
--- a/currentVersions.go
+++ b/currentVersions.go
@@ -69,19 +69,6 @@ func (repo *Repo) setUserVersion() {
}
}
-/*
-now tracked in repo.Reload()
-func (repo *Repo) GetCurrentBranchName() string {
- r := repo.RunQuiet([]string{"git", "branch", "--show-current"})
- output := strings.Join(r.Stdout, "\n")
- if r.Error != nil {
- log.Log(WARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
- log.Log(WARN, "GetCurrentBranchName() output might have worked anyway:", output)
- }
- return strings.TrimSpace(output)
-}
-*/
-
// this is used often. probably move everything to this
// returns things like
// v0.2.2
@@ -103,13 +90,13 @@ func (repo *Repo) gitDescribeByHash(hash string) (string, error) {
if hash == "" {
return "", errors.New("hash was blank")
}
- r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always", hash})
+ r, err := repo.RunQuiet([]string{"git", "describe", "--tags", "--always", hash})
out := strings.Join(r.Stdout, "\n")
- if r.Error != nil {
- log.Warn("not in a git repo or bad hash?", r.Error, repo.GetGoPath())
- return out, r.Error
+ if err != nil {
+ log.Warn("not in a git repo or bad hash?", err, repo.GetGoPath())
+ return out, err
}
- return out, r.Error
+ return out, err
}
// this should get the most recent tag
@@ -147,12 +134,12 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
if name == "" {
// git will return the current tag
- r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
+ r, err := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
output := strings.Join(r.Stdout, "\n")
- if r.Error != nil {
+ if err != nil {
log.Log(WARN, "gitDescribeByName() output might have worked anyway:", output)
- log.Log(WARN, "gitDescribeByName() not in a git repo?", r.Error, repo.GetGoPath())
- return "", r.Error
+ log.Log(WARN, "gitDescribeByName() not in a git repo?", err, repo.GetGoPath())
+ return "", err
}
return strings.TrimSpace(output), nil
}
@@ -162,11 +149,11 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name)
}
cmd := []string{"git", "describe", "--tags", "--always", name}
- result := repo.RunQuiet(cmd)
+ result, err := repo.RunQuiet(cmd)
output := strings.Join(result.Stdout, "\n")
- if result.Error != nil {
+ if err != nil {
log.Log(WARN, "cmd =", cmd)
- log.Log(WARN, "err =", result.Error)
+ log.Log(WARN, "err =", err)
log.Log(WARN, "output (might have worked with error?) =", output)
log.Log(WARN, "not in a git repo or bad tag?", repo.GetGoPath())
return "", result.Error