1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-25 05:37:37 +03:00
This commit is contained in:
Jesse Duffield
2022-02-13 12:47:15 +11:00
parent 33a223e981
commit 55af07a1bb
4 changed files with 22 additions and 15 deletions

View File

@@ -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 {