Skip to content

Commit d417c24

Browse files
hashplinggitster
authored andcommitted
contrib/subtree: fix broken &&-chains and revealed test error
This fixes two instances where a &&-chain was broken in the subtree tests and fixes a test error that was revealed because of this. Many tests in t7900-subtree.sh make a commit and then use 'undo' to reset the state for the next test. In the 'check hash of split' test, an 'undo' was being invoked after a 'subtree split' even though the particular invocation of 'subtree split' did not actually make a commit. The subsequent check_equal was failing, but this failure was masked by that broken &&-chain. Removing this undo causes the failing check_equal to succeed but breaks the a check_equal later on in the same test. It turns out that an earlier test ('check if --message for merge works with squash too') makes a commit but doesn't 'undo' to the state expected by the remaining tests. None of the intervening tests cared enough about the state of the test repo to fail and the spurious 'undo' in 'check hash of split' restored the expected state for any remaining test that might care. Adding the missing 'undo' to 'check if --message for merge works with squash too' and removing the spurious one from 'check hash of split' fixes all tests once the &&-chains are completed. Signed-off-by: Charles Bailey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4120882 commit d417c24

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/subtree/t/t7900-subtree.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ test_expect_success 'check if --message for merge works with squash too' '
177177
test_expect_success 'merge new subproj history into subdir' '
178178
git subtree merge --prefix=subdir FETCH_HEAD &&
179179
git branch pre-split &&
180-
check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git rev-parse sub2)"'"'"' into mainline"
180+
check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git rev-parse sub2)"'"'"' into mainline" &&
181+
undo
181182
'
182183

183184
test_expect_success 'Check that prefix argument is required for split' '
@@ -218,9 +219,8 @@ test_expect_success 'check split with --branch' '
218219

219220
test_expect_success 'check hash of split' '
220221
spl1=$(git subtree split --prefix subdir) &&
221-
undo &&
222222
git subtree split --prefix subdir --branch splitbr1test &&
223-
check_equal ''"$(git rev-parse splitbr1test)"'' "$spl1"
223+
check_equal ''"$(git rev-parse splitbr1test)"'' "$spl1" &&
224224
git checkout splitbr1test &&
225225
new_hash=$(git rev-parse HEAD~2) &&
226226
git checkout mainline &&
@@ -269,7 +269,7 @@ test_expect_success 'add sub9' '
269269
cd ..
270270

271271
test_expect_success 'split for sub8' '
272-
split2=''"$(git subtree split --annotate='"'*'"' --prefix subdir/ --rejoin)"''
272+
split2=''"$(git subtree split --annotate='"'*'"' --prefix subdir/ --rejoin)"'' &&
273273
git branch split2 "$split2"
274274
'
275275

0 commit comments

Comments
 (0)