Re: Gnome chose Git
- From
Jeff King <peff@peff.net>
- Date
- Mar 20, 2009, 05:28 UTC
- Message-ID
- <20090320052802.GA27714@coredump.intra.peff.net>
- In-Reply-To
- <20090319214317.GU23521@spearce.org>
On Thu, Mar 19, 2009 at 02:43:17PM -0700, Shawn O. Pearce wrote:
Show 10 quoted lines
> demerphq <demerphq@gmail.com> wrote:
> > Outside of parsing the reflog directly, (which feels wrong and dirty
> > to me), how does one find out the times that a reflog entry was
> > created?
> >
> > The closest thing i could find was git log -g, but that shows the time
>
> git reflog -g branch@{now}
>
> the @{now} suffix is the magic to make it show the time.Yuck. It would be nice to just have a "Reflog date" header that you could depend on, like:
diff --git a/reflog-walk.c b/reflog-walk.c index f751fdc..cb7c66b 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -269,6 +269,8 @@ void show_reflog_message(struct reflog_walk_info* info, int oneline, - 2 - commit_reflog->recno); printf("} (%s)\nReflog message: %s", info->email, info->message); + printf("Reflog date: %s\n", + show_date(info->timestamp, info->tz, relative_date)); } } } Then you could just do: $ git log --date=raw -g Looking at making this trivial patch, though, it seems there is a bug with the relative_date parameter. It is really a date_mode enum. In the multi-line format, we feed it to show_date. But in the oneline mode, we use it to decide whether to show the date, but then always pass the "relative" date mode. So you get: $ git log --oneline -g origin/master | head -n 1 e986ceb refs/remotes/origin/master@{0}: fetch origin: fast forward $ git log --oneline -g --date=relative origin/master | head -n 1 e986ceb refs/remotes/origin/master@{2 days ago}: fetch origin: fast forward $ git log --oneline -g --date=raw origin/master | head -n 1 e986ceb refs/remotes/origin/master@{2 days ago}: fetch origin: fast forward Hmm. It seems to drop the TZ, too. I'll whip up a patch. I guess my original "extra reflog header" isn't terribly useful, then: you can always just pass --date=raw and parse it from the branch@{} syntax. -Peff