diff options
-rw-r--r-- | builtin/stash.c | 5 | ||||
-rwxr-xr-x | t/t3905-stash-include-untracked.sh | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 1bfa24030c..2f29d037c8 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -830,7 +830,7 @@ static void add_pathspecs(struct argv_array *args, int i; for (i = 0; i < ps.nr; i++) - argv_array_push(args, ps.items[i].match); + argv_array_push(args, ps.items[i].original); } /* @@ -1466,7 +1466,8 @@ static int push_stash(int argc, const char **argv, const char *prefix) git_stash_push_usage, 0); - parse_pathspec(&ps, 0, PATHSPEC_PREFER_FULL, prefix, argv); + parse_pathspec(&ps, 0, PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN, + prefix, argv); return do_push_stash(ps, stash_msg, quiet, keep_index, patch_mode, include_untracked); } diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh index cc1c8a7bb2..29ca76f2fb 100755 --- a/t/t3905-stash-include-untracked.sh +++ b/t/t3905-stash-include-untracked.sh @@ -283,4 +283,10 @@ test_expect_success 'stash -u -- <non-existant> shows no changes when there are test_i18ncmp expect actual ' +test_expect_success 'stash -u with globs' ' + >untracked.txt && + git stash -u -- ":(glob)**/*.txt" && + test_path_is_missing untracked.txt +' + test_done |