Skip to content

Commit 5fc8806

Browse files
heftiggitster
authored andcommitted
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) <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b027fb0 commit 5fc8806

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

t/t7419-submodule-set-branch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ test_expect_success 'submodule config cache setup' '
4444

4545
test_expect_success 'ensure submodule branch is unset' '
4646
(cd super &&
47-
! grep branch .gitmodules
47+
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch
4848
)
4949
'
5050

5151
test_expect_success 'test submodule set-branch --branch' '
5252
(cd super &&
5353
git submodule set-branch --branch topic submodule &&
54-
grep "branch = topic" .gitmodules &&
54+
test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
5555
git submodule update --remote &&
5656
cat <<-\EOF >expect &&
5757
b
@@ -64,7 +64,7 @@ test_expect_success 'test submodule set-branch --branch' '
6464
test_expect_success 'test submodule set-branch --default' '
6565
(cd super &&
6666
git submodule set-branch --default submodule &&
67-
! grep branch .gitmodules &&
67+
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
6868
git submodule update --remote &&
6969
cat <<-\EOF >expect &&
7070
a
@@ -77,7 +77,7 @@ test_expect_success 'test submodule set-branch --default' '
7777
test_expect_success 'test submodule set-branch -b' '
7878
(cd super &&
7979
git submodule set-branch -b topic submodule &&
80-
grep "branch = topic" .gitmodules &&
80+
test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
8181
git submodule update --remote &&
8282
cat <<-\EOF >expect &&
8383
b
@@ -90,7 +90,7 @@ test_expect_success 'test submodule set-branch -b' '
9090
test_expect_success 'test submodule set-branch -d' '
9191
(cd super &&
9292
git submodule set-branch -d submodule &&
93-
! grep branch .gitmodules &&
93+
test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
9494
git submodule update --remote &&
9595
cat <<-\EOF >expect &&
9696
a

t/t7420-submodule-set-url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test_expect_success 'test submodule set-url' '
4949
cd super &&
5050
test_must_fail git submodule update --remote &&
5151
git submodule set-url submodule ../newsubmodule &&
52-
grep -F "url = ../newsubmodule" .gitmodules &&
52+
test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
5353
git submodule update --remote
5454
) &&
5555
git -C super/submodule show >actual &&

0 commit comments

Comments
 (0)