chiark / gitweb /
Fix t1200 to catch intermediate errors.
[stgit] / t / t1200-push-modified.sh
CommitLineData
8c8be628
YD
1#!/bin/sh
2#
3# Copyright (c) 2006 Yann Dirson
4#
5
6test_description='Exercise pushing patches applied upstream.
7
8Especially, consider the case of a patch that adds a file, while a
9subsequent one modifies it, so we have to use --merged for push to
10detect the merge. Reproduce the common workflow where one does not
11specify --merged, then rollback and retry with the correct flag.'
12
13. ./test-lib.sh
14
15# don't need this repo, but better not drop it, see t1100
16#rm -rf .git
17
18# Need a repo to clone
19test_create_repo foo
20
21test_expect_success \
22 'Clone tree and setup changes' \
23 "stg clone foo bar &&
f32c0bfa 24 (cd bar && stg new p1 -m p1 &&
8c8be628 25 printf 'a\nc\n' > file && stg add file && stg refresh &&
f32c0bfa 26 stg new p2 -m p2 &&
8c8be628
YD
27 printf 'a\nb\nc\n' > file && stg refresh
28 )
29"
30
31test_expect_success \
32 'Port those patches to orig tree' \
16d69115
KH
33 '(cd foo &&
34 GIT_DIR=../bar/.git git-format-patch --stdout \
35 $(cd ../bar && stg id base@master)..HEAD |
8c8be628
YD
36 git-am -3 -k
37 )
16d69115 38 '
8c8be628
YD
39
40test_expect_success \
41 'Pull to sync with parent, preparing for the problem' \
42 "(cd bar && stg pop --all &&
43 stg pull
44 )
45"
46
47test_expect_failure \
48 'Attempt to push the first of those patches without --merged' \
49 "(cd bar && stg push
50 )
51"
52
53test_expect_success \
54 'Rollback the push' \
53f76663 55 "(cd bar && stg push --undo
8c8be628
YD
56 )
57"
58
59test_expect_success \
60 'Push those patches while checking they were merged upstream' \
61 "(cd bar && stg push --merged --all
62 )
63"
64
65test_done