summaryrefslogtreecommitdiff
path: root/scan.go
diff options
context:
space:
mode:
Diffstat (limited to 'scan.go')
-rw-r--r--scan.go39
1 files changed, 25 insertions, 14 deletions
diff --git a/scan.go b/scan.go
index d35dee4..b10af4f 100644
--- a/scan.go
+++ b/scan.go
@@ -36,26 +36,37 @@ func (r *repo) newScan() bool {
cbname := r.status.GetCurrentBranchName()
cbversion := r.status.GetCurrentBranchVersion()
- ltversion := r.status.GetLastTagVersion()
- r.lastLabel.Set(cbname + "\n" + cbversion)
- r.vLabel.Set(cbname + "\n" + ltversion)
+ lasttag := r.status.GetLastTagVersion()
+ r.lastTag.Set(lasttag)
+ r.vLabel.Set(cbname + " " + cbversion)
+ status := r.getStatus()
+ if status == "dirty" {
+ r.dirtyLabel.Set(status)
+ return false
+ }
+ if status == "merge" {
+ r.dirtyLabel.Set(status)
+ return false
+ }
+ if status == "PERFECT" {
+ r.dirtyLabel.Set(status)
+ return true
+ }
+ r.dirtyLabel.Set("unknown " + status)
+ return false
+}
+
+func (r *repo) getStatus() string {
if r.status.CheckDirty() {
log.Warn("CheckDirty() true")
- r.dirtyLabel.Set("dirty")
- return false
+ return "dirty"
}
- log.Warn("CheckDirty() no")
- r.dirtyLabel.Set("not dirty")
if r.status.CheckBranches() {
log.Warn("Branches are Perfect")
- r.dirtyLabel.SetText("PERFECT")
- return true
- } else {
- log.Warn("Branches are not Perfect")
- r.dirtyLabel.SetText("merge")
+ return "PERFECT"
}
-
- return false
+ log.Warn("Branches are not Perfect")
+ return "merge"
}