jesseduffield.lazygit/pkg/integration/tests
Stefan Haller f84ada4941 Show renamed files in the custom patch builder
When loading the files of a commit we passed --no-renames, so a rename
showed up as a separate delete and add rather than a single R entry.
That made it impossible to work with a rename that also modifies the
file: the modifications were spread across a full deletion and a full
addition instead of appearing as the handful of lines that actually
changed. The staging view already shows renames and lets you stage
their hunks, so there was no good reason for the patch builder to
differ; the flag was only there because the commit-file parser couldn't
cope with the rename record format.

Switch the commit-file loader and the per-file diff to --find-renames,
teach the parser about the rename record (a status followed by two
paths), and carry the previous path through the patch builder so the
diff for a rename is loaded with both paths, which is what makes git
emit the rename in the first place.

A whole-file selection keeps the rename in the header, so the rename
moves or is discarded together with the file's contents. A partial
selection instead strips the rename metadata and points the header at
the new path, so applying the patch only changes the contents and
leaves the rename in place; the blob index line is kept so that a 3-way
apply can still fall back to a blob merge.

Discarding a renamed file from a commit now discards both the new and
the old path, so the new file is removed and the old one is restored.

Changing the rename similarity threshold refreshes the commit files
panel too, not just the files panel, so that a rename can turn into a
delete and add or back. It is disabled while building a patch, however,
because the patch builder caches each file's diff by path and would
desync if a rename changed into a delete and add underneath it.

Finally, copying a file's diff from the commit files panel now passes
both paths for a rename, so the copied diff shows the rename instead of
a new-file add.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 13:05:09 +02:00
..
bisect Un-deprecate UserConfig.Git.Log.Order and ShowGraph 2025-07-09 13:15:03 +02:00
branch Use more widely-supported Unicode symbols for the commit graph 2026-05-04 13:06:29 +02:00
cherry_pick Keep selected commits stable across refreshes 2026-06-23 09:20:05 +02:00
commit Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
config Test per-repo side panel config and re-application on repo switch 2026-06-23 14:15:18 +02:00
conflicts Auto-dismiss the continue-rebase prompt when it becomes stale 2026-07-03 18:30:02 +02:00
custom_commands Convert custom command Key fields to Keybinding 2026-05-25 15:32:47 +02:00
demo Move the new-worktree keybinding from worktrees to universal 2026-07-03 18:53:05 +02:00
diff Allow cycling pagers in reverse 2026-06-07 15:51:57 +02:00
file Only prompt to continue a rebase/merge if we started it 2026-07-03 18:28:07 +02:00
filter_and_search Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
filter_by_author Un-deprecate UserConfig.Git.Log.Order and ShowGraph 2025-07-09 13:15:03 +02:00
filter_by_path When entering a commit in path filtering mode, select the filtered path 2025-10-09 09:58:15 +02:00
interactive_rebase Convert custom command Key fields to Keybinding 2026-05-25 15:32:47 +02:00
misc Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
patch_building Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
reflog Un-deprecate UserConfig.Git.Log.Order and ShowGraph 2025-07-09 13:15:03 +02:00
remote feat: add fork remote command 2025-11-16 17:26:00 +01:00
shared Add merge options menu 2025-10-09 08:45:58 +02:00
shell_commands Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
staging Revert test workaround 2026-03-19 16:57:53 +01:00
stash Fix dropping a range of stashes in filtered mode 2025-08-25 18:41:06 +02:00
status Add backward cycling support for all branches log view 2026-03-08 17:06:17 +01:00
submodule Show per-side commit logs for submodule conflicts in the main view 2026-06-28 16:12:36 +02:00
sync Tighten a test expectation 2026-06-22 09:00:15 +02:00
tag Fix deleting a remote tag when a remote branch with the same name exists 2025-11-27 19:52:18 +01:00
ui Re-apply the side panel config on a live config reload 2026-06-23 14:15:18 +02:00
undo Switch to branches view when checking out a commit 2025-11-16 21:23:40 +01:00
worktree Offer to delete the branch when removing a worktree 2026-07-03 19:04:44 +02:00
test_list.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
test_list_generator.go Fix typos 2025-01-03 10:50:36 +11:00
tests.go Set working directory in lazygit test command 2024-01-12 19:59:31 +11:00