summaryrefslogtreecommitdiffstats
path: root/pkg/gui/diffing.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-02-13 12:47:15 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit55af07a1bb4e1d3f85a456c2604c46e5535aca40 (patch)
treec5f671f3aaa8016687fbfa3fb3e635f1d4067337 /pkg/gui/diffing.go
parent33a223e9813daf426d033c07fce5a5fab4276653 (diff)
fix CI
Diffstat (limited to 'pkg/gui/diffing.go')
-rw-r--r--pkg/gui/diffing.go26
1 files changed, 15 insertions, 11 deletions
diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go
index a23772ab3..daa659f7f 100644
--- a/pkg/gui/diffing.go
+++ b/pkg/gui/diffing.go
@@ -33,15 +33,19 @@ func (gui *Gui) renderDiff() error {
// which becomes an option when you bring up the diff menu, but when you're just
// flicking through branches it will be using the local branch name.
func (gui *Gui) currentDiffTerminals() []string {
- switch gui.currentContext().GetKey() {
- case "":
+ c := gui.currentSideContext()
+
+ if c.GetKey() == "" {
return nil
- case context.FILES_CONTEXT_KEY, context.SUBMODULES_CONTEXT_KEY:
+ }
+
+ switch v := c.(type) {
+ case *context.WorkingTreeContext, *context.SubmodulesContext:
// TODO: should we just return nil here?
return []string{""}
- case context.COMMIT_FILES_CONTEXT_KEY:
- return []string{gui.State.Contexts.CommitFiles.GetRefName()}
- case context.LOCAL_BRANCHES_CONTEXT_KEY:
+ case *context.CommitFilesContext:
+ return []string{v.GetRefName()}
+ case *context.BranchesContext:
// for our local branches we want to include both the branch and its upstream
branch := gui.State.Contexts.Branches.GetSelected()
if branch != nil {
@@ -52,13 +56,13 @@ func (gui *Gui) currentDiffTerminals() []string {
return names
}
return nil
- default:
- itemId := gui.getSideContextSelectedItemId()
- if itemId == "" {
- return nil
- }
+ case types.IListContext:
+ itemId := v.GetSelectedItemId()
+
return []string{itemId}
}
+
+ return nil
}
func (gui *Gui) currentDiffTerminal() string {