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

Re: [PATCH] reset cached ident date before creating objects

From
Jeff King <peff@peff.net>
Date
Jul 29, 2016, 18:25 UTC
Message-ID
<20160729182545.GE14953@sigill.intra.peff.net>
In-Reply-To
<xmqqeg6cnwdw.fsf@gitster.mtv.corp.google.com>
On Fri, Jul 29, 2016 at 11:15:39AM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> > It does feel a little backwards to cache by default, and then try to
> > catch all the places that want to reset. Another way of thinking about
> > it would be to almost _never_ cache, but let a few callsites like (the
> > commit object creation) explicitly ask for a stable timestamp between
> > the author and committer.
> 
> ... and the reflog?

I left that part out. I can't decide if it is a bug or a feature that the reflog retains the same timestamp.

I.e., I'm not sure it would be wrong to do:
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 12290d2..465cfc5 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2886,6 +2886,8 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
 	logfd = open(logfile->buf, oflags);
 	if (logfd < 0)
 		return 0;
+
+	reset_ident_date();
 	result = log_ref_write_fd(logfd, old_sha1, new_sha1,
 				  git_committer_info(0), msg);
 	if (result) {

on top. If somebody writes a lot of refs without updating any commit
objects, should those all have a stable timestamp or not?

On the one hand, moving the timestamp reflects reality.

On the other, I have done dirty things in the past like "undoing" the
results of somebody's mistaken:

  git clone ...
  git push --mirror ;# oops, this deletes everything except master!

by grouping ref updates according to their reflog mtimes.

So I kind of punted by not changing it but also not making any claims
either way. :)

-Peff
Previous: Junio C HamanoNext: Paul Tan
Message 10 of 26 in “Small trivial annoyance with the nice new builtin "git am"”
  1. Linus TorvaldsJul 28, 2016
  2. Junio C HamanoJul 28, 2016
  3. Jeff KingJul 29, 2016
  4. Linus TorvaldsJul 29, 2016
  5. Jeff KingJul 29, 2016
  6. Junio C HamanoJul 29, 2016
  7. reset cached ident date before creating objectsJeff King, Jul 29, 2016
  8. Linus TorvaldsJul 29, 2016
  9. Junio C HamanoJul 29, 2016
  10. Jeff KingJul 29, 2016
  11. Paul TanJul 30, 2016
  12. Jeff KingJul 30, 2016
  13. Junio C HamanoAug 1, 2016
  14. Junio C HamanoAug 1, 2016
  15. Jeff KingAug 1, 2016
  16. Jeff KingAug 1, 2016
  17. Jeff KingAug 1, 2016
  18. Jeff KingAug 1, 2016
  19. Junio C HamanoAug 1, 2016
  20. Jeff KingAug 1, 2016
  21. Junio C HamanoJul 29, 2016
  22. Junio C HamanoJul 29, 2016
  23. Jeff KingJul 29, 2016
  24. Linus TorvaldsJul 29, 2016
  25. Christian CouderJul 29, 2016
  26. Junio C HamanoJul 29, 2016

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.