Re: #178 parsing of pretty=format:"%an %ad" causes fatal: bad revision '%ad'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]