From: Junio C Hamano Date: Tue, 14 Jun 2011 20:30:47 GMT Subject: Re: [PATCH 2/2] archive: support gzipped tar files Message-ID: <7vaadkkvew.fsf@alter.siamese.dyndns.org> In-Reply-To: <20110614181821.GA32685@sigill.intra.peff.net> Jeff King writes: I didn't know it was that easy (primarily because I didn't know zlib had a ready-to-eat interface to do this). > + if (!strcasecmp(ext, "tgz")) > + return "--format=tgz"; > + if (!strcasecmp(ext, "gz") && > + ext - 4 >= filename && > + !strcasecmp(ext - 4, "tar.gz")) Shouldn't this be if (!strcasecmp(ext, "gz") && filename < ext - 5 && !strcasecmp(ext - 5, ".tar.gz")) to exclude "hellotar.gz" and possibly ".tar.gz" ("<=" vs "<")? > diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh > index cff1b3e..faf2784 100755 > --- a/t/t5000-tar-tree.sh > +++ b/t/t5000-tar-tree.sh > @@ -26,6 +26,7 @@ commit id embedding: > > . ./test-lib.sh > UNZIP=${UNZIP:-unzip} > +GUNZIP=${GUNZIP:-gunzip} Just a personal preference but I find myself using "gzip -d" more often than "gunzip".