From: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail•com>
To: gitster@pobox•com
Cc: git@vger•kernel.org, ps@pks•i,
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail•com>
Subject: Re: [RFC PATCH] t5500-fetch-pack.sh: fix suppression of Git exit code in tests
Date: Tue, 13 Jan 2026 15:23:55 +0530 [thread overview]
Message-ID: <20260113100145.436591-1-shreyanshpaliwalcmsmn@gmail.com> (raw)
In-Reply-To: <xmqqpl7fnetj.fsf@gitster.g>
> Patrick Steinhardt <ps@pks•im> writes:
>
> > On Sun, Jan 11, 2026 at 02:50:37PM -0800, Junio C Hamano wrote:
> >> Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail•com> writes:
> >> > GIT_PROTOCOL=version=2 git upload-pack . <<-EOF >/dev/null
> >> > 0012command=fetch
> >> > - $(echo "object-format=$(test_oid algo)" | packetize)
> >> > + $(echo "object-format=$(<oid_algo)" | packetize)
> >>
> >> The construct $(<file) is bashism, that does not work if your shell
> >> is not bash, isn't it? If you used a variable, e.g.,
> >>
> >> $(echo "object-format=$oid_algo" | packetize)
> >>
> >> that would make the result more portable.
> >
> > There's no need for the echo at all as this can also be written as:
> >
> > packetize "object-format=$oid_algo"
>
> Yeah, I failed to realize that this is a(n unnecessarily) convoluted
> use of command substitution inside HERE-DOC. What mushroom were we
> on when we originally wrote this crap, I have to wonder ;-)?
>
> Thanks for spotting it.
I tried using packetize directly inside the here-doc but it was throwing
the error,
fatal: protocol error: bad line length character
this is probably because packetize is creating an extra newline in here-doc
which includes unnecessary extra bytes which is throwing off the v2 protocol,
and this is why I think echo was initially used there convolutedly.
I think a much better approach, is to use test-tool pkt-line pack,
which I believe handles the formatting issues internally,
thus making sure the requirements for the v2 protocol are followed.
Additionally, this solves the git exit code suppressing issue as well.
Below is the revised patch let me know what do you think.
Best,
Shreyansh
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
next prev parent reply other threads:[~2026-01-13 10:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 20:00 [RFC PATCH] t5500-fetch-pack.sh: fix suppression of Git exit code in tests Shreyansh Paliwal
2026-01-11 22:50 ` Junio C Hamano
2026-01-12 8:21 ` Shreyansh Paliwal
2026-01-12 8:25 ` Patrick Steinhardt
2026-01-12 9:11 ` t5500-fetch-pack.sh and exit-code suppression Shreyansh Paliwal
2026-01-12 13:25 ` [RFC PATCH] t5500-fetch-pack.sh: fix suppression of Git exit code in tests Junio C Hamano
2026-01-13 9:53 ` Shreyansh Paliwal [this message]
2026-01-13 13:40 ` Junio C Hamano
2026-01-13 17:53 ` [GSOC][PATCH] t5500: simplify test implementation and fix git exit code suppression Shreyansh Paliwal
2026-01-15 21:28 ` Shreyansh Paliwal
2026-01-20 16:44 ` Junio C Hamano
2026-01-21 12:54 ` [GSOC][PATCH V2] " Shreyansh Paliwal
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=20260113100145.436591-1-shreyanshpaliwalcmsmn@gmail.com \
--to=shreyanshpaliwalcmsmn@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=ps@pks$(echo .)i \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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