From: Junio C Hamano Date: Wed, 26 Apr 2017 06:39:03 +0000 (+0900) Subject: Merge branch 'ps/pathspec-empty-prefix-origin' X-Git-Tag: v2.13.0-rc1~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/44427a0c18c0179be72223650715f031a10a5e66?ds=inline;hp=-c Merge branch 'ps/pathspec-empty-prefix-origin' A recent update broke "git add -p ../foo" from a subdirectory. * ps/pathspec-empty-prefix-origin: pathspec: honor `PATHSPEC_PREFIX_ORIGIN` with empty prefix --- 44427a0c18c0179be72223650715f031a10a5e66 diff --combined pathspec.c index 69ef86b85a,3079a817a1..50f76fff45 --- a/pathspec.c +++ b/pathspec.c @@@ -505,7 -505,7 +505,7 @@@ static void init_pathspec_item(struct p * original. Useful for passing to another command. */ if ((flags & PATHSPEC_PREFIX_ORIGIN) && - prefixlen && !get_literal_global()) { + !get_literal_global()) { struct strbuf sb = STRBUF_INIT; /* Preserve the actual prefix length of each pattern */ @@@ -724,7 -724,7 +724,7 @@@ void clear_pathspec(struct pathspec *pa free(pathspec->items[i].match); free(pathspec->items[i].original); - for (j = 0; j < pathspec->items[j].attr_match_nr; j++) + for (j = 0; j < pathspec->items[i].attr_match_nr; j++) free(pathspec->items[i].attr_match[j].value); free(pathspec->items[i].attr_match);