From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Bagas Sanjaya" <bagasdotme@gmail.com>,
git@vger.kernel.org, "René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH] archive: add test testing MIME for created archive through compression filter
Date: Mon, 11 Oct 2021 12:07:35 -0400 [thread overview]
Message-ID: <YWRhR9IXZfU93Uok@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqlf2zd0d4.fsf@gitster.g>
On Mon, Oct 11, 2021 at 08:53:11AM -0700, Junio C Hamano wrote:
> Bagas Sanjaya <bagasdotme@gmail.com> writes:
>
> > +test_expect_success GZIP,BZIP2,XZ 'git archive with gzip, bzip2, and xz filters creates compressed tar archive with proper MIME type' '
> > + git config tar.tar.bz2.command "bzip2 -c" &&
> > + git config tar.tar.xz.command "xz -c" &&
> > + git archive --output HEAD.tar.gz --prefix=src/ HEAD &&
>
> I think a lot more portable and robust way to test the feature is to
> configure git config tar.tar.test.command (or come up with a name for
> a suffix to be used in the test), point it at a script created in this
> test script and run git archive with output filename that would trigger
> the command. Then, arrange the test to notice if the "test" script was
> called with expected command line arguments and standard input.
>
> That way, you do not need to rely on prereqs and you do not have to
> resort to un-portable use of the "file" command. After all, you are
> *not* testing if "bzip2 -c" the user happens to have on their $PATH
> produces output their "find" recognises as bzip2 compressed.
That would work. Or perhaps using something portable like "tr" to
do a nonsense conversion, and verifying that we can get convert back to
the original. Like say, the tests added to t5000 by 767cf4579f (archive:
implement configurable tar filters, 2011-06-21).
I don't think the newly proposed test is adding anything beyond that
(except checking the system "bzip2" command, but as you say, that is not
useful to us, nor portable).
-Peff
next prev parent reply other threads:[~2021-10-11 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 11:27 [PATCH] archive: add test testing MIME for created archive through compression filter Bagas Sanjaya
2021-10-11 15:48 ` Junio C Hamano
2021-10-11 15:53 ` Junio C Hamano
2021-10-11 16:07 ` Jeff King [this message]
2021-10-12 3:14 ` Bagas Sanjaya
2021-10-12 19:15 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YWRhR9IXZfU93Uok@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=bagasdotme@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).