Re: [PATCH v2 4/4] upload-archive: use start_command instead of fork
- From
Jeff King <peff@peff.net>
- Date
- Aug 2, 2011, 18:13 UTC
- Message-ID
- <20110802181357.GA1861@sigill.intra.peff.net>
- In-Reply-To
- <4E3829DC.8070802@lsrfire.ath.cx>
On Tue, Aug 02, 2011 at 06:46:20PM +0200, René Scharfe wrote:
Show 26 quoted lines
> The output of gzip is not simply always mangled, though (taken from my > earlier email, all three are working): > > $ git archive v1.7.6 | gzip -cn | md5sum > a0ca1c873a533a5fcd41d248fb325a5b *- > > $ git archive --format=tar.gz v1.7.6 | md5sum > a0ca1c873a533a5fcd41d248fb325a5b *- > > $ git archive v1.7.6 | gzip -cn >a.tgz && md5sum <a.tgz > a0ca1c873a533a5fcd41d248fb325a5b *- > > It's only broken if we call it from git archive: > > $ git archive --format=tar.gz v1.7.6 >a.tgz && md5sum <a.tgz > 30886283af1aed05ae6a36fc5aeda077 *- > > $ git archive -o a.tgz v1.7.6 && md5sum <a.tgz > 30886283af1aed05ae6a36fc5aeda077 *- > > But not if we stuff the result into a pipe instead of a file: > > $ git archive --format=tar.gz v1.7.6 | cat >a.tgz && md5sum <a.tgz > a0ca1c873a533a5fcd41d248fb325a5b *- > > It _is_ confusing.
Hmm. So it's not _just_ the pipe vs file thing. What's different about calling it from the shell, versus the way we call it from git-archive?
IOW, the pipe trick you mentioned is one way to fix it; but it may be more elegant to do whatever it is the shell is doing to get those results (unless the shell is secretly putting a "cat" into the pipeline :) ).
-Peff