* [PATCH] commit: use timestamp_t for author_date_slab
@ 2018-08-21 20:54 Derrick Stolee
2018-08-21 21:05 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Derrick Stolee @ 2018-08-21 20:54 UTC (permalink / raw)
To: git@vger.kernel.org
Cc: gitster@pobox.com, johannes.schindelin@gmx.de, Derrick Stolee
The author_date_slab is used to store the author date of a commit
when walking with the --author-date flag in rev-list or log. This
was added as an 'unsigned long' in
81c6b38b "log: --author-date-order"
Since 'unsigned long' is ambiguous in its bit-ness across platforms
(64-bit in Linux, 32-bit in Windows, for example), most references
to the author dates in commit.c were converted to timestamp_t in
dddbad72 "timestamp_t: a new data type for timestamps"
However, the slab definition was missed, leading to a mismatch in
the data types in Windows. This would not reveal itself as a bug
unless someone authors a commit after February 2106, but commits
can store anything as their author date.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
I found this while reading up on the revision-walk machinery. This code
hasn't been touched in years, so could apply to 'maint'.
commit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index 0030e79940..2ce5052b3e 100644
--- a/commit.c
+++ b/commit.c
@@ -609,7 +609,7 @@ struct commit *pop_commit(struct commit_list **stack)
define_commit_slab(indegree_slab, int);
/* record author-date for each commit object */
-define_commit_slab(author_date_slab, unsigned long);
+define_commit_slab(author_date_slab, timestamp_t);
static void record_author_date(struct author_date_slab *author_date,
struct commit *commit)
--
2.19.0.rc0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] commit: use timestamp_t for author_date_slab
2018-08-21 20:54 [PATCH] commit: use timestamp_t for author_date_slab Derrick Stolee
@ 2018-08-21 21:05 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-08-21 21:05 UTC (permalink / raw)
To: Derrick Stolee; +Cc: git@vger.kernel.org, johannes.schindelin@gmx.de
Derrick Stolee <dstolee@microsoft.com> writes:
> The author_date_slab is used to store the author date of a commit
> when walking with the --author-date flag in rev-list or log. This
> was added as an 'unsigned long' in
>
> 81c6b38b "log: --author-date-order"
>
> Since 'unsigned long' is ambiguous in its bit-ness across platforms
> (64-bit in Linux, 32-bit in Windows, for example), most references
> to the author dates in commit.c were converted to timestamp_t in
>
> dddbad72 "timestamp_t: a new data type for timestamps"
>
> However, the slab definition was missed,
Makes sense, and obviously correct.
> I found this while reading up on the revision-walk machinery. This code
> hasn't been touched in years, so could apply to 'maint'.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-21 21:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-21 20:54 [PATCH] commit: use timestamp_t for author_date_slab Derrick Stolee
2018-08-21 21:05 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).