jesseduffield.lazygit/pkg/gui/controllers
Stefan Haller 0f7f1a56df Fix showing diffs for renamed file when filtering by path
When filtering for a file path we use the --follow option for "git log", so it
will follow renames of the file, which is great. However, if you then selected
one of the commits before a rename, you didn't see a diff, because we would pass
the original filter path to the "git show" call.

To fix this, call git log with the --name-status option when filtering by path,
so that each commit reports which file paths are touched in this commit;
remember these in the commit object, so that we can pass them to the "git show"
call later.

Be careful not to store too many such paths unnecessarily. When filtering by
folder rather than file, all these paths will necessarily be inside the original
filter path, so detect this and don't store them in this case.

There is some unfortunate code duplication between loading commits and loading
reflog commits, which I am too lazy to clean up right now.
2025-07-27 12:05:41 +02:00
..
helpers Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
attach.go Allow clicking in focused main view to go to staging 2025-04-21 18:03:24 +02:00
base_controller.go Allow clicking in focused main view to go to staging 2025-04-21 18:03:24 +02:00
basic_commits_controller.go Add FullRefName to all reset menus 2025-06-04 20:43:01 +02:00
bisect_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
branches_controller.go Add new command "Checkout previous branch" 2025-07-12 18:17:25 +02:00
command_log_controller.go Remove return value of Focus-related functions 2024-09-06 08:45:48 +02:00
commit_description_controller.go Cleanup: use FocusedView property for mouse bindings 2025-07-11 11:18:28 +02:00
commit_message_controller.go Cleanup: use FocusedView property for mouse bindings 2025-07-11 11:18:28 +02:00
commits_files_controller.go Move DiffContextSize and RenameSimilarityThreshold to user config 2025-07-09 13:15:03 +02:00
common.go lots of changes 2023-04-30 13:19:53 +10:00
confirmation_controller.go Allow switching between confirmation and suggestions by clicking 2025-07-11 11:18:28 +02:00
context_lines_controller.go Move DiffContextSize and RenameSimilarityThreshold to user config 2025-07-09 13:15:03 +02:00
custom_patch_options_menu_action.go Use ConfirmIf where applicable 2025-07-08 16:41:22 +02:00
diffing_menu_action.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
files_controller.go Use ConfirmIf where applicable 2025-07-08 16:41:22 +02:00
filter_controller.go Introduce filtered list view model 2023-07-03 12:54:13 +10:00
filtering_menu_action.go Refresh all affected scopes when entering/exiting filtering 2025-07-27 12:03:06 +02:00
git_flow_controller.go Remove unnecessary type arguments 2025-03-03 21:24:49 +01:00
global_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
jump_to_side_window_controller.go Cleanup: get rid of the variadic parameter of ContextMgr.Push 2025-04-08 16:08:25 +02:00
list_controller.go Add proper double-click handling for list views 2025-07-11 10:52:57 +02:00
list_controller_trait.go Enable nolintlint linter, and fix warnings 2025-06-30 18:30:11 +02:00
local_commits_controller.go Add tooltips for commit log menu 2025-07-09 13:16:42 +02:00
local_commits_controller_test.go Keep the same line selected after squashing fixup commits 2024-03-09 07:55:22 +01:00
main_view_controller.go Add ContextMgr.NextInStack and use it to access side panel of focused main view 2025-05-22 14:38:40 +02:00
menu_controller.go Remove unnecessary type arguments 2025-03-03 21:24:49 +01:00
merge_conflicts_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
options_menu_action.go Disable KeybindingsMenu using a DisabledReason when a panel is open 2025-01-03 10:09:42 +01:00
patch_building_controller.go Escape out of hunk mode only if it was turned on by the user 2025-07-04 19:41:40 +02:00
patch_explorer_controller.go In hunk staging mode, select blocks of changes rather than actual hunks 2025-07-04 19:31:35 +02:00
patch_explorer_controller_test.go Strip the '+' and '-' characters when copying parts of a diff to the clipboard 2025-04-29 11:33:47 +02:00
quit_actions.go Use ConfirmIf where applicable 2025-07-08 16:41:22 +02:00
reflog_commits_controller.go Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
remote_branches_controller.go Add a prompt for the sort order menus for branches 2025-07-09 13:16:42 +02:00
remotes_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
rename_similarity_threshold_controller.go Move DiffContextSize and RenameSimilarityThreshold to user config 2025-07-09 13:15:03 +02:00
screen_mode_actions.go Standardise on 'screen mode' name 2025-01-11 14:25:48 +11:00
scroll_off_margin.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00
scroll_off_margin_test.go Add tests for scroll-off margin of zero 2023-08-21 08:10:28 +02:00
search_controller.go Introduce filtered list view model 2023-07-03 12:54:13 +10:00
search_prompt_controller.go Enforce single-item selection in various actions 2024-01-19 10:50:49 +11:00
shell_command_action.go Add config os.shellFunctionsFile 2025-04-07 14:35:40 +02:00
side_window_controller.go Cleanup: get rid of the variadic parameter of ContextMgr.Push 2025-04-08 16:08:25 +02:00
snake_controller.go Cleanup: get rid of the variadic parameter of ContextMgr.Push 2025-04-08 16:08:25 +02:00
staging_controller.go Move DiffContextSize and RenameSimilarityThreshold to user config 2025-07-09 13:15:03 +02:00
stash_controller.go Use ConfirmIf where applicable 2025-07-08 16:41:22 +02:00
status_controller.go Split behavior of rendering allBranchesLogCmd and switching to next cmd 2025-05-21 08:17:09 +02:00
sub_commits_controller.go Use async refresh rather than manual OnWorker call 2025-07-02 16:10:04 +02:00
submodules_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
suggestions_controller.go Allow switching between confirmation and suggestions by clicking 2025-07-11 11:18:28 +02:00
switch_to_diff_files_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
switch_to_focused_main_view_controller.go Add ContextMgr.NextInStack and use it to access side panel of focused main view 2025-05-22 14:38:40 +02:00
switch_to_sub_commits_controller.go Remove unnecessary type arguments 2025-03-03 21:24:49 +01:00
sync_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
tags_controller.go Change Refresh to not return an error 2025-07-02 16:09:42 +02:00
toggle_whitespace_action.go Move IgnoreWhitespaceInDiffView to user config 2025-07-09 13:15:03 +02:00
undo_controller.go Use the non-filtered reflog for undoing 2025-07-27 12:05:41 +02:00
vertical_scroll_controller.go Add IGuiCommon.GetViewBufferManagerForView 2025-04-21 18:03:18 +02:00
view_selection_controller.go Read all lines from task when jumping to bottom 2025-04-21 18:03:19 +02:00
workspace_reset_controller.go Add confirmation for nuking the working tree 2025-07-13 14:04:14 +02:00
worktree_options_controller.go Remove unnecessary type arguments 2025-03-03 21:24:49 +01:00
worktrees_controller.go Remove unnecessary type arguments 2025-03-03 21:24:49 +01:00