diff options
Diffstat (limited to 'currentVersions.go')
| -rw-r--r-- | currentVersions.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/currentVersions.go b/currentVersions.go index beecc4f..e844831 100644 --- a/currentVersions.go +++ b/currentVersions.go @@ -77,6 +77,7 @@ func (repo *Repo) GetUserVersion() string { return "" } } + func (repo *Repo) GetCurrentBranchName() string { r := repo.RunQuiet([]string{"git", "branch", "--show-current"}) output := strings.Join(r.Stdout, "\n") @@ -87,6 +88,24 @@ func (repo *Repo) GetCurrentBranchName() string { return strings.TrimSpace(output) } +// this is used often. probably move everything to this +// returns things like +// v0.2.2 +// v0.22.39-1-g2141737 +// v0.23-dirty +// mystuff +func (repo *Repo) GetCurrentVersion() string { + if repo == nil { + return "" + } + bver := repo.GetCurrentBranchVersion() + if repo.CheckDirty() { + bver = bver + "-dirty" + } + return bver +} + +// always spawns 'git' and always should spawn 'git' func (repo *Repo) GetCurrentBranchVersion() string { if repo == nil { log.Info("repo.GetCurrentBranchVersion() repo == nil") |
