summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-03-28 14:05:58 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-03-28 14:05:58 -0700
commita612436f1479b0f7db9a80f9ba34037ab52bfc12 (patch)
tree93e6df16e4907ba48104d4983a8e380005eb2d48 /t
parentMerge branch 'sb/checkout-recurse-submodules' (diff)
parentstash: keep untracked files intact in stash -k (diff)
downloadtgif-a612436f1479b0f7db9a80f9ba34037ab52bfc12.tar.xz
Merge branch 'tg/stash-push-fixup'
Recent enhancement to "git stash push" command to support pathspec to allow only a subset of working tree changes to be stashed away was found to be too chatty and exposed the internal implementation detail (e.g. when it uses reset to match the index to HEAD before doing other things, output from reset seeped out). These, and other chattyness has been fixed. * tg/stash-push-fixup: stash: keep untracked files intact in stash -k stash: pass the pathspec argument to git reset stash: don't show internal implementation details
Diffstat (limited to 't')
-rwxr-xr-xt/t3903-stash.sh16
-rwxr-xr-xt/t3904-stash-patch.sh8
2 files changed, 23 insertions, 1 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 89877e4b52..b71d1e659e 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -663,7 +663,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu
sane_unset GIT_MERGE_VERBOSITY &&
git stash apply
) |
- sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
+ sed -e 1d >actual && # drop "Saved..."
test_i18ncmp expect actual
'
@@ -907,4 +907,18 @@ test_expect_success 'stash without verb with pathspec' '
test_path_is_file bar
'
+test_expect_success 'stash -k -- <pathspec> leaves unstaged files intact' '
+ git reset &&
+ >foo &&
+ >bar &&
+ git add foo bar &&
+ git commit -m "test" &&
+ echo "foo" >foo &&
+ echo "bar" >bar &&
+ git stash -k -- foo &&
+ test "",bar = $(cat foo),$(cat bar) &&
+ git stash pop &&
+ test foo,bar = $(cat foo),$(cat bar)
+'
+
test_done
diff --git a/t/t3904-stash-patch.sh b/t/t3904-stash-patch.sh
index 38e730090f..83744f8c93 100755
--- a/t/t3904-stash-patch.sh
+++ b/t/t3904-stash-patch.sh
@@ -77,6 +77,14 @@ test_expect_success 'git stash --no-keep-index -p' '
verify_state dir/foo work index
'
+test_expect_success 'stash -p --no-keep-index -- <pathspec> does not unstage other files' '
+ set_state HEAD HEADfile_work HEADfile_index &&
+ set_state dir/foo work index &&
+ echo y | git stash push -p --no-keep-index -- HEAD &&
+ verify_state HEAD committed committed &&
+ verify_state dir/foo work index
+'
+
test_expect_success 'none of this moved HEAD' '
verify_saved_head
'