[GSOC][PATCH] t5500: simplify test implementation and fix git exit code suppression
- From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
- Date
- Jan 13, 2026, 17:53 UTC
- Message-ID
- <20260113175913.474414-1-shreyanshpaliwalcmsmn@gmail.com>
- In-Reply-To
- <xmqqbjixljfg.fsf@gitster.g>
The 'shallow since with commit graph and already-seen commit” test previously used a convoluted here-doc that combined manual input construction with packetize, echo and embedded Git commands. This structure hid failures from the git commands, as their exit codes were suppressed inside echo command substitution and pipe upstream, also making the test harder to follow.
The changes simplify and make the test more robust.
* Assign the results of Git commands to variables up front and chain them with &&, so the test detects any failures immediately, avoiding any exit code suppression.
* Use test-tool pkt-line pack to construct the input and then pass it to git-upload in a temp file, instead of relying on here-doc and manual packetization. This avoids formatting issues and ensures correct v2 protocol guidelines.
Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> --- t/t5500-fetch-pack.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 2677cd5faa..62cf0e1ff7 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -892,15 +892,20 @@ test_expect_success 'shallow since with commit graph and already-seen commit' ' test_commit other && git commit-graph write --reachable && git config core.commitGraph true && - - GIT_PROTOCOL=version=2 git upload-pack . <<-EOF >/dev/null - 0012command=fetch - $(echo "object-format=$(test_oid algo)" | packetize) - 00010013deepen-since 1 - $(echo "want $(git rev-parse other)" | packetize) - $(echo "have $(git rev-parse main)" | packetize) + oid_algo=$(test_oid algo) && + oid_other=$(git rev-parse other) && + oid_main=$(git rev-parse main) && + + test-tool pkt-line pack >input <<-EOF && + command=fetch + object-format=$oid_algo + 0001 + deepen-since 1 + want $oid_other + have $oid_main 0000 EOF + GIT_PROTOCOL=version=2 git upload-pack . <input >/dev/null ) '
-- 2.43.0