diff options
| author | Jeff Carr <[email protected]> | 2024-02-24 05:27:58 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-24 05:27:58 -0600 |
| commit | ccee5733641f6d3fac60a825203c0a59cd36e9a6 (patch) | |
| tree | 1c5c452ad25c1f7d6e8e1c0861cb50c1fdfae6b9 /git.go | |
| parent | ddd95e9afc926d9e0a4a372dbf433d81c3db3207 (diff) | |
report dirty state change
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -2,6 +2,7 @@ package repostatus import ( "errors" + "fmt" "os/user" "strings" "time" @@ -54,7 +55,7 @@ func (rs *RepoStatus) GitPull() error { found = true } } - if ! found { + if !found { return errors.New("git config error") } var cmd []string @@ -195,6 +196,7 @@ func (rs *RepoStatus) IsDirty() bool { } func (rs *RepoStatus) CheckDirty() bool { + var start string = rs.dirtyLabel.String() cmd := []string{"git", "status"} path := rs.realPath.String() err, b, out := RunCmd(path, cmd) @@ -206,6 +208,9 @@ func (rs *RepoStatus) CheckDirty() bool { log.Warn("CheckDirty() status err =", err) log.Error(err, "CheckDirty() git status error") rs.dirtyLabel.SetValue("error") + if start != "error" { + rs.NoteChange("repo git status is in error " + fmt.Sprint(err)) + } rs.dirty = true return true } @@ -216,6 +221,9 @@ func (rs *RepoStatus) CheckDirty() bool { log.Log(INFO, "CheckDirty() b =", b, "path =", path, "out =", out) log.Log(INFO, "CheckDirty() no", rs.realPath.String()) rs.dirtyLabel.SetValue("no") + if start != "no" { + rs.NoteChange("repo is no longer dirty") + } rs.dirty = false return false } @@ -229,6 +237,9 @@ func (rs *RepoStatus) CheckDirty() bool { log.Log(INFO, "CheckDirty() is normal err =", err) rs.dirtyLabel.SetValue("dirty") + if start != "dirty" { + rs.NoteChange("repo is now dirty") + } rs.dirty = true return true |
