git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug report - git show <tagname> together with --pretty=format
@ 2009-04-08 12:56 Cornelius
  2009-04-08 15:28 ` Michael J Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Cornelius @ 2009-04-08 12:56 UTC (permalink / raw)
  To: git

Hi,
I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's 
output for parsing the git data, so this is more than a minor issue for 
me. When you normally do a git show on a tag name it's output resembles 
the following:
tag <tagname>
Tagger: Cornelius <c.r1@gmx.de>
Date:   Wed Apr 8 14:39:17 2009 +0200


tagmessage
commit 77e312e0527f87604e4c70ebf6040e79bb55d2ed
<snip>

Now when you do a git show <tagname> 
--pretty=format:"ENDOFGITTAGOUTPUTMESAGEHERE%n%H" --
the Date: line is missing. Git 1.6.0.5 (which is avaible in my distro's 
repos) doesn't have this issue. Please CC me, I'm not subcribed here.
Cornelius

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug report - git show <tagname> together with --pretty=format
  2009-04-08 12:56 Bug report - git show <tagname> together with --pretty=format Cornelius
@ 2009-04-08 15:28 ` Michael J Gruber
  2009-04-08 16:37   ` Santi Béjar
  0 siblings, 1 reply; 4+ messages in thread
From: Michael J Gruber @ 2009-04-08 15:28 UTC (permalink / raw)
  To: Cornelius; +Cc: git

Cornelius venit, vidit, dixit 08.04.2009 14:56:
> Hi,
> I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's 
> output for parsing the git data, so this is more than a minor issue for 
> me. When you normally do a git show on a tag name it's output resembles 
> the following:
> tag <tagname>
> Tagger: Cornelius <c.r1@gmx.de>
> Date:   Wed Apr 8 14:39:17 2009 +0200
> 
> 
> tagmessage
> commit 77e312e0527f87604e4c70ebf6040e79bb55d2ed
> <snip>
> 
> Now when you do a git show <tagname> 
> --pretty=format:"ENDOFGITTAGOUTPUTMESAGEHERE%n%H" --
> the Date: line is missing. Git 1.6.0.5 (which is avaible in my distro's 
> repos) doesn't have this issue. Please CC me, I'm not subcribed here.
> Cornelius

It's not a bug, it's a feature ;)

In fact, git show used to ignore format specifiers for the tag part and
apply them to the commit part only. Since
ea718e6 (show <tag>: reuse pp_user_info() instead of duplicating code,
2009-01-02)
(which is in v1.6.2) it applies the format to both, which is why there
is no tag date unless you ask for it (or use the default format).

Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug report - git show <tagname> together with --pretty=format
  2009-04-08 15:28 ` Michael J Gruber
@ 2009-04-08 16:37   ` Santi Béjar
  2009-04-08 19:47     ` Plumbing commands (was: Bug report - git show <tagname> together with --pretty=format) Teemu Likonen
  0 siblings, 1 reply; 4+ messages in thread
From: Santi Béjar @ 2009-04-08 16:37 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Cornelius, git

2009/4/8 Michael J Gruber <git@drmicha.warpmail.net>:
> Cornelius venit, vidit, dixit 08.04.2009 14:56:
>> Hi,
>> I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's
>> output for parsing the git data,

In addition to what Michael said, you should use the plumbing commands
instead of the porcelain (see man git). They are specifically for use
with scripts and parse their output. The output from the porcelain
commands can change.

Santi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Plumbing commands (was: Bug report - git show <tagname> together with --pretty=format)
  2009-04-08 16:37   ` Santi Béjar
@ 2009-04-08 19:47     ` Teemu Likonen
  0 siblings, 0 replies; 4+ messages in thread
From: Teemu Likonen @ 2009-04-08 19:47 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Michael J Gruber, Cornelius, git

On 2009-04-08 18:37 (+0200), Santi Béjar wrote:

> In addition to what Michael said, you should use the plumbing commands
> instead of the porcelain (see man git). They are specifically for use
> with scripts and parse their output. The output from the porcelain
> commands can change.

Hmm, I've been using a command like this in a script:

    date=$(git log -1 --pretty=format:%ai $REV)

Would it be better to change it to

    date=$(git rev-list -1 --pretty=format:%ai $REV | sed -e 1d)

or something else?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-08 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 12:56 Bug report - git show <tagname> together with --pretty=format Cornelius
2009-04-08 15:28 ` Michael J Gruber
2009-04-08 16:37   ` Santi Béjar
2009-04-08 19:47     ` Plumbing commands (was: Bug report - git show <tagname> together with --pretty=format) Teemu Likonen

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).