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