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
This commit is contained in:
Junio C Hamano
2017-04-26 15:39:03 +09:00
2 changed files with 23 additions and 1 deletions

View File

@ -505,7 +505,7 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
* 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 */