git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: demerphq <demerphq@gmail.com>, Git <git@vger.kernel.org>
Subject: Re: Gnome chose Git
Date: Fri, 20 Mar 2009 01:28:02 -0400	[thread overview]
Message-ID: <20090320052802.GA27714@coredump.intra.peff.net> (raw)
In-Reply-To: <20090319214317.GU23521@spearce.org>

On Thu, Mar 19, 2009 at 02:43:17PM -0700, Shawn O. Pearce wrote:

> 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

  parent reply	other threads:[~2009-03-20  5:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 11:23 Gnome chose Git Teemu Likonen
2009-03-19 11:29 ` Sverre Rabbelier
2009-03-19 11:33 ` Mike Ralphson
2009-03-19 16:29   ` Andreas Ericsson
2009-03-19 13:33 ` Michael J Gruber
     [not found]   ` <1cd1989b0903190643p19a40718yc4fd2730aab0a9a0@mail.gmail.com>
     [not found]     ` <49C24D9B.1060301@drmicha.warpmail.net>
2009-03-19 14:01       ` Pat Notz
2009-03-19 15:16         ` Shawn O. Pearce
2009-03-19 15:50           ` Pat Notz
2009-03-19 20:14             ` Jeff King
2009-03-19 21:40               ` demerphq
2009-03-19 21:43                 ` Shawn O. Pearce
2009-03-19 21:44                   ` Shawn O. Pearce
2009-03-19 21:51                     ` demerphq
2009-03-19 21:53                       ` Shawn O. Pearce
2009-03-19 21:59                         ` demerphq
2009-03-19 23:17                       ` Johannes Schindelin
2009-03-19 21:48                   ` demerphq
2009-03-20  5:28                   ` Jeff King [this message]
2009-03-20  6:00                     ` [PATCH] make oneline reflog dates more consistent with multiline format Jeff King
2009-03-20  8:33               ` Gnome chose Git Michael J Gruber
2009-03-20 20:03                 ` Jeff King

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=20090320052802.GA27714@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=demerphq@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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).