]>
Commit | Line | Data |
---|---|---|
dda1f2a5 TR |
1 | #!/bin/sh |
2 | ||
3 | test_description='git checkout --patch' | |
4 | . ./lib-patch-mode.sh | |
5 | ||
f2f7b6a5 | 6 | test_expect_success PERL 'setup' ' |
dda1f2a5 TR |
7 | mkdir dir && |
8 | echo parent > dir/foo && | |
9 | echo dummy > bar && | |
10 | git add bar dir/foo && | |
11 | git commit -m initial && | |
12 | test_tick && | |
13 | test_commit second dir/foo head && | |
14 | echo index > dir/foo && | |
15 | git add dir/foo && | |
16 | set_and_save_state bar bar_work bar_index && | |
17 | save_head | |
18 | ' | |
19 | ||
20 | # note: bar sorts before dir, so the first 'n' is always to skip 'bar' | |
21 | ||
f2f7b6a5 | 22 | test_expect_success PERL 'saying "n" does nothing' ' |
a48fcd83 | 23 | set_state dir/foo work index && |
dda1f2a5 TR |
24 | (echo n; echo n) | test_must_fail git stash save -p && |
25 | verify_state dir/foo work index && | |
26 | verify_saved_state bar | |
27 | ' | |
28 | ||
f2f7b6a5 | 29 | test_expect_success PERL 'git stash -p' ' |
dda1f2a5 TR |
30 | (echo n; echo y) | git stash save -p && |
31 | verify_state dir/foo head index && | |
32 | verify_saved_state bar && | |
33 | git reset --hard && | |
34 | git stash apply && | |
35 | verify_state dir/foo work head && | |
36 | verify_state bar dummy dummy | |
37 | ' | |
38 | ||
f2f7b6a5 | 39 | test_expect_success PERL 'git stash -p --no-keep-index' ' |
dda1f2a5 TR |
40 | set_state dir/foo work index && |
41 | set_state bar bar_work bar_index && | |
42 | (echo n; echo y) | git stash save -p --no-keep-index && | |
43 | verify_state dir/foo head head && | |
44 | verify_state bar bar_work dummy && | |
45 | git reset --hard && | |
46 | git stash apply --index && | |
47 | verify_state dir/foo work index && | |
48 | verify_state bar dummy bar_index | |
49 | ' | |
50 | ||
3a243f70 | 51 | test_expect_success PERL 'git stash --no-keep-index -p' ' |
21ec98a7 DM |
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 | ||
f2f7b6a5 | 63 | test_expect_success PERL 'none of this moved HEAD' ' |
dda1f2a5 TR |
64 | verify_saved_head |
65 | ' | |
66 | ||
67 | test_done |