mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 23:56:24 -04:00
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.
|
||
|---|---|---|
| .. | ||
| bisect | ||
| branch | ||
| cherry_pick | ||
| commit | ||
| config | ||
| conflicts | ||
| custom_commands | ||
| demo | ||
| diff | ||
| file | ||
| filter_and_search | ||
| filter_by_author | ||
| filter_by_path | ||
| interactive_rebase | ||
| misc | ||
| patch_building | ||
| reflog | ||
| shared | ||
| shell_commands | ||
| staging | ||
| stash | ||
| status | ||
| submodule | ||
| sync | ||
| tag | ||
| ui | ||
| undo | ||
| worktree | ||
| test_list.go | ||
| test_list_generator.go | ||
| tests.go | ||