Merge branch 'jn/subtree-test-fixes'
Test fix. * jn/subtree-test-fixes: subtree test: simplify preparation of expected results subtree test: add missing && to &&-chain
This commit is contained in:
commit
ab539208b2
@ -540,26 +540,10 @@ test_expect_success 'make sure exactly the right set of files ends up in the sub
|
|||||||
git fetch .. subproj-br &&
|
git fetch .. subproj-br &&
|
||||||
git merge FETCH_HEAD &&
|
git merge FETCH_HEAD &&
|
||||||
|
|
||||||
chks="sub1
|
test_write_lines main-sub1 main-sub2 main-sub3 main-sub4 \
|
||||||
sub2
|
sub1 sub2 sub3 sub4 >expect &&
|
||||||
sub3
|
git ls-files >actual &&
|
||||||
sub4" &&
|
test_cmp expect actual
|
||||||
chks_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chks
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
chkms="main-sub1
|
|
||||||
main-sub2
|
|
||||||
main-sub3
|
|
||||||
main-sub4" &&
|
|
||||||
chkms_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chkms
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
|
|
||||||
subfiles=$(git ls-files) &&
|
|
||||||
check_equal "$subfiles" "$chkms
|
|
||||||
$chks"
|
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -606,25 +590,11 @@ test_expect_success 'make sure the subproj *only* contains commits that affect t
|
|||||||
git fetch .. subproj-br &&
|
git fetch .. subproj-br &&
|
||||||
git merge FETCH_HEAD &&
|
git merge FETCH_HEAD &&
|
||||||
|
|
||||||
chks="sub1
|
test_write_lines main-sub1 main-sub2 main-sub3 main-sub4 \
|
||||||
sub2
|
sub1 sub2 sub3 sub4 >expect &&
|
||||||
sub3
|
git log --name-only --pretty=format:"" >log &&
|
||||||
sub4" &&
|
sort <log | sed "/^\$/ d" >actual &&
|
||||||
chks_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
test_cmp expect actual
|
||||||
$chks
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
chkms="main-sub1
|
|
||||||
main-sub2
|
|
||||||
main-sub3
|
|
||||||
main-sub4" &&
|
|
||||||
chkms_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chkms
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
allchanges=$(git log --name-only --pretty=format:"" | sort | sed "/^$/d") &&
|
|
||||||
check_equal "$allchanges" "$chkms
|
|
||||||
$chks"
|
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -675,28 +645,15 @@ test_expect_success 'make sure exactly the right set of files ends up in the mai
|
|||||||
cd "$subtree_test_count" &&
|
cd "$subtree_test_count" &&
|
||||||
git subtree pull --prefix="sub dir" ./"sub proj" master &&
|
git subtree pull --prefix="sub dir" ./"sub proj" master &&
|
||||||
|
|
||||||
chkm="main1
|
test_write_lines main1 main2 >chkm &&
|
||||||
main2" &&
|
test_write_lines main-sub1 main-sub2 main-sub3 main-sub4 >chkms &&
|
||||||
chks="sub1
|
sed "s,^,sub dir/," chkms >chkms_sub &&
|
||||||
sub2
|
test_write_lines sub1 sub2 sub3 sub4 >chks &&
|
||||||
sub3
|
sed "s,^,sub dir/," chks >chks_sub &&
|
||||||
sub4" &&
|
|
||||||
chks_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
cat chkm chkms_sub chks_sub >expect &&
|
||||||
$chks
|
git ls-files >actual &&
|
||||||
TXT
|
test_cmp expect actual
|
||||||
) &&
|
|
||||||
chkms="main-sub1
|
|
||||||
main-sub2
|
|
||||||
main-sub3
|
|
||||||
main-sub4" &&
|
|
||||||
chkms_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chkms
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
mainfiles=$(git ls-files) &&
|
|
||||||
check_equal "$mainfiles" "$chkm
|
|
||||||
$chkms_sub
|
|
||||||
$chks_sub"
|
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -708,7 +665,7 @@ test_expect_success 'make sure each filename changed exactly once in the entire
|
|||||||
test_create_commit "$subtree_test_count/sub proj" sub1 &&
|
test_create_commit "$subtree_test_count/sub proj" sub1 &&
|
||||||
(
|
(
|
||||||
cd "$subtree_test_count" &&
|
cd "$subtree_test_count" &&
|
||||||
git config log.date relative
|
git config log.date relative &&
|
||||||
git fetch ./"sub proj" master &&
|
git fetch ./"sub proj" master &&
|
||||||
git subtree add --prefix="sub dir" FETCH_HEAD
|
git subtree add --prefix="sub dir" FETCH_HEAD
|
||||||
) &&
|
) &&
|
||||||
@ -748,37 +705,21 @@ test_expect_success 'make sure each filename changed exactly once in the entire
|
|||||||
cd "$subtree_test_count" &&
|
cd "$subtree_test_count" &&
|
||||||
git subtree pull --prefix="sub dir" ./"sub proj" master &&
|
git subtree pull --prefix="sub dir" ./"sub proj" master &&
|
||||||
|
|
||||||
chkm="main1
|
test_write_lines main1 main2 >chkm &&
|
||||||
main2" &&
|
test_write_lines sub1 sub2 sub3 sub4 >chks &&
|
||||||
chks="sub1
|
test_write_lines main-sub1 main-sub2 main-sub3 main-sub4 >chkms &&
|
||||||
sub2
|
sed "s,^,sub dir/," chkms >chkms_sub &&
|
||||||
sub3
|
|
||||||
sub4" &&
|
|
||||||
chks_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chks
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
chkms="main-sub1
|
|
||||||
main-sub2
|
|
||||||
main-sub3
|
|
||||||
main-sub4" &&
|
|
||||||
chkms_sub=$(cat <<TXT | sed '\''s,^,sub dir/,'\''
|
|
||||||
$chkms
|
|
||||||
TXT
|
|
||||||
) &&
|
|
||||||
|
|
||||||
# main-sub?? and /"sub dir"/main-sub?? both change, because those are the
|
# main-sub?? and /"sub dir"/main-sub?? both change, because those are the
|
||||||
# changes that were split into their own history. And "sub dir"/sub?? never
|
# changes that were split into their own history. And "sub dir"/sub?? never
|
||||||
# change, since they were *only* changed in the subtree branch.
|
# change, since they were *only* changed in the subtree branch.
|
||||||
allchanges=$(git log --name-only --pretty=format:"" | sort | sed "/^$/d") &&
|
git log --name-only --pretty=format:"" >log &&
|
||||||
expected=''"$(cat <<TXT | sort
|
sort <log >sorted-log &&
|
||||||
$chkms
|
sed "/^$/ d" sorted-log >actual &&
|
||||||
$chkm
|
|
||||||
$chks
|
cat chkms chkm chks chkms_sub >expect-unsorted &&
|
||||||
$chkms_sub
|
sort expect-unsorted >expect &&
|
||||||
TXT
|
test_cmp expect actual
|
||||||
)"'' &&
|
|
||||||
check_equal "$allchanges" "$expected"
|
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user