3 test_description
='test update --base zeroing out patches
5 After using tg update --base on a [BASE] branch to cause
6 it to "accumulate" all of the updates and then merging it
7 throughout the rest of the branches, they should all
8 end up reporting a "0" in the `tg summary` output AND
9 none of the should disappear.
19 tab
=" " # single tab in there
23 test_expect_success
'setup upstream' '
24 test_create_repo upstream &&
26 test_commit "README file" README &&
27 test_commit "add tiny.h" tiny.h "/* tiny h file */" &&
28 test_commit "add tiny.c" tiny.c "/* tiny c file */" "U1.0" &&
29 test_when_finished test_tick="$test_tick"
32 test_expect_success LASTOK
'setup tgtest' '
33 test_create_repo tgtest &&
35 tg_test_setup_topgit &&
36 git remote add origin ../upstream &&
38 git checkout -b frabjous "U1.0"
41 test_expect_success LASTOK
'create [BASE] and two [PATCH] tg branches' '
43 tg_test_create_branch thebase -m "[BASE] the base" :HEAD &&
44 git checkout -f thebase &&
45 tg_test_create_branch t/feat1 thebase &&
46 git checkout -f t/feat1 &&
48 echo "/* changes */" >>tiny.c &&
49 git commit -am "modify" &&
50 tg_test_create_branch t/feat2 thebase &&
51 git checkout -f t/feat2 &&
53 echo "/* changes */" >>tiny.h &&
54 git commit -am "modify" &&
55 test_when_finished test_tick="$test_tick"
58 test_expect_success LASTOK
'create [STAGE] with both patches and tag' '
60 tg_test_create_branch stage -m "[STAGE] combined patches" t/feat1 t/feat2 &&
61 git checkout -f stage &&
65 git commit --amend --reset-author --no-edit &&
67 git tag -a -m "tag S1.0" S1.0 &&
68 git update-ref --no-deref HEAD HEAD HEAD &&
69 test_when_finished test_tick="$test_tick"
73 0 stage [STAGE] combined patches
74 t/feat1 [PATCH] branch t/feat1
75 t/feat2 [PATCH] branch t/feat2
76 0 thebase [BASE] the base
77 " > initial_summary.raw ||
78 die failed to
make initial_summary.raw
79 < initial_summary.raw squish
> initial_summary ||
80 die failed to
make initial_summary
82 test_expect_success LASTOK
'summary has two non-zero patches' '
83 tg -C tgtest summary > actual.raw &&
84 squish < actual.raw > actual &&
85 test_cmp actual initial_summary
88 test_expect_success LASTOK
'update thebase to tag' '
91 tg update --base --no-edit thebase S1.0 &&
92 git checkout -f thebase &&
94 git commit --amend --reset-author --no-edit &&
95 test_when_finished test_tick="$test_tick"
98 test_expect_success LASTOK
'update all dependents' '
100 git checkout -f t/feat1 &&
104 git commit --amend --reset-author --no-edit &&
105 git checkout -f t/feat2 &&
109 git commit --amend --reset-author --no-edit &&
110 git checkout -f stage &&
114 git commit --amend --reset-author --no-edit &&
115 git update-ref --no-deref HEAD HEAD HEAD &&
116 test_when_finished test_tick="$test_tick"
120 0 stage [STAGE] combined patches
121 0 t/feat1 [PATCH] branch t/feat1
122 0 t/feat2 [PATCH] branch t/feat2
123 0 thebase [BASE] the base
124 " > zero_summary.raw ||
125 die failed to
make zero_summary.raw
126 < zero_summary.raw squish
> zero_summary ||
127 die failed to
make zero_summary
129 test_expect_success LASTOK
'summary has four zero patches' '
130 tg -C tgtest summary > actual.raw &&
131 squish < actual.raw > actual &&
132 test_cmp actual zero_summary