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.
19 test_expect_success
'setup upstream' '
20 test_create_repo 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 &&
30 git checkout --orphan orphan &&
31 git remote add origin ../upstream &&
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 &&
42 git commit -am "feature two" &&
43 tg_test_create_branch stage -m "[STAGE] staging" t/feature1 t/feature2 &&
44 git checkout -f stage &&
46 tg update --no-stash &&
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 &&
55 git checkout --orphan orphan &&
56 git remote add origin ../upstream &&
57 git remote add collab1 ../collab1 &&
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' '
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" &&
75 git commit -am "revert t/feature2 from stage base" &&
76 git update-ref "$topbases/stage" HEAD &&
77 git checkout -f stage &&
79 tg update --no-stash &&
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' '
88 echo "master upstream with update" >master.txt &&
90 git commit -am "update master" &&
91 test_when_finished test_tick=$test_tick
94 test_expect_success SETUP
'collab1 fetch updates' '
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 &&
101 tg update --no-stash &&
102 git checkout -f stage &&
104 tg update --no-stash &&
106 git commit --amend --reset-author --no-edit &&
107 test_when_finished test_tick=$test_tick
110 test_expect_success SETUP
'collab2 fetch updates' '
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' '
119 git checkout -f stage &&