All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Dave Bradley <dbradley2@bell.net>
Cc: git@vger.kernel.org, mysgit@googlegroups.com
Subject: Re: #178  parsing of pretty=format:"%an %ad" causes fatal: bad revision '%ad'
Date: Fri, 2 May 2014 10:22:56 -0700	[thread overview]
Message-ID: <20140502172256.GH9218@google.com> (raw)
In-Reply-To: <BLU0-SMTP1116609FAC7E0C76123F929F430@phx.gbl>

Hi Dave,

Dave Bradley wrote:

> G:\ws_test_env\GIT_TESTBED_TMP\fest-swing-1.x>git log --all --pretty=format:"%an %ad" -- pom.xml
> xxxx xxxx Mon Nov 23 03:09:17 2009 +0000
> xxxx xxxx Mon Nov 23 02:42:24 2009 +0000
>
> G:\ws_test_env\GIT_TESTBED_TMP\fest-swing-1.x>git log --all "--pretty=format:"%an %ad"" -- pom.xml
> fatal: bad revision '%ad'

On Linux, this example gets passed to git as six arguments:

	log
	--all
	--pretty=format:%an
	%ad
	--
	pom.xml

I think the intent was instead to pass five arguments (the third being
'--pretty=format:%an %ad').  That means you shouldn't unquote before
the space, or in other words that the space should be part of a quoted
argument.

On Windows, I believe the argument passing convention is more
complicated.  Programs can inspect the entire command line if they
want to.  But there's still an ambiguity in the command you passed: if
I look at space-separated or double-quoted parts of the command line,
it looks like

	git
	log
	--all
	"--pretty=format:"
	(no space)
	%an
	%ad
	(no space)
	""
	--
	pom.xml

What's the right way to parse this?  How can git tell whether %an %ad
were meant to be separate arguments or not?  In absence of a stronger
convention I suspect the simplest rule is to mimic what a Unix shell
does, where they are separate arguments because the space is not
quoted.

Cc-ing Windows folks in case they have more insight.

Thanks and hope that helps,
Jonathan

  parent reply	other threads:[~2014-05-02 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 11:50 #178 parsing of pretty=format:"%an %ad" causes fatal: bad revision '%ad' Dave Bradley
2014-05-02 12:12 ` Erik Faye-Lund
2014-05-02 17:18   ` Junio C Hamano
2014-05-02 17:22 ` Jonathan Nieder [this message]
2014-05-02 17:23 ` Jonathan Nieder
2014-05-02 18:23   ` Erik Faye-Lund
2014-05-04 10:14     ` [msysGit] " Dave Bradley
2014-05-05 23:02       ` 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=20140502172256.GH9218@google.com \
    --to=jrnieder@gmail.com \
    --cc=dbradley2@bell.net \
    --cc=git@vger.kernel.org \
    --cc=mysgit@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.