[Revert] Make 'push --undo' safer
[stgit/ydirson.git] / t / t1200-push-modified.sh
blob7847a38dd186cfe69828339e24d5cf9e10c9014a
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 bases/master..HEAD |
35 git-am -3 -k
39 test_expect_success \
40 'Pull to sync with parent, preparing for the problem' \
41 "(cd bar && stg pop --all &&
42 stg pull
46 test_expect_failure \
47 'Attempt to push the first of those patches without --merged' \
48 "(cd bar && stg push
52 test_expect_success \
53 'Rollback the push' \
54 "(cd bar && stg push --undo
58 test_expect_success \
59 'Push those patches while checking they were merged upstream' \
60 "(cd bar && stg push --merged --all
64 test_done