git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: demerphqNext: Jeff King
Message 18 of 21 in “Gnome chose Git”
  1. Teemu LikonenMar 19, 2009
  2. Sverre RabbelierMar 19, 2009
  3. Mike RalphsonMar 19, 2009
  4. Andreas EricssonMar 19, 2009
  5. Michael J GruberMar 19, 2009
  6. Pat NotzMar 19, 2009
  7. Shawn O. PearceMar 19, 2009
  8. Pat NotzMar 19, 2009
  9. Jeff KingMar 19, 2009
  10. demerphqMar 19, 2009
  11. Shawn O. PearceMar 19, 2009
  12. Shawn O. PearceMar 19, 2009
  13. demerphqMar 19, 2009
  14. Shawn O. PearceMar 19, 2009
  15. demerphqMar 19, 2009
  16. Johannes SchindelinMar 19, 2009
  17. demerphqMar 19, 2009
  18. Jeff KingMar 20, 2009
  19. make oneline reflog dates more consistent with multiline formatJeff King, Mar 20, 2009
  20. Michael J GruberMar 20, 2009
  21. Jeff KingMar 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.