git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Samuel Bronson <naesten@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [BUG] "echo HEAD | git cat-file --batch=''" fails catastrophically
Date: Wed, 11 Dec 2013 19:54:58 +0800	[thread overview]
Message-ID: <20131211115458.GA10561@sigill.intra.peff.net> (raw)
In-Reply-To: <CAJYzjmdHdLZaBijahepOQDJtDd_TdojT4ivNxGrcerRfEuHQEg@mail.gmail.com>

On Tue, Dec 10, 2013 at 11:37:14PM -0500, Samuel Bronson wrote:

> % echo HEAD | git cat-file --batch=
> 
> fatal: object fde075cb72fc0773d8e8ca93d55a35d77bb6688b changed type!?
> 
> Without the =, it works fine; with a string that has both
> "%(objecttype)" and "%(objectsize)", it's fine; but when you don't
> include both, it complains about one of the values that you did not
> mention having changed.
> 
> jrnieder fingered v1.8.4-rc0~7^2~15 as the (likely?) culprit here.

It's not actually that commit itself, but rather that commit in
conjunction with further optimizations in that patch series.

The rest of the series tries hard to avoid looking up items that we
aren't going to print, for --batch-check. But I didn't think about the
fact that "--batch" got the same custom-header feature, but was relying
on the values from the default header to do its consistency checks.

The following patches should fix it.

  [1/2]: cat-file: pass expand_data to print_object_or_die
  [2/2]: cat-file: handle --batch format with missing type/size

Doing "--batch=" is somewhat pointless. If you do not get the size, you
cannot know when the object content ends, so it only makes sense with a
single object. At which point using --batch is pointless. Doing
"--batch=%(objectsize)" is reasonable, though, and that is broken, too.

v1.8.4 has the breakage, though it's not a regression (doing
"--batch=anything" did not exist before that). This can probably just go
to the regular "maint" track for v1.8.5).

-Peff

  reply	other threads:[~2013-12-11 11:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  4:37 [BUG] "echo HEAD | git cat-file --batch=''" fails catastrophically Samuel Bronson
2013-12-11 11:54 ` Jeff King [this message]
2013-12-11 11:56   ` [PATCH 1/2] cat-file: pass expand_data to print_object_or_die Jeff King
2013-12-11 20:11     ` Jonathan Nieder
2013-12-11 23:01       ` Jeff King
2013-12-12  3:03         ` Junio C Hamano
2013-12-11 11:58   ` [PATCH 2/2] cat-file: handle --batch format with missing type/size Jeff King
2013-12-11 20:42     ` Jonathan Nieder
2013-12-11 23:15       ` Jeff King
2013-12-11 23:31         ` Jonathan Nieder
2013-12-12  3:05         ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131211115458.GA10561@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=naesten@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;
as well as URLs for NNTP newsgroup(s).