Junio C Hamano <gitster@xxxxxxxxx> writes: > If you know offhand which callers pass neither of the two > PATHSPEC_PREFER_* bits and remember for what purpose you allowed > them to do so, please remind me. I'll keep digging in the meantime. Answering my own questions, here are my findings so far and a tentative conclusion. With or without the patch in this thread, parse_pathspec() behaves the same way for either CWD or FULL if you feed a non-empty pathspec with at least one positive element. IOW, if a caller feeds a non-empty pathspec and there is no "negative" element involved, it does not matter if we feed CWD or FULL. There are only a handful of callers that pass neither preference bits to parse_pathspec(). Here are my observations on them that tells me that most of them are OK if we change them to prefer either CWD or FULL: - archive.c::path_exists() feeds a pathspec with a single element to see if read_tree_recursive() finds any matching paths, to allow its caller to iterate over the original pathspec and see if there is a typo (i.e. an element that matches nothing). It should prefer FULL to match what parse_pathspec_arg(), its caller, uses. The caller probably should refrain from passing ones with negative magic. I.e. "git archive -- t :\!t/perf" errors out because checking each element independently in the loop means that ":\!t/perf" is checked alone, triggering "there is nothing to exclude from". - blame.c::find_origin() feeds a pathspec with a single element, which is a path in the history and does so as a literal, hence no room for "negative" to kick in. - builtin/check-ignore.c::check_ignore(), when argc==0, does not call parse_pathspec(). It does not take any magic other than FROMTOP, so "negative" won't come into the picture. - builtin/checkout.c::cmd_checkout(), when argc==0, does not call parse_pathspec(). This codepath will get affected by Linus's change ("cd t && git checkout :\!perf" would try to check out everything except t/perf, but what is a reasonable definition of "everything" in the context of this command). We need to decide, and I am leaning towards preferring CWD for this case. - revision.c::setup_revisions() calls parse_pathspec() only when the caller gave a non-empty pathspec. This pathspec is used for pruning log traversal (e.g. "only show commits that touch these paths") and is affected by Linus's change. It should favor FULL. - tree-diff.c::try_to_follow_renames() feeds a pathspec with a single element as a literal, hence no room for "negative" to kick in. So, I am tempted to suggest us doing the following: * Leave a NEEDSWORK comment to archive.c::path_exists() that is used for checking the validation of pathspec elements. To fix it properly, we need to be able to skip a negative pathspec to be passed to this function by the caller, and to do so, we need to expose a helper from the pathspec API that gets a single string and returns what magic it has, but that is of lower priority. * Retire the PATHSPEC_PREFER_CWD bit and replace its use with the lack of the PATHSPEC_PREFER_FULL bit. * Keep most of the above callsites that currently do not pass CWD/FULL as they are, except the ones that should take FULL (see above). Comments?