Make 'push --undo' safer
[stgit] / t / t1202-push-undo.sh
CommitLineData
a57bd720
CM
1#!/bin/sh
2#
3# Copyright (c) 2006 Catalin Marinas
4#
5
6test_description='Exercise push --undo with missing files.
7
8Test the case where a patch fails to be pushed because it modifies a
9missing file. The "push --undo" command has to be able to revert it.
10'
11
12. ./test-lib.sh
13
14test_expect_success \
15 'Initialize the StGIT repository' \
16 'stg init
17'
18
19test_expect_success \
20 'Create the first patch' \
21 '
22 stg new foo -m foo &&
23 echo foo > test &&
24 stg add test &&
25 stg refresh
26 '
27
28test_expect_success \
29 'Create the second patch' \
30 '
31 stg new bar -m bar &&
32 echo bar > test &&
33 stg add test &&
34 stg refresh
35 '
36
37test_expect_success \
38 'Pop all patches' \
39 '
40 stg pop --all
41 '
42
43test_expect_failure \
44 'Push the second patch with conflict' \
45 '
46 stg push bar
47 '
48
49test_expect_success \
50 'Undo the previous push' \
51 '
539fb292 52 stg status --reset &&
a57bd720
CM
53 stg push --undo
54 '
55
56test_done