Skip to content

Commit 412906f

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #2119 from dscho/update-stash-to-current
Update the built-in `git stash` to the latest version
2 parents d4e3d0d + 2159497 commit 412906f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

builtin/stash.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static void add_pathspecs(struct argv_array *args,
832832
int i;
833833

834834
for (i = 0; i < ps.nr; i++)
835-
argv_array_push(args, ps.items[i].match);
835+
argv_array_push(args, ps.items[i].original);
836836
}
837837

838838
/*
@@ -1468,7 +1468,8 @@ static int push_stash(int argc, const char **argv, const char *prefix)
14681468
git_stash_push_usage,
14691469
0);
14701470

1471-
parse_pathspec(&ps, 0, PATHSPEC_PREFER_FULL, prefix, argv);
1471+
parse_pathspec(&ps, 0, PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN,
1472+
prefix, argv);
14721473
return do_push_stash(ps, stash_msg, quiet, keep_index, patch_mode,
14731474
include_untracked);
14741475
}

git-legacy-stash.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ maybe_quiet () {
8686
shift
8787
if test -n "$GIT_QUIET"
8888
then
89-
eval "$@" 2>/dev/null
89+
"$@" 2>/dev/null
9090
else
91-
eval "$@"
91+
"$@"
9292
fi
9393
;;
9494
*)
9595
if test -n "$GIT_QUIET"
9696
then
97-
eval "$@" >/dev/null 2>&1
97+
"$@" >/dev/null 2>&1
9898
else
99-
eval "$@"
99+
"$@"
100100
fi
101101
;;
102102
esac

t/t3905-stash-include-untracked.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,10 @@ test_expect_success 'stash -u -- <non-existant> shows no changes when there are
283283
test_i18ncmp expect actual
284284
'
285285

286+
test_expect_success 'stash -u with globs' '
287+
>untracked.txt &&
288+
git stash -u -- ":(glob)**/*.txt" &&
289+
test_path_is_missing untracked.txt
290+
'
291+
286292
test_done

0 commit comments

Comments
 (0)