diff options
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 33 |
1 files changed, 5 insertions, 28 deletions
@@ -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 |
