From: Srujith A Poojary via GitGitGadget Date: Mon, 02 Nov 2026 19:40:30 GMT Subject: [PATCH v4 2/2] t4041: test SHA-256 submodule abbreviations Message-ID: <99a1234544840e63e6f3dcf3c6beae3ba02af84b.1793648430.git.gitgitgadget@gmail.com> In-Reply-To: From: Srujith A Poojary 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 --- t/t4041-diff-submodule-option.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 ' -- gitgitgadget