]> git.ipfire.org Git - thirdparty/git.git/commit - t/t2025-checkout-no-overlay.sh
checkout, restore: make pathspec recursive
authorRené Scharfe <l.s.r@web.de>
Sat, 22 Aug 2020 08:57:59 +0000 (10:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 22 Aug 2020 20:37:43 +0000 (13:37 -0700)
commitbfda204ade8a19357cf073c98dc3a5043533b4c4
treebe3bb1b81c3ead7c0753dd907079848114dd5faa
parent135365dd991f9520406012e30ab27a8d22951df8
checkout, restore: make pathspec recursive

The pathspec given to git checkout and git restore is used with both
tree_entry_interesting (via read_tree_recursive) and match_pathspec
(via ce_path_match).  The latter effectively only supports recursive
matching regardless of the value of the pathspec flag "recursive",
which is unset here.

That causes different match results for pathspecs with wildcards, and
can lead checkout and restore in no-overlay mode to remove entries
instead of modifying them.  Enable recursive matching for both checkout
and restore to make matching consistent.

Setting the flag in checkout_main() technically also affects git switch,
but since that command doesn't accept pathspecs at all this has no
actual consequence.

Reported-by: Sergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Initial-test-by: Sergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
t/t2025-checkout-no-overlay.sh
t/t2072-restore-pathspec-file.sh