Skip to content

stash: support pathspec argument

Thomas Gummerer git 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest6 patches 3 repliesIn review
  2. v76 patches 6 repliesSuperseded
  3. v66 patches 6 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v56 patches8 repliesSuperseded
v47 patches2 repliesSuperseded
v35 patches21 repliesSuperseded
v24 patches8 repliesSuperseded
v13 patches13 repliesSuperseded

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6stash: introduce push verbDocumentation/git-stash.txt git-stash.sh t/t3903-stash.sh+55 -30 replies
2/6stash: add test for the create command line argumentst/t3903-stash.sh+18 -00 replies
3/6stash: refactor stash_creategit-stash.sh+18 -40 replies
4/6stash: teach 'push' (and 'create_stash') to honor pathspecDocumentation/git-stash.txt git-stash.sh t/t3903-stash.sh +1 more+154 -123 replies
5/6stash: use stash_push for no verb formDocumentation/git-stash.txt git-stash.sh t/t3903-stash.sh+13 -150 replies
6/6stash: allow pathspecs in the no verb formDocumentation/git-stash.txt git-stash.sh t/t3903-stash.sh+25 -40 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by.

PatchJunio C Hamano
1/6Helped-by
2/6
3/6
4/6Helped-by
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/6] stash: support pathspec argument

Thanks Junio for the review and the squashable diff with the fix for my errors.

I changed it a tiny bit, to use git stash push instead of git stash, so the complete diff could go into 4/6, where I think I think the test fits best.

Interdiff below:

git-stash.sh +2 -0
index 28d0624c75..207c8126f4 100755
@@ -300,6 +300,8 @@ push_stash () {
 		if test $# != 0
 		then
 			git reset ${GIT_QUIET:+-q} -- "$@"
+			git ls-files -z --modified -- "$@" |
+			git checkout-index -z --force --stdin
 			git checkout ${GIT_QUIET:+-q} HEAD -- $(git ls-files -z --modified "$@")
 			git clean --force ${GIT_QUIET:+-q} -d -- "$@"
 		else
t/t3903-stash.sh +16 -0
index f7733b4dd4..89877e4b52 100755
@@ -842,6 +842,22 @@ test_expect_success 'stash with file including $IFS character' '
 	test_path_is_file bar
 '
 
+test_expect_success 'stash with pathspec matching multiple paths' '
+       echo original >file &&
+       echo original >other-file &&
+       git commit -m "two" file other-file &&
+       echo modified >file &&
+       echo modified >other-file &&
+       git stash push -- "*file" &&
+       echo original >expect &&
+       test_cmp expect file &&
+       test_cmp expect other-file &&
+       git stash pop &&
+       echo modified >expect &&
+       test_cmp expect file &&
+       test_cmp expect other-file
+'
+
 test_expect_success 'stash push -p with pathspec shows no changes only once' '
 	>foo &&
 	git add foo &&

Thomas Gummerer (6):
stash: introduce push verb
stash: add test for the create command line arguments
stash: refactor stash_create
stash: teach 'push' (and 'create_stash') to honor pathspec
stash: use stash_push for no verb form
stash: allow pathspecs in the no verb form

 Documentation/git-stash.txt        |  25 +++++--
 git-stash.sh                       | 116 +++++++++++++++++++++++++------
 t/t3903-stash.sh                   | 138 ++++++++++++++++++++++++++++++++++++-
 t/t3905-stash-include-untracked.sh |  26 +++++++
 4 files changed, 275 insertions(+), 30 deletions(-)
Signature · 1 line
2.12.0.428.g67fe103aa