Commit cbca060
ls-files: prevent prune_cache from overeagerly pruning submodules
Since (ae8d082 pathspec: pass directory indicator to
match_pathspec_item()) the path matching logic has been able to cope
with submodules without needing to strip off a trailing slash if a path
refers to a submodule.
ls-files is the only caller of 'parse_pathspec()' which relies on the
behavior of the PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag because it
uses the result to construct a common prefix of all provided pathspecs
which is then used to prune the index of all entries which don't have
that prefix. Since submodules entries in the index don't have a
trailing slash 'prune_cache()' will be overeager and prune a submodule
'sub' if the common prefix is 'sub/'. To correct this behavior, only
prune entries which don't match up to, but not including, a trailing
slash of the common prefix.
This is in preparation to remove the
PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag in a later patch.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent c08397e commit cbca060
1 file changed
+25
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
406 | 425 | | |
407 | 426 | | |
408 | 427 | | |
| |||
624 | 643 | | |
625 | 644 | | |
626 | 645 | | |
627 | | - | |
628 | | - | |
| 646 | + | |
629 | 647 | | |
630 | 648 | | |
631 | 649 | | |
| |||
637 | 655 | | |
638 | 656 | | |
639 | 657 | | |
640 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
641 | 661 | | |
642 | 662 | | |
643 | 663 | | |
| |||
651 | 671 | | |
652 | 672 | | |
653 | 673 | | |
654 | | - | |
655 | 674 | | |
656 | 675 | | |
657 | 676 | | |
| |||
0 commit comments