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

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

From
Paul Tan <pyokagan@gmail.com>
Date
Jul 30, 2016, 02:11 UTC
Message-ID
<CACRoPnS2kDRLiY8KX3K4Havh7d1GWy3mUXSiYCzw45BznuwYeA@mail.gmail.com>
In-Reply-To
<20160729180517.GA14953@sigill.intra.peff.net>
Hi Jeff,
On Sat, Jul 30, 2016 at 2:05 AM, Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
> When we compute the date to put in author/committer lines of
> commits, or tagger lines of tags, we get the current date
> once and then cache it for the rest of the program.  This is
> a good thing in some cases, like "git commit", because it
> means we do not racily assign different times to the
> author/committer fields of a single commit object.

So commits created with "git commit" should have the same author and committer timestamps...

Show 12 quoted lines
> diff --git a/commit.c b/commit.c
> index 71a360d..7ddbffe 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -1548,6 +1548,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
>         }
>
>         /* Person/date information */
> +       reset_ident_date();
>         if (!author)
>                 author = git_author_info(IDENT_STRICT);
>         strbuf_addf(&buffer, "author %s\n", author);

But since builtin/commit.c constructs its author ident string before calling the editor and then commit_tree_extended(), this would cause the resulting commits to have committer timestamps which differ from their author timestamps.

So maybe we would have to put reset_ident_date() at the end of the function instead, at least after git_committer_info() is called.

Regards, Paul

Previous: Jeff KingNext: Jeff King
Message 11 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.