If any uncommit would fail, don't uncommit anything
[stgit/ydirson.git] / t / t1200-push-modified.sh
blob6769667fc6003945da33790b43cffb5802572949
1 #!/bin/sh
3 # Copyright (c) 2006 Yann Dirson
6 test_description='Exercise pushing patches applied upstream.
8 Especially, consider the case of a patch that adds a file, while a
9 subsequent one modifies it, so we have to use --merged for push to
10 detect the merge. Reproduce the common workflow where one does not
11 specify --merged, then rollback and retry with the correct flag.'
13 . ./test-lib.sh
15 # don't need this repo, but better not drop it, see t1100
16 #rm -rf .git
18 # Need a repo to clone
19 test_create_repo foo
21 test_expect_success \
22 'Clone tree and setup changes' \
23 "stg clone foo bar &&
24 (cd bar && stg new p1 -m p1
25 printf 'a\nc\n' > file && stg add file && stg refresh &&
26 stg new p2 -m p2
27 printf 'a\nb\nc\n' > file && stg refresh
31 test_expect_success \
32 'Port those patches to orig tree' \
33 '(cd foo &&
34 GIT_DIR=../bar/.git git-format-patch --stdout \
35 $(cd ../bar && stg id base@master)..HEAD |
36 git-am -3 -k
40 test_expect_success \
41 'Pull to sync with parent, preparing for the problem' \
42 "(cd bar && stg pop --all &&
43 stg pull
47 test_expect_failure \
48 'Attempt to push the first of those patches without --merged' \
49 "(cd bar && stg push
53 test_expect_success \
54 'Rollback the push' \
55 "(cd bar && stg push --undo
59 test_expect_success \
60 'Push those patches while checking they were merged upstream' \
61 "(cd bar && stg push --merged --all
65 test_done