From: Brandon Williams Date: Thu, 11 May 2017 22:04:25 +0000 (-0700) Subject: ls-files: prevent prune_cache from overeagerly pruning submodules X-Git-Tag: v2.14.0-rc0~147^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/cbca060e102aedcedbd1c4b5394aeed24885d5de?hp=cbca060e102aedcedbd1c4b5394aeed24885d5de ls-files: prevent prune_cache from overeagerly pruning submodules Since (ae8d08242 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 Signed-off-by: Junio C Hamano ---