list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: Jeff King <>
To: Joey Hess <>
Subject: Re: git cat-file --batch surprising carriage return behavior
Date: Fri, 11 Oct 2019 02:21:37 -0400
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Oct 09, 2019 at 11:28:51AM -0400, Joey Hess wrote:

> > I suspect it's not entirely sufficient for clean input, though. You're
> > not feeding filenames but rather full "object names". I wouldn't be
> > surprised if we mis-parse "$rev:$path" when $path has "@{}" or similar
> > in it.
> Nothing I've tried along the lines of "HEAD:{yesterday}" has misparsed
> the part after the colon as anything but a filename.

It's possible we've fixed them all. We definitely don't parse strictly
left-to-right. The first thing we try to do is strip bits like ^{commit}
off the end, before we even find the colon. But after doing so, we
should generally be left with a resolvable name, and I think that uses
the "basic" parser which will not allow colons. I.e., this:

  mkdir subdir
  echo whatever >subdir/file
  git add subdir
  git commit -m 'add directory'
  git show HEAD:subdir^{tree}

really does look for the file "subdir^{tree}" in HEAD, and not
"HEAD:subdir" as a tree.

We have had bugs in the past; I'm thinking specifically of 8cd4249c4c
(interpret_branch_name: always respect "namelen" parameter, 2014-01-15).
But I couldn't find any problematic inputs after poking around for a few

> The one I can think of where there's a parse ambiguity is that while
> :foo gets file foo, :1:foo does not get file "1:foo". Instead it's
> treated as a stage number. Using either HEAD:1:foo or :./1:foo
> will avoid that ambiguity.

Yeah, that makes sense.


      reply	other threads:[~2019-10-11  6:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 19:22 Joey Hess
2019-10-08 20:00 ` Jeff King
2019-10-09 15:28   ` Joey Hess
2019-10-11  6:21     ` Jeff King [this message]

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:

  List information:

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

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for the project(s) associated with this inbox:

AGPL code for this site: git clone