summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-09 13:32:01 -0600
committerJeff Carr <[email protected]>2025-02-09 13:32:01 -0600
commit9560885b1171193294b22e2b04e5326bdb2bac5c (patch)
tree343485e9581e6bd321df1634c7a2535aef6fd29c
parentb91475b55b93a87aabb63e661a46d85c28623eb9 (diff)
correctly disable commit buttonv0.22.50
-rw-r--r--newRepo.go2
-rw-r--r--scan.go9
-rw-r--r--structs.go1
3 files changed, 10 insertions, 2 deletions
diff --git a/newRepo.go b/newRepo.go
index fc5e191..9e07bf5 100644
--- a/newRepo.go
+++ b/newRepo.go
@@ -103,7 +103,7 @@ func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {
newRepo.Status.Toggle()
})
- newRepo.endBox.NewButton("show diff", func() {
+ newRepo.diff = newRepo.endBox.NewButton("show diff", func() {
r.reposbox.Disable()
log.Log(WARN, "show diff currentName =", newRepo.currentName.String())
log.Log(WARN, "show diff masterVersion =", newRepo.masterVersion.String())
diff --git a/scan.go b/scan.go
index 27b2e8c..fb1b1e3 100644
--- a/scan.go
+++ b/scan.go
@@ -72,8 +72,15 @@ func (r *RepoRow) Update() int {
// disable the commit button if the repo is not on the user branch
if pb.GetCurrentBranchName() == pb.GetUserBranchName() {
- r.commitB.Enable()
+ if r.pb.GetState() == "dirty" {
+ r.diff.Enable()
+ r.commitB.Enable()
+ } else {
+ r.diff.Disable()
+ r.commitB.Disable()
+ }
} else {
+ r.diff.Disable()
r.commitB.Disable()
}
diff --git a/structs.go b/structs.go
index 3a4360d..5322993 100644
--- a/structs.go
+++ b/structs.go
@@ -62,5 +62,6 @@ type RepoRow struct {
statusButton *gui.Node // opens up the status window
diffButton *gui.Node // opens up the status window
Status *repostatus.RepoStatus // todo: move that code here?
+ diff *gui.Node // the git diff button
commitB *gui.Node // the git commit button
}