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 <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dan McGee committed
Apr 7, 2011 at 12:04 UTC
21ec98a75d9cecaeb1493462da593343441661b6
2 files changed
+20
t/t3903-stash.sh
+8
@@ -218,6 +218,14 @@ test_expect_success 'stash -k' '
218
test bar,bar4 = $(cat file),$(cat file2)
219
'
220
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
+
229
test_expect_success 'stash --invalid-option' '
230
echo bar5 > file &&
231
echo bar6 > file2 &&
t/t3904-stash-patch.sh
+12
@@ -48,6 +48,18 @@ test_expect_success PERL 'git stash -p --no-keep-index' '
48
verify_state bar dummy bar_index
49
'
50
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
+
63
test_expect_success PERL 'none of this moved HEAD' '
64
verify_saved_head
65
'