From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Michael J Gruber <git@drmicha.warpmail.net>,
dloewenherz@gmail.com, git@vger.kernel.org
Subject: Re: Pretty date option for git tag?
Date: Mon, 18 May 2009 17:27:31 -0400 [thread overview]
Message-ID: <20090518212731.GA14050@coredump.intra.peff.net> (raw)
In-Reply-To: <200905182311.41876.trast@student.ethz.ch>
On Mon, May 18, 2009 at 11:11:37PM +0200, Thomas Rast wrote:
> Jeff King wrote:
> > It seems like you should be able to script around for-each-ref and
> > remain efficient, but I don't think there is a way to convince it to
> > dereference tags.
>
> Actually there's the * operator. For example
>
> git$ git for-each-ref --format="%(objecttype) %(*objecttype)" refs/tags/v1.6.0
> tag commit
>
> Does that solve the problem at hand?
Oh, right, thanks. I missed that when reading the manual (I was looking
for "dereference" or "peel", but those words are never used). So you can
do:
git for-each-ref --format='%(refname)
Tag: %(taggername) %(taggeremail) %(taggerdate)
Commit: %(*authorname) %(*authoremail) %(*authordate)
' refs/tags
to show both.
That could go in an alias, though it isn't exactly what the original
poster asked for. Besides not being a one-line format, it has refs/tags/
cruft at the beginning of each ref. I think what the OP asked for
exactly is:
eval "`git for-each-ref --shell --format='
r=%(refname)
d=%(taggerdate)
T=${r#refs/tags/}
echo "$T $d"
' refs/tags`"
Though as Linus said, I think the actual commit date is also interesting
(and you could expand that shell snippet to show it instead, in addition
to, or whatever).
And before anyone says anything, yes, I think building a shell script
and eval'ing it is a little ugly compared to a "--show-date" option to
"git tag". If this is something a lot of people want to do, it wouldn't
be that hard an option to add (in fact, it would be really nice to unify
the show-ref and pretty=format substitutions, and extend them into "git
tag --format='%r %td'" or whatever).
-Peff
prev parent reply other threads:[~2009-05-18 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-18 15:14 Pretty date option for git tag? dloewenherz
2009-05-18 16:02 ` Michael J Gruber
2009-05-18 17:20 ` Linus Torvalds
2009-05-18 17:45 ` Jeff King
2009-05-18 17:58 ` [PATCH] for-each-ref: fix segfault in copy_email Jeff King
2009-05-18 21:11 ` Pretty date option for git tag? Thomas Rast
2009-05-18 21:27 ` 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:
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=20090518212731.GA14050@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=dloewenherz@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=trast@student.ethz.ch \
/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).