Merge branch 'jc/all-negative-pathspec'

A git subcommand like "git add -p" spawns a separate git process
while relaying its command line arguments.  A pathspec with only
negative elements was mistakenly passed with an empty string, which
has been corrected.

* jc/all-negative-pathspec:
  pathspec: correct an empty string used as a pathspec element
This commit is contained in:
Junio C Hamano
2022-06-07 14:10:59 -07:00
2 changed files with 182 additions and 1 deletions

View File

@ -629,7 +629,7 @@ void parse_pathspec(struct pathspec *pathspec,
*/
if (nr_exclude == n) {
int plen = (!(flags & PATHSPEC_PREFER_CWD)) ? 0 : prefixlen;
init_pathspec_item(item + n, 0, prefix, plen, "");
init_pathspec_item(item + n, 0, prefix, plen, ".");
pathspec->nr++;
}