jesseduffield.lazygit/pkg/integration/tests
Stefan Haller 3df894ec92 Stage affected unstaged files when applying or reverting a patch
Unlike moving a patch to the index, applying or reverting a patch didn't
auto-stash, which means that applying a patch when there's a modified (but
unstaged) file in the working tree would error out with the message "error:
file1: does not match index", regardless of whether those modifications conflict
with the patch or not.

To fix this, we *could* add auto-stashing like we do for the "move patch to
index" command. However, in this case we rather simply stage the affected files
(after asking for confirmation). This has a few advantages:

- it only changes the staging state of those files that are contained in the
patch (whereas auto-stashing always changes all files to unstaged)
- it doesn't unnecessarily show a confirmation if none of the modified files are
affected by the patch
- if the patch conflicts with the modified files, the conflicts were "backwards"
("ours" was the patch, "theirs" the modified file); it is more logical if "ours"
is the current state of the file, and "theirs" is the patch.

It's a little unfortunate that the behavior isn't exactly the same as for "move
patch to index", but for that one we do need the auto-stash because of the
rebase that runs behind the scenes.
2025-07-02 16:19:06 +02:00
..
bisect Use getters for AppState and UserConfig instead of accessing the fields directly 2024-08-18 10:24:52 +02:00
branch Add integration test for resetting to upstream branch with duplicate name 2025-06-04 20:43:01 +02:00
cherry_pick Cleanup: remove unnecessary setup steps 2025-05-10 18:15:42 +02:00
commit Fix the CurrentBranchName function 2025-06-30 16:08:03 +02:00
config Add an integration test for a config with a negative refspec 2025-03-11 08:33:41 +01:00
conflicts Mention which command is continued in PromptToContinueRebase 2025-04-20 15:53:17 +02:00
custom_commands Combine customCommand's subprocess, stream, and showOutput fields into a single output enum 2025-05-01 15:46:06 +02:00
demo Add number of commits to cherry-pick confirmation prompt 2025-01-08 21:08:42 -08:00
diff Allow changing diff context size and rename threshold when main view is focused 2025-04-23 08:38:46 +02:00
file Add user config gui.addRootItemInFileTree 2025-05-24 18:17:25 +02:00
filter_and_search Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
filter_by_author Enable intrange linter, and fix warnings 2025-06-30 18:30:11 +02:00
filter_by_path Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
interactive_rebase Use 'break' instead of 'edit' for BeginInteractiveRebaseForCommit with merge commit 2025-05-10 18:44:31 +02:00
misc Cleanup: simplify and tighten test expectations related to clipboard 2025-02-19 18:50:12 +01:00
patch_building Stage affected unstaged files when applying or reverting a patch 2025-07-02 16:19:06 +02:00
reflog Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
shared Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
shell_commands Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
staging Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
stash Add unambigious refs/ prefix to all stash references 2025-06-15 16:14:59 +02:00
status Split behavior of rendering allBranchesLogCmd and switching to next cmd 2025-05-21 08:17:09 +02:00
submodule Fix view selection running out of sync with list selection when view isn't focused 2025-04-20 16:06:15 +02:00
sync Add config for auto-forwarding branches after fetching 2025-04-21 18:06:09 +02:00
tag Add integration tests showing resetting to duplicate named tags and branches 2025-06-04 20:43:01 +02:00
ui Allow clicking in main view to focus it 2025-04-21 18:03:24 +02:00
undo Add a root item ("/") if files at top level have changed 2025-03-21 08:04:58 +01:00
worktree Fix typos 2025-01-03 10:50:36 +11:00
test_list.go Add tests for applying a patch when there's a modified file 2025-07-02 16:19:06 +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