Skip to content

Commit 21ec98a

Browse files
toofishesgitster
authored andcommitted
stash: add two more tests for --no-keep-index
One of these passes just fine; the other one exposes a problem where command line flag order matters for --no-keep-index and --patch interaction. Signed-off-by: Dan McGee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fa38cfc commit 21ec98a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

t/t3903-stash.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ test_expect_success 'stash -k' '
218218
test bar,bar4 = $(cat file),$(cat file2)
219219
'
220220

221+
test_expect_success 'stash --no-keep-index' '
222+
echo bar33 > file &&
223+
echo bar44 > file2 &&
224+
git add file2 &&
225+
git stash --no-keep-index &&
226+
test bar,bar2 = $(cat file),$(cat file2)
227+
'
228+
221229
test_expect_success 'stash --invalid-option' '
222230
echo bar5 > file &&
223231
echo bar6 > file2 &&

t/t3904-stash-patch.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ test_expect_success PERL 'git stash -p --no-keep-index' '
4848
verify_state bar dummy bar_index
4949
'
5050

51+
test_expect_failure PERL 'git stash --no-keep-index -p' '
52+
set_state dir/foo work index &&
53+
set_state bar bar_work bar_index &&
54+
(echo n; echo y) | git stash save --no-keep-index -p &&
55+
verify_state dir/foo head head &&
56+
verify_state bar bar_work dummy &&
57+
git reset --hard &&
58+
git stash apply --index &&
59+
verify_state dir/foo work index &&
60+
verify_state bar dummy bar_index
61+
'
62+
5163
test_expect_success PERL 'none of this moved HEAD' '
5264
verify_saved_head
5365
'

0 commit comments

Comments
 (0)