Commit | Line | Data |
---|---|---|
a57bd720 CM |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Catalin Marinas | |
4 | # | |
5 | ||
625e8de7 | 6 | test_description='Exercise stg undo with push of missing files. |
a57bd720 CM |
7 | |
8 | Test the case where a patch fails to be pushed because it modifies a | |
625e8de7 | 9 | missing file. The "stg undo" command has to be able to revert it. |
a57bd720 CM |
10 | ' |
11 | ||
12 | . ./test-lib.sh | |
13 | ||
14 | test_expect_success \ | |
15 | 'Initialize the StGIT repository' \ | |
16 | 'stg init | |
17 | ' | |
18 | ||
19 | test_expect_success \ | |
20 | 'Create the first patch' \ | |
21 | ' | |
22 | stg new foo -m foo && | |
23 | echo foo > test && | |
c7506039 | 24 | stg add test && |
a57bd720 CM |
25 | stg refresh |
26 | ' | |
27 | ||
28 | test_expect_success \ | |
29 | 'Create the second patch' \ | |
30 | ' | |
31 | stg new bar -m bar && | |
32 | echo bar > test && | |
c7506039 | 33 | stg add test && |
a57bd720 CM |
34 | stg refresh |
35 | ' | |
36 | ||
37 | test_expect_success \ | |
38 | 'Pop all patches' \ | |
39 | ' | |
40 | stg pop --all | |
41 | ' | |
42 | ||
5f594e90 | 43 | test_expect_success \ |
a57bd720 CM |
44 | 'Push the second patch with conflict' \ |
45 | ' | |
f979802d | 46 | conflict stg push bar |
a57bd720 CM |
47 | ' |
48 | ||
49 | test_expect_success \ | |
50 | 'Undo the previous push' \ | |
51 | ' | |
625e8de7 | 52 | stg undo --hard |
a57bd720 CM |
53 | ' |
54 | ||
cb688601 CM |
55 | test_expect_success \ |
56 | 'Check the push after undo fails as well' \ | |
57 | ' | |
f979802d | 58 | conflict stg push bar |
cb688601 CM |
59 | ' |
60 | ||
ca66756b CM |
61 | test_expect_success \ |
62 | 'Undo with disappeared newborn' \ | |
63 | ' | |
64 | touch newfile && | |
c7506039 | 65 | stg add newfile && |
ca66756b | 66 | rm newfile && |
625e8de7 | 67 | stg undo --hard |
ca66756b CM |
68 | ' |
69 | ||
a57bd720 | 70 | test_done |