Commit | Line | Data |
---|---|---|
8c8be628 YD |
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 bases/master..HEAD | | |
35 | git-am -3 -k | |
36 | ) | |
37 | " | |
38 | ||
39 | test_expect_success \ | |
40 | 'Pull to sync with parent, preparing for the problem' \ | |
41 | "(cd bar && stg pop --all && | |
42 | stg pull | |
43 | ) | |
44 | " | |
45 | ||
46 | test_expect_failure \ | |
47 | 'Attempt to push the first of those patches without --merged' \ | |
48 | "(cd bar && stg push | |
49 | ) | |
50 | " | |
51 | ||
52 | test_expect_success \ | |
53 | 'Rollback the push' \ | |
539fb292 | 54 | "(cd bar && stg status --reset && stg push --undo |
8c8be628 YD |
55 | ) |
56 | " | |
57 | ||
58 | test_expect_success \ | |
59 | 'Push those patches while checking they were merged upstream' \ | |
60 | "(cd bar && stg push --merged --all | |
61 | ) | |
62 | " | |
63 | ||
64 | test_done |