summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git.go33
1 files changed, 5 insertions, 28 deletions
diff --git a/git.go b/git.go
index 03218ce..bbf7030 100644
--- a/git.go
+++ b/git.go
@@ -90,7 +90,7 @@ func (rs *RepoStatus) getBranches() []string {
}
func (rs *RepoStatus) CheckDirty() bool {
- cmd := []string{"git", "diff-index", "--quiet", "HEAD"}
+ cmd := []string{"git", "status"}
path := rs.realPath.String()
err, b, out := RunCmd(path, cmd)
if err != nil {
@@ -103,7 +103,10 @@ func (rs *RepoStatus) CheckDirty() bool {
rs.dirtyLabel.SetValue("error")
return true
}
- if b {
+
+ last := out[strings.LastIndex(out, "\n")+1:]
+
+ if last == "nothing to commit, working tree clean" {
log.Log(INFO, "CheckDirty() b =", b, "path =", path, "out =", out)
log.Log(INFO, "CheckDirty() no", rs.realPath.String())
rs.dirtyLabel.SetValue("no")
@@ -118,32 +121,6 @@ func (rs *RepoStatus) CheckDirty() bool {
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