From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 37D361F670 for ; Mon, 11 Oct 2021 16:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbhJKQJi (ORCPT ); Mon, 11 Oct 2021 12:09:38 -0400 Received: from cloud.peff.net ([104.130.231.41]:36996 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbhJKQJh (ORCPT ); Mon, 11 Oct 2021 12:09:37 -0400 Received: (qmail 29085 invoked by uid 109); 11 Oct 2021 16:07:36 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 11 Oct 2021 16:07:36 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19429 invoked by uid 111); 11 Oct 2021 16:07:35 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 11 Oct 2021 12:07:35 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 11 Oct 2021 12:07:35 -0400 From: Jeff King To: Junio C Hamano Cc: Bagas Sanjaya , git@vger.kernel.org, =?utf-8?B?UmVuw6k=?= Scharfe Subject: Re: [PATCH] archive: add test testing MIME for created archive through compression filter Message-ID: References: <20211011112712.475306-1-bagasdotme@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Oct 11, 2021 at 08:53:11AM -0700, Junio C Hamano wrote: > Bagas Sanjaya 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