From: Junio C Hamano <gitster@pobox.com>
To: "Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Okhuomon Ajayi <okhuomonajayi54@gmail.com>,
Srujith A Poojary <poojarysrujith@gmail.com>
Subject: Re: [PATCH v4 2/2] t4041: test SHA-256 submodule abbreviations
Date: Tue, 03 Nov 2026 09:31:05 -0800 [thread overview]
Message-ID: <xmqq7bitakkm.fsf@gitster.g> (raw)
In-Reply-To: <99a1234544840e63e6f3dcf3c6beae3ba02af84b.1793648430.git.gitgitgadget@gmail.com> (Srujith A. Poojary via GitGitGadget's message of "Mon, 02 Nov 2026 19:40:30 +0000")
"Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> From: Srujith A Poojary <poojarysrujith@gmail.com>
>
> The expected abbreviation for a submodule commit depends on the
> repository's hash algorithm. Use test_oid_cache to provide the
> expected value for each algorithm and remove the SHA1 prerequisite
> so this test runs with both SHA-1 and SHA-256.
>
> Signed-off-by: Srujith A Poojary <poojarysrujith@gmail.com>
> ---
> t/t4041-diff-submodule-option.sh | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
It is strange to test SHA-1 in 1/2 and add test for SHA-256 as if an
afterthought in 2/2. Shouldn't all of these come in a single patch?
The change to add the second hash algorithm support is surprisingly
clean, primarily thanks to how test_oid* support was done long ago.
> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
> index e80472af32..4539d6bba5 100755
> --- a/t/t4041-diff-submodule-option.sh
> +++ b/t/t4041-diff-submodule-option.sh
> @@ -14,7 +14,11 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
>
> . ./test-lib.sh
>
> -test_expect_success SHA1 'submodule commit abbreviation uses submodule object database' '
> +test_expect_success 'submodule commit abbreviation uses submodule object database' '
> + test_oid_cache <<-EOF &&
> + submodule_commit1_abbrev sha1:0000000000e
> + submodule_commit1_abbrev sha256:24c81a5
> + EOF
> test_when_finished "rm -rf collision-super" &&
> git init -q collision-super &&
> git init -q collision-super/sm1 &&
> @@ -27,7 +31,8 @@ test_expect_success SHA1 'submodule commit abbreviation uses submodule object da
> git -C collision-super update-index --add --cacheinfo 160000,"$commit1",sm1 &&
> git -C collision-super commit -q -m "Add submodule" &&
> git -C collision-super diff --submodule=log >actual &&
> - printf "Submodule sm1 0000000000e..%s:\n > child\n" \
> + printf "Submodule sm1 %s..%s:\n > child\n" \
> + "$(test_oid submodule_commit1_abbrev)" \
> "$(git -C collision-super/sm1 rev-parse --short "$commit2")" >expected &&
> test_cmp expected actual
> '
next prev parent reply other threads:[~2026-11-03 17:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 8:25 [PATCH] [Outreachy PATCH] t4041: use submodule repository for commit abbreviations Srujith A Poojary via GitGitGadget
2026-10-31 16:46 ` Okhuomon Ajayi
2026-10-31 19:08 ` Srujith Poojary
2026-10-31 18:57 ` [PATCH v2] Submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-10-31 19:09 ` Okhuomon Ajayi
2026-10-31 19:37 ` Srujith Poojary
2026-10-31 19:24 ` [PATCH v3] submodule: " Srujith A Poojary via GitGitGadget
2026-11-01 21:45 ` Junio C Hamano
2026-11-02 19:40 ` [PATCH v4 0/2] [Outreachy PATCH] t4041: use submodule repository for commit abbreviations Srujith A Poojary via GitGitGadget
2026-11-02 19:40 ` [PATCH v4 1/2] submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-11-02 19:49 ` Srujith Poojary
2026-11-02 19:40 ` [PATCH v4 2/2] t4041: test SHA-256 submodule abbreviations Srujith A Poojary via GitGitGadget
2026-11-03 17:31 ` Junio C Hamano [this message]
2026-11-04 3:58 ` Srujith Poojary
2026-11-03 17:27 ` [PATCH v4 0/2] [Outreachy PATCH] t4041: use submodule repository for commit abbreviations Junio C Hamano
2026-11-04 3:43 ` [PATCH v5] submodule: use the submodule repository to abbreviate commits Srujith A Poojary via GitGitGadget
2026-11-04 14:38 ` Junio C Hamano
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=xmqq7bitakkm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=okhuomonajayi54@gmail.com \
--cc=poojarysrujith@gmail.com \
/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