debian/rules should be producing architecture independent packages
[stgit/dwhite.git] / t / t1200-push-modified.sh
blob113e41d5e1c57c39a931bc36604d77539d3bba2f
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 &&
25 cd bar && stg new p1 -m p1 &&
26 printf "a\nc\n" > file && git add file && stg refresh &&
27 stg new p2 -m p2 &&
28 printf "a\nb\nc\n" > file && stg refresh &&
29 [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
30 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
34 test_expect_success \
35 'Port those patches to orig tree' '
37 cd foo &&
38 GIT_DIR=../bar/.git git-format-patch --stdout \
39 $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
43 test_expect_success \
44 'Pull to sync with parent, preparing for the problem' \
45 "(cd bar && stg pop --all &&
46 stg pull
50 test_expect_success \
51 'Attempt to push the first of those patches without --merged' \
52 "(cd bar && conflict_old stg push
56 test_expect_success \
57 'Rollback the push' '
59 cd bar && stg push --undo &&
60 [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
61 [ "$(echo $(stg series --unapplied --noprefix))" = "p1 p2" ]
65 test_expect_success \
66 'Push those patches while checking they were merged upstream' '
68 cd bar && stg push --merged --all
69 [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
70 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
74 test_done