summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-15 22:55:19 -0600
committerJeff Carr <[email protected]>2024-01-15 22:55:19 -0600
commitb2c21e8c16f01d5b25736f7f4ec5a3419f94c999 (patch)
tree98f5a3333aa675bccb5b8296894057f3ea38d1c1 /git.go
parent269ff54715e6d0ea982eeebd846898df633b8bb3 (diff)
working on CheckDirty()
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'git.go')
-rw-r--r--git.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/git.go b/git.go
index e26141a..03b1e6e 100644
--- a/git.go
+++ b/git.go
@@ -89,16 +89,23 @@ func (rs *RepoStatus) getBranches() []string {
}
func (rs *RepoStatus) CheckDirty() bool {
- out := run(rs.repopath, "git", "diff-index HEAD")
- if out == "" {
+ cmd := []string{"git", "diff-index", "--quiet", "HEAD"}
+ err, b, out := RunCmd("/home/jcarr/go/src/" + rs.repopath, cmd)
+ if err != nil {
+ log.Warn("CheckDirty() err =", err)
+ log.Error(err, "CheckDirty() error")
+ rs.dirtyLabel.Set("error")
+ return true
+ }
+ log.Warn("CheckDirty() b =", b, "out =", out)
+ if b {
log.Warn("CheckDirty() no", rs.repopath)
rs.dirtyLabel.Set("no")
return false
- } else {
- log.Warn("CheckDirty() true", rs.repopath)
- rs.dirtyLabel.Set("dirty")
- return true
}
+ log.Warn("CheckDirty() true", rs.repopath)
+ rs.dirtyLabel.Set("dirty")
+ return true
}