tg.sh: handle help -h
[topgit/pro.git] / t / t5012-update-issue-6.sh
blob2d91a58c95d7e31bc4f4e7b784e25fe2926938d6
1 #!/bin/sh
3 test_description='test update with thinned .topdeps
5 When fetching updates from a remote that brings in a
6 .topdeps file that has had dependency lines removed (and
7 removed properly with the necessary "revert" patch added to
8 the base) and simultaneously brings in an update to one of
9 the branches that depends on that dependency removal, make
10 sure the local update succeeds.
13 TEST_NO_CREATE_REPO=1
15 . ./test-lib.sh
17 test_plan 8
19 test_expect_success 'setup upstream' '
20 test_create_repo upstream &&
21 cd upstream &&
22 git checkout --orphan master &&
23 test_commit "master upstream" master.txt &&
24 test_when_finished test_tick=$test_tick
27 test_expect_success LASTOK 'setup collab1' '
28 test_create_repo collab1 &&
29 cd collab1 &&
30 git checkout --orphan orphan &&
31 git remote add origin ../upstream &&
32 git fetch &&
33 git update-ref refs/heads/master refs/remotes/origin/master &&
34 git rev-parse --verify --quiet refs/heads/master -- >/dev/null &&
35 tg_test_create_branch t/feature1 master &&
36 git checkout -f t/feature1 &&
37 test_commit "feature one" feature1.txt &&
38 tg_test_create_branch t/feature2 master &&
39 git checkout -f t/feature2 &&
40 echo "master with feature2 added" >master.txt &&
41 test_tick &&
42 git commit -am "feature two" &&
43 tg_test_create_branch stage -m "[STAGE] staging" t/feature1 t/feature2 &&
44 git checkout -f stage &&
45 test_tick &&
46 tg update --no-stash &&
47 test_tick &&
48 git commit --amend --reset-author --no-edit &&
49 test_when_finished test_tick=$test_tick
52 test_expect_success LASTOK 'setup collab2' '
53 test_create_repo collab2 &&
54 cd collab2 &&
55 git checkout --orphan orphan &&
56 git remote add origin ../upstream &&
57 git remote add collab1 ../collab1 &&
58 git remote update &&
59 git update-ref refs/heads/master refs/remotes/origin/master &&
60 git rev-parse --verify --quiet refs/heads/master -- >/dev/null &&
61 tg remote --populate collab1 &&
62 git checkout -f stage &&
63 test_when_finished test_set_prereq SETUP
66 test_expect_success SETUP 'collab1 remove t/feature1 dependency' '
67 cd collab1 &&
68 topbases="$(tg --top-bases)" &&
69 test -n "$topbases" &&
70 pfile="$(test_get_temp patch)" &&
71 git checkout -f "$topbases/stage" &&
72 git diff-tree --patch refs/heads/t/feature2 "$topbases/t/feature2" -- :/ :!/.topdeps :!/.topmsg >"$pfile" &&
73 git apply <"$pfile" &&
74 test_tick &&
75 git commit -am "revert t/feature2 from stage base" &&
76 git update-ref "$topbases/stage" HEAD &&
77 git checkout -f stage &&
78 test_tick &&
79 tg update --no-stash &&
80 test_tick &&
81 echo "t/feature1" >.topdeps &&
82 git commit -am "remove t/feature2 from .topdeps" &&
83 test_when_finished test_tick=$test_tick
86 test_expect_success SETUP 'upstream add change' '
87 cd upstream &&
88 echo "master upstream with update" >master.txt &&
89 test_tick &&
90 git commit -am "update master" &&
91 test_when_finished test_tick=$test_tick
94 test_expect_success SETUP 'collab1 fetch updates' '
95 cd collab1 &&
96 git remote update &&
97 git update-ref refs/heads/master refs/remotes/origin/master &&
98 git rev-parse --verify --quiet refs/heads/master -- >/dev/null &&
99 git checkout -f t/feature1 &&
100 test_tick &&
101 tg update --no-stash &&
102 git checkout -f stage &&
103 test_tick &&
104 tg update --no-stash &&
105 test_tick &&
106 git commit --amend --reset-author --no-edit &&
107 test_when_finished test_tick=$test_tick
110 test_expect_success SETUP 'collab2 fetch updates' '
111 cd collab2 &&
112 git remote update &&
113 git update-ref refs/heads/master refs/remotes/origin/master &&
114 git rev-parse --verify --quiet refs/heads/master -- >/dev/null
117 test_expect_success LASTOK 'collab2 update stage' '
118 cd collab2 &&
119 git checkout -f stage &&
120 test_tick &&
121 tg update --no-stash
124 test_done