Skip to content

Commit

Permalink
fixup! Add command to open git difftool
Browse files Browse the repository at this point in the history
Support difftool for commits.
  • Loading branch information
stefanhaller committed Dec 21, 2023
1 parent 882a3c0 commit f23fd7c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/gui/controllers/basic_commits_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Handler: self.c.Helpers().CherryPick.Reset,
Description: self.c.Tr.ResetCherryPick,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Handler: self.checkSelected(self.openDiffTool),
Description: self.c.Tr.OpenDiffTool,
},
}

return bindings
Expand Down Expand Up @@ -251,3 +256,11 @@ func (self *BasicCommitsController) copy(commit *models.Commit) error {
func (self *BasicCommitsController) copyRange(*models.Commit) error {
return self.c.Helpers().CherryPick.CopyRange(self.context.GetSelectedLineIdx(), self.context.GetCommits(), self.context)
}

func (self *BasicCommitsController) openDiffTool(commit *models.Commit) error {
to := commit.RefName()
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(commit.ParentRefName())
_, err := self.c.RunSubprocess(self.c.Git().File.OpenDiffToolCmdObj(
from, to, reverse, ".", true))
return err
}

0 comments on commit f23fd7c

Please sign in to comment.