From: Jeff King <peff@peff.net>
To: jyotish kumar <jyotishkumar725015@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [Discussion] t1006: testing %(rest) with object names containing whitespace
Date: Sun, 25 Oct 2026 21:32:54 -0400 [thread overview]
Message-ID: <20261026013254.GB3575069@coredump.intra.peff.net> (raw)
In-Reply-To: <CAGjZMyRqv5RsLF4Vo439zy4urfr+R=CTwuDzmYjiemauuZan0Q@mail.gmail.com>
On Sat, Oct 24, 2026 at 12:17:53PM +0530, jyotish kumar wrote:
> While exploring t/t1006-cat-file.sh, I came across the test for the
> %(rest) format atom in git cat-file --batch-check.
>
> The test currently contains a FIXME explaining that %(rest) is
> incompatible with object names containing whitespace, such as
> HEAD:path/to/a/file with spaces. It uses test_expect_failure for that
> case and mentions using the resolved object ID as input instead of the
> original object name.
>
> I investigated this test and noticed that the run_tests() helper
> already has access to the resolved object ID through $oid. I tried
> using $oid as the input to the %(rest) test rather than $object_name.
>
> With this change, the focused t1006-cat-file.sh test passed all 423
> tests locally.
>
> Before preparing a patch, I wanted to ask whether this is the intended
> approach for testing %(rest) here, and whether removing the
> conditional expected-failure logic and using the resolved object ID
> would be a worthwhile improvement.
There's a similar discussion here:
https://lore.kernel.org/git/20260219152407.12160-1-deveshigurgaon@gmail.com/
I didn't participate there, but I was the person who implemented this
crappy %(rest) behavior in the first place. ;)
I think what Junio noted at the end of the thread is important. The
limitation of %(rest) is documented and how it's "supposed" to work. And
the reason that is the case is because %(rest) was added much later than
--batch-check, and was stuck with the existing semantics.
So IMHO everything is working as designed, and there is nothing to fix
in the code. But using test_expect_failure seems weird to me. It avoids
the test suite announcing a failure, but it is not really a breakage to
be fixed. A test with %(rest) and an object name with space should
probably just be skipped. We _could_ run just those cases with the
resolved id, but the point of that test is checking how %(rest) works
with the name, so I don't know that it would be testing anything useful.
-Peff
next prev parent reply other threads:[~2026-10-26 1:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 6:47 [Discussion] t1006: testing %(rest) with object names containing whitespace jyotish kumar
2026-10-26 1:32 ` Jeff King [this message]
2026-10-26 3:41 ` Junio C Hamano
2026-10-26 4:56 ` jyotish kumar
2026-10-26 6:13 ` [PATCH] t1006: skip %(rest) test for whitespace in object names jyotishkumar725015
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=20261026013254.GB3575069@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jyotishkumar725015@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