From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
To: git@vger.kernel.org
Cc: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Subject: [PATCH 4/6] t7419, t7420: Use test_cmp_config instead of grepping .gitmodules
Date: Tue, 3 Oct 2023 20:50:45 +0200 [thread overview]
Message-ID: <20231003185047.2697995-4-heftig@archlinux.org> (raw)
In-Reply-To: <20231003185047.2697995-1-heftig@archlinux.org>
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>
---
t/t7419-submodule-set-branch.sh | 10 +++++-----
t/t7420-submodule-set-url.sh | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t7419-submodule-set-branch.sh b/t/t7419-submodule-set-branch.sh
index 5ac16d0eb7..3cd30865a7 100755
--- a/t/t7419-submodule-set-branch.sh
+++ b/t/t7419-submodule-set-branch.sh
@@ -44,53 +44,53 @@ test_expect_success 'submodule config cache setup' '
test_expect_success 'ensure submodule branch is unset' '
(cd super &&
- ! grep branch .gitmodules
+ test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch
)
'
test_expect_success 'test submodule set-branch --branch' '
(cd super &&
git submodule set-branch --branch topic submodule &&
- grep "branch = topic" .gitmodules &&
+ test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
git submodule update --remote &&
cat <<-\EOF >expect &&
b
EOF
git -C submodule show -s --pretty=%s >actual &&
test_cmp expect actual
)
'
test_expect_success 'test submodule set-branch --default' '
(cd super &&
git submodule set-branch --default submodule &&
- ! grep branch .gitmodules &&
+ test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
git submodule update --remote &&
cat <<-\EOF >expect &&
a
EOF
git -C submodule show -s --pretty=%s >actual &&
test_cmp expect actual
)
'
test_expect_success 'test submodule set-branch -b' '
(cd super &&
git submodule set-branch -b topic submodule &&
- grep "branch = topic" .gitmodules &&
+ test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
git submodule update --remote &&
cat <<-\EOF >expect &&
b
EOF
git -C submodule show -s --pretty=%s >actual &&
test_cmp expect actual
)
'
test_expect_success 'test submodule set-branch -d' '
(cd super &&
git submodule set-branch -d submodule &&
- ! grep branch .gitmodules &&
+ test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
git submodule update --remote &&
cat <<-\EOF >expect &&
a
diff --git a/t/t7420-submodule-set-url.sh b/t/t7420-submodule-set-url.sh
index d6bf62b3ac..aa63d806fe 100755
--- a/t/t7420-submodule-set-url.sh
+++ b/t/t7420-submodule-set-url.sh
@@ -49,7 +49,7 @@ test_expect_success 'test submodule set-url' '
cd super &&
test_must_fail git submodule update --remote &&
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 -C super/submodule show >actual &&
--
2.42.0
next prev parent reply other threads:[~2023-10-03 18:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 4:21 git submodule set-url does not sync when name != path Jan Alexander Steffens (heftig)
2023-09-09 22:26 ` Bug: git submodule set-url does not handle name != path correctly Jan Alexander Steffens (heftig)
2023-10-03 18:50 ` [PATCH 1/6] submodule--helper: use submodule_from_path in set-{url,branch} Jan Alexander Steffens (heftig)
2023-10-03 18:50 ` [PATCH 2/6] submodule--helper: return error from set-url when modifying failed Jan Alexander Steffens (heftig)
2023-10-03 23:10 ` Junio C Hamano
2023-10-03 18:50 ` [PATCH 3/6] t7419: Actually test the branch switching Jan Alexander Steffens (heftig)
2023-10-04 0:20 ` Junio C Hamano
2023-10-03 18:50 ` Jan Alexander Steffens (heftig) [this message]
2023-10-03 18:50 ` [PATCH 5/6] t7419: Test that we correctly handle renamed submodules Jan Alexander Steffens (heftig)
2023-10-03 18:50 ` [PATCH 6/6] t7420: " Jan Alexander Steffens (heftig)
2023-10-04 1:10 ` [PATCH 1/6] submodule--helper: use submodule_from_path in set-{url,branch} Junio C Hamano
2023-11-21 20:32 ` [PATCH v2 " Jan Alexander Steffens (heftig)
2023-11-21 20:32 ` [PATCH v2 2/6] submodule--helper: return error from set-url when modifying failed Jan Alexander Steffens (heftig)
2023-11-21 20:32 ` [PATCH v2 3/6] t7419: actually test the branch switching Jan Alexander Steffens (heftig)
2023-11-21 20:32 ` [PATCH v2 4/6] t7419, t7420: use test_cmp_config instead of grepping .gitmodules Jan Alexander Steffens (heftig)
2023-11-21 20:32 ` [PATCH v2 5/6] t7419: test that we correctly handle renamed submodules Jan Alexander Steffens (heftig)
2023-11-21 20:32 ` [PATCH v2 6/6] t7420: " Jan Alexander Steffens (heftig)
2023-11-22 7:54 ` [PATCH v2 1/6] submodule--helper: use submodule_from_path in set-{url,branch} Junio C Hamano
2023-11-22 9:50 ` Jan Alexander Steffens (heftig)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231003185047.2697995-4-heftig@archlinux.org \
--to=heftig@archlinux.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).