summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'git.go')
-rw-r--r--git.go41
1 files changed, 35 insertions, 6 deletions
diff --git a/git.go b/git.go
index 19281c8..03218ce 100644
--- a/git.go
+++ b/git.go
@@ -109,12 +109,41 @@ func (rs *RepoStatus) CheckDirty() bool {
rs.dirtyLabel.SetValue("no")
return false
}
- log.Log(INFO, "CheckDirty() true", rs.realPath.String())
- log.Log(INFO, "CheckDirty() cmd =", cmd)
- log.Log(INFO, "CheckDirty() b =", b)
- log.Log(INFO, "CheckDirty() path =", path)
- log.Log(INFO, "CheckDirty() out =", out)
- log.Log(INFO, "CheckDirty() err =", err)
+ // sometimes b gets exit status 1 when there isn't anything that has changed
+ // run git status fixes that for some reason.
+ log.Log(WARN, "CheckDirty() true", rs.realPath.String())
+ log.Log(WARN, "CheckDirty() cmd =", cmd)
+ log.Log(WARN, "CheckDirty() b =", b)
+ log.Log(WARN, "CheckDirty() path =", path)
+ log.Log(WARN, "CheckDirty() out =", out)
+ log.Log(WARN, "CheckDirty() err =", err)
+
+ cmd = []string{"git", "status"}
+ err, b, out = RunCmd(path, cmd)
+
+ log.Log(WARN, "CheckDirty() true", rs.realPath.String())
+ log.Log(WARN, "CheckDirty() cmd =", cmd)
+ log.Log(WARN, "CheckDirty() b =", b)
+ log.Log(WARN, "CheckDirty() path =", path)
+ log.Log(WARN, "CheckDirty() out =", out)
+ log.Log(WARN, "CheckDirty() err =", err)
+
+ cmd = []string{"git", "diff-index", "--quiet", "HEAD"}
+ err, b, out = RunCmd(path, cmd)
+
+ log.Log(WARN, "CheckDirty() true", rs.realPath.String())
+ log.Log(WARN, "CheckDirty() cmd =", cmd)
+ log.Log(WARN, "CheckDirty() b =", b)
+ log.Log(WARN, "CheckDirty() path =", path)
+ log.Log(WARN, "CheckDirty() out =", out)
+ log.Log(WARN, "CheckDirty() err =", err)
+
+ if b {
+ log.Log(INFO, "CheckDirty() IS ACTUALLY CLEAN")
+ rs.dirtyLabel.SetValue("no")
+ return false
+ }
+
rs.dirtyLabel.SetValue("dirty")
return true