From 0d01d8276659a0ed56827f23e41fc0b0a7304f83 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 9 Jan 2024 09:56:33 -0600 Subject: gets jcarr,devel and master branch info Signed-off-by: Jeff Carr --- git.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'git.go') diff --git a/git.go b/git.go index bc7b283..75f4618 100644 --- a/git.go +++ b/git.go @@ -12,12 +12,24 @@ import ( ) func (r *repo) checkoutBranch(branch string) { - if ! r.checkDirty() { - out := run(r.path, "git", "checkout " + branch) - log.Warn(r.path, "git checkout " + branch, "returned", out) + if r.checkDirty() { + return + } + out := run(r.path, "git", "checkout " + branch) + log.Warn(r.path, "git checkout " + branch, "returned", out) + + realname := r.getCurrentBranchName() + realversion := r.getCurrentBranchVersion() + log.Warn(r.path, "realname =", realname, "realversion =", realversion) + if realname == "jcarr" { + r.jcarrVersion.Set(realversion) + } + if realname == "devel" { + r.develVersion.Set(realversion) + } + if realname == "master" { + r.masterVersion.Set(realversion) } - r.getCurrentBranchName() - r.getCurrentBranchVersion() } func (r *repo) getBranch() { @@ -28,11 +40,11 @@ func (r *repo) getBranch() { func (r *repo) checkDirty() bool { out := run(r.path, "git", "diff-index HEAD") if out == "" { - r.sLabel.SetText("") + r.dirtyLabel.SetText("") r.pButton.Disable() return false } else { - r.sLabel.SetText("dirty") + r.dirtyLabel.SetText("dirty") r.pButton.Enable() return true } -- cgit v1.2.3