{"thread":{"id":"65206","subject":"[PATCH] t3200: replace hardcoded null OID with $ZERO_OID","startedAt":"2026-03-11T10:58:45Z","lastAt":"2026-03-12T06:07:33Z","messageCount":5,"participants":["Siddharth Shrimali","Patrick Steinhardt","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"538580","messageId":"20260311105829.60508-1-r.siddharth.shrimali@gmail.com","threadId":"65206","inReplyTo":null,"subject":"[PATCH] t3200: replace hardcoded null OID with $ZERO_OID","fromName":"Siddharth Shrimali","fromEmail":"r.siddharth.shrimali@gmail.com","sentAt":"2026-03-11T10:58:10Z","receivedAt":"2026-03-11T10:58:45Z","isPatch":true,"sender":{"key":"r.siddharth.shrimali@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183274193?v=4"},"body":"Taking into consideration the SHA-256 transition, the test suite must\nbe updated to support the length of the underlying hash algorithm.\nTests that rely on hardcoded 40-character strings to represent the\nnull object ID will fail when run in a SHA-256 environment, which\nexpects a 64-character hash.\n\nReplace the hardcoded 40-zero string in the 'git branch --merged' test\nwith the '$ZERO_OID' variable which is provided by the test framework.\nThis ensures the test dynamically adapts to the correct null OID\nlength and functions correctly regardless of the active hash\nalgorithm.\n\nSigned-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>\n---\n t/t3200-branch.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex c58e505c43..ed317a75f5 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -1494,7 +1494,7 @@ test_expect_success 'refuse --edit-description on unborn branch for now' '\n '\n \n test_expect_success '--merged catches invalid object names' '\n-\ttest_must_fail git branch --merged 0000000000000000000000000000000000000000\n+\ttest_must_fail git branch --merged $ZERO_OID\n '\n \n test_expect_success '--list during rebase' '\n-- \n2.51.2\n\n"},{"id":"538585","messageId":"abFP9vZOVHGI536G@pks.im","threadId":"65206","inReplyTo":"20260311105829.60508-1-r.siddharth.shrimali@gmail.com","subject":"Re: [PATCH] t3200: replace hardcoded null OID with $ZERO_OID","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-11T11:20:22Z","receivedAt":"2026-03-11T11:20:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Mar 11, 2026 at 04:28:10PM +0530, Siddharth Shrimali wrote:\n> Taking into consideration the SHA-256 transition, the test suite must\n> be updated to support the length of the underlying hash algorithm.\n> Tests that rely on hardcoded 40-character strings to represent the\n> null object ID will fail when run in a SHA-256 environment, which\n> expects a 64-character hash.\n> \n> Replace the hardcoded 40-zero string in the 'git branch --merged' test\n> with the '$ZERO_OID' variable which is provided by the test framework.\n> This ensures the test dynamically adapts to the correct null OID\n> length and functions correctly regardless of the active hash\n> algorithm.\n> \n> Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>\n> ---\n>  t/t3200-branch.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n> index c58e505c43..ed317a75f5 100755\n> --- a/t/t3200-branch.sh\n> +++ b/t/t3200-branch.sh\n> @@ -1494,7 +1494,7 @@ test_expect_success 'refuse --edit-description on unborn branch for now' '\n>  '\n>  \n>  test_expect_success '--merged catches invalid object names' '\n> -\ttest_must_fail git branch --merged 0000000000000000000000000000000000000000\n> +\ttest_must_fail git branch --merged $ZERO_OID\n>  '\n\nI expect that the failure reason before and after this change is\ndifferent, right? And likewise, I expect that before the change, the\nfailure with SHA1 is likely different than the one with SHA256.\n\nTaking a peek, that's indeed the case. With SHA1 we get:\n\n    error: option `merged' must point to a commit\n\nBut with SHA256 we get:\n\n    fatal: malformed object name 0000000000000000000000000000000000000000\n\nSo the only reason why we didn't detect that the test is broken with\nSHA256 is that we didn't verify the error message. Do we maybe want to\nmake the test a bit less fragile by using something like `test_grep\n\"must point to a commit\"` on the error message?\n\nPatrick\n"},{"id":"538637","messageId":"20260311174120.76871-1-r.siddharth.shrimali@gmail.com","threadId":"65206","inReplyTo":"abFP9vZOVHGI536G@pks.im","subject":"[PATCH v2] t3200: replace hardcoded null OID with $ZERO_OID","fromName":"Siddharth Shrimali","fromEmail":"r.siddharth.shrimali@gmail.com","sentAt":"2026-03-11T17:41:20Z","receivedAt":"2026-03-11T17:41:30Z","isPatch":true,"sender":{"key":"r.siddharth.shrimali@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183274193?v=4"},"body":"To support the SHA-256 transition, replace the hardcoded 40-zero string\nin 'git branch --merged' with '$ZERO_OID'. The current 40-character\nstring causes the test to fail prematurely in SHA-256 environments\nbecause Git identifies a \"malformed object name\" (due to the 40 vs 64\ncharacter mismatch) before it even validates the object type.\n\nBy using '$ZERO_OID', we ensure the hash length is always correct for\nthe active algorithm. Additionally, use 'test_grep' to verify the\n\"must point to a commit\" error message, ensuring the test validates\nthe object type logic rather than just string syntax.\n\nSuggested-by: Patrick Steinhardt <ps@pks.im>\nSigned-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>\n---\nChanges in V2:\n- Updated the test to capture stderr and use 'test_grep' to verify the \n  error message. This ensures the failure is due to the object type \n  check (\"must point to a commit\") rather than a hash length mismatch.\n- Improved the commit message to add detail to the 40 vs 64 character\n  mismatch and the \"premature failure\" in SHA-256.\n\n t/t3200-branch.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex c58e505c43..e7829c2c4b 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -1494,7 +1494,8 @@ test_expect_success 'refuse --edit-description on unborn branch for now' '\n '\n \n test_expect_success '--merged catches invalid object names' '\n-\ttest_must_fail git branch --merged 0000000000000000000000000000000000000000\n+\ttest_must_fail git branch --merged $ZERO_OID 2>err &&\n+\ttest_grep \"must point to a commit\" err\n '\n \n test_expect_success '--list during rebase' '\n-- \n2.51.2\n\n"},{"id":"538681","messageId":"abHb5k4otqTSgPb8@fruit.crustytoothpaste.net","threadId":"65206","inReplyTo":"20260311174120.76871-1-r.siddharth.shrimali@gmail.com","subject":"Re: [PATCH v2] t3200: replace hardcoded null OID with $ZERO_OID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-03-11T21:17:26Z","receivedAt":"2026-03-11T21:17:28Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2026-03-11 at 17:41:20, Siddharth Shrimali wrote:\n> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n> index c58e505c43..e7829c2c4b 100755\n> --- a/t/t3200-branch.sh\n> +++ b/t/t3200-branch.sh\n> @@ -1494,7 +1494,8 @@ test_expect_success 'refuse --edit-description on unborn branch for now' '\n>  '\n>  \n>  test_expect_success '--merged catches invalid object names' '\n> -\ttest_must_fail git branch --merged 0000000000000000000000000000000000000000\n> +\ttest_must_fail git branch --merged $ZERO_OID 2>err &&\n> +\ttest_grep \"must point to a commit\" err\n>  '\n\nYeah, this seems reasonable.  It's failing, but for the wrong reasons,\nso checking the error message in addition to switching to `$ZERO_OID`\nseems like the right thing to do.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"538717","messageId":"abJYHmKiXqiXjHhN@pks.im","threadId":"65206","inReplyTo":"20260311174120.76871-1-r.siddharth.shrimali@gmail.com","subject":"Re: [PATCH v2] t3200: replace hardcoded null OID with $ZERO_OID","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-12T06:07:26Z","receivedAt":"2026-03-12T06:07:33Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Mar 11, 2026 at 11:11:20PM +0530, Siddharth Shrimali wrote:\n> To support the SHA-256 transition, replace the hardcoded 40-zero string\n> in 'git branch --merged' with '$ZERO_OID'. The current 40-character\n> string causes the test to fail prematurely in SHA-256 environments\n> because Git identifies a \"malformed object name\" (due to the 40 vs 64\n> character mismatch) before it even validates the object type.\n> \n> By using '$ZERO_OID', we ensure the hash length is always correct for\n> the active algorithm. Additionally, use 'test_grep' to verify the\n> \"must point to a commit\" error message, ensuring the test validates\n> the object type logic rather than just string syntax.\n> \n> Suggested-by: Patrick Steinhardt <ps@pks.im>\n\n\"Suggested-by\" is a bit strong, as it indicates that I have suggested\nto work on this in the first place. \"Helped-by\" would have been a bit of\na better fit.\n\nNo reason to reroll though, this patch looks good to me. Thanks!\n\nPatrick\n"}]}