chiark / gitweb /
Remove an unnecessary parameter to make_patch_name
[stgit] / t / t1200-push-modified.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Yann Dirson
4 #
5
6 test_description='Exercise pushing patches applied upstream.
7
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.'
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
19 test_create_repo foo
20
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
28      )
29 "
30
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
37      )
38     '
39
40 test_expect_success \
41     'Pull to sync with parent, preparing for the problem' \
42     "(cd bar && stg pop --all &&
43       stg pull
44      )
45 "
46
47 test_expect_failure \
48     'Attempt to push the first of those patches without --merged' \
49     "(cd bar && stg push
50      )
51 "
52
53 test_expect_success \
54     'Rollback the push' \
55     "(cd bar && stg push --undo
56      )
57 "
58
59 test_expect_success \
60     'Push those patches while checking they were merged upstream' \
61     "(cd bar && stg push --merged --all
62      )
63 "
64
65 test_done