diff options
| author | Jeff Carr <[email protected]> | 2024-12-16 03:04:39 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-16 03:04:39 -0600 |
| commit | a115ba144b00dc0339a8cf7eae6bdf2aab5fb4b5 (patch) | |
| tree | adc37ca690c207576dfbcbae3ec9ed421099f813 /currentVersions.go | |
| parent | cea5968b0fe717889cd4ae9611933649f48ac7f6 (diff) | |
work on supporting arbitrary pathsv0.0.33
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") |
