lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Fix multi selection stage/discard not working for files with substrings

Open brandondong opened this issue 1 year ago • 2 comments

  • PR Description

I found an issue with multi selection stage/discard. Here is a minimal repro:

git init
touch a
touch aa
lazygit

Select both files using shift and hit space. Only a is staged.

  • Please check if the PR fulfills these requirements
  • [ ] Cheatsheets are up-to-date (run go generate ./...)
  • [x] Code has been formatted (see here)
  • [x] Tests have been added/updated (see here for the integration test guide)
  • [ ] Text is internationalised (see here)
  • [ ] Docs have been updated if necessary
  • [x] You've read through your own file changes for silly mistakes etc

brandondong avatar May 25 '24 23:05 brandondong

@brandondong could you make an integration test for this?

jesseduffield avatar May 26 '24 09:05 jesseduffield

To try for a realistic scenario in the test, I added the workflow that led to me discovering this issue in the first place: renaming a file by adding a suffix and then trying to range select and stage both the deleted and added file.

brandondong avatar May 26 '24 19:05 brandondong

great work @brandondong thanks for making this

jesseduffield avatar Jul 06 '24 11:07 jesseduffield