summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commit_files_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-22 13:03:20 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commite290710f6741c046ee7e52e622af813e8955639b (patch)
tree65a0ea8e98d43c5119ac0ec902572e452fae7ee5 /pkg/gui/commit_files_panel.go
parent438abd6003aff9621f93b8531aa20baad2c8933c (diff)
support drilling down into the files of a diff
Diffstat (limited to 'pkg/gui/commit_files_panel.go')
-rw-r--r--pkg/gui/commit_files_panel.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go
index 6e3cd4b1f..c5f898b4e 100644
--- a/pkg/gui/commit_files_panel.go
+++ b/pkg/gui/commit_files_panel.go
@@ -94,7 +94,24 @@ func (gui *Gui) refreshCommitFilesView() error {
}
isStash := gui.State.Panels.CommitFiles.refType == REF_TYPE_STASH
- files, err := gui.GitCommand.GetFilesInRef(gui.State.Panels.CommitFiles.refName, isStash, gui.GitCommand.PatchManager)
+ refName := gui.State.Panels.CommitFiles.refName
+ diffing := gui.State.Modes.Diffing
+
+ var files []*commands.CommitFile
+ var err error
+ if diffing.Active() {
+ from := diffing.Ref
+ to := refName
+
+ if diffing.Reverse {
+ from, to = to, from
+ }
+
+ files, err = gui.GitCommand.GetFilesInDiff(from, to, refName, gui.GitCommand.PatchManager)
+ } else {
+ files, err = gui.GitCommand.GetFilesInRef(refName, isStash, gui.GitCommand.PatchManager)
+ }
+
if err != nil {
return gui.surfaceError(err)
}