t7419, t7420: use test_cmp_config instead of grepping .gitmodules
We have a test function to verify config files. Use it as it's more precise. Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b027fb0784
commit
5fc880632d
@ -44,14 +44,14 @@ test_expect_success 'submodule config cache setup' '
|
|||||||
|
|
||||||
test_expect_success 'ensure submodule branch is unset' '
|
test_expect_success 'ensure submodule branch is unset' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
! grep branch .gitmodules
|
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'test submodule set-branch --branch' '
|
test_expect_success 'test submodule set-branch --branch' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch --branch topic submodule &&
|
git submodule set-branch --branch topic submodule &&
|
||||||
grep "branch = topic" .gitmodules &&
|
test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
b
|
b
|
||||||
@ -64,7 +64,7 @@ test_expect_success 'test submodule set-branch --branch' '
|
|||||||
test_expect_success 'test submodule set-branch --default' '
|
test_expect_success 'test submodule set-branch --default' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch --default submodule &&
|
git submodule set-branch --default submodule &&
|
||||||
! grep branch .gitmodules &&
|
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
a
|
a
|
||||||
@ -77,7 +77,7 @@ test_expect_success 'test submodule set-branch --default' '
|
|||||||
test_expect_success 'test submodule set-branch -b' '
|
test_expect_success 'test submodule set-branch -b' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch -b topic submodule &&
|
git submodule set-branch -b topic submodule &&
|
||||||
grep "branch = topic" .gitmodules &&
|
test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
b
|
b
|
||||||
@ -90,7 +90,7 @@ test_expect_success 'test submodule set-branch -b' '
|
|||||||
test_expect_success 'test submodule set-branch -d' '
|
test_expect_success 'test submodule set-branch -d' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch -d submodule &&
|
git submodule set-branch -d submodule &&
|
||||||
! grep branch .gitmodules &&
|
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
a
|
a
|
||||||
|
@ -49,7 +49,7 @@ test_expect_success 'test submodule set-url' '
|
|||||||
cd super &&
|
cd super &&
|
||||||
test_must_fail git submodule update --remote &&
|
test_must_fail git submodule update --remote &&
|
||||||
git submodule set-url submodule ../newsubmodule &&
|
git submodule set-url submodule ../newsubmodule &&
|
||||||
grep -F "url = ../newsubmodule" .gitmodules &&
|
test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
|
||||||
git submodule update --remote
|
git submodule update --remote
|
||||||
) &&
|
) &&
|
||||||
git -C super/submodule show >actual &&
|
git -C super/submodule show >actual &&
|
||||||
|
Reference in New Issue
Block a user