Reproduction steps
Use git_checkout_index to checkout multiple modified files (where we want to revert the changes that were made) with the GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH flag enabled in the checkout_strategy where the files all have the same prefix as other modified files.
For example, I modified test9.txt, test10.txt, test11.txt and test12.txt and I want to discard the changes from test10.txt and test11.txt by using git_checkout_index.
Expected behavior
Only the files specified in the git_checkout_options's paths should be checked out.
In my example, that would be only test10.txt and test11.txt.
Actual behavior
All of the files with the same prefix as the two checked out files have their changes discarded too.
In my example, the changes made to test12.txt would also be discarded because test12.txt has test1 as prefix.
I created a test case in checkout/index.c in a branch in my libgit2 fork that demonstrates the issue: f37c77b
Version of libgit2 (release number or SHA1)
5597517 (which is the latest commit on master).
Also reproduced on 15e1193 (which dates back from 2017)
Operating system(s) tested
macOS 10.15.2 (build 19C57)
Reproduction steps
Use
git_checkout_indexto checkout multiple modified files (where we want to revert the changes that were made) with theGIT_CHECKOUT_DISABLE_PATHSPEC_MATCHflag enabled in thecheckout_strategywhere the files all have the same prefix as other modified files.For example, I modified
test9.txt,test10.txt,test11.txtandtest12.txtand I want to discard the changes fromtest10.txtandtest11.txtby usinggit_checkout_index.Expected behavior
Only the files specified in the
git_checkout_options'spathsshould be checked out.In my example, that would be only
test10.txtandtest11.txt.Actual behavior
All of the files with the same prefix as the two checked out files have their changes discarded too.
In my example, the changes made to
test12.txtwould also be discarded becausetest12.txthastest1as prefix.I created a test case in
checkout/index.cin a branch in my libgit2 fork that demonstrates the issue: f37c77bVersion of libgit2 (release number or SHA1)
5597517 (which is the latest commit on master).
Also reproduced on 15e1193 (which dates back from 2017)
Operating system(s) tested
macOS 10.15.2 (build 19C57)