Re: [PATCH v2] commit: remove padding from struct commit
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Nov 13, 2026, 14:57 UTC
- Message-ID
- <29490124-5020-42a1-978f-0f5283ba9e11@gmail.com>
- In-Reply-To
- <pull.2309.v2.git.1794576606249.gitgitgadget@gmail.com>
On 11/13/2026 8:30 AM, Kristofer Karlsson via GitGitGadget wrote:
> From: Kristofer Karlsson <krka@spotify.com>
Show 6 quoted lines
> struct commit {
> + /*
> + * Must be the first member, so that a "struct object *" can be
> + * cast to a "struct commit *".
> + */
> struct object object;I think your comment is backwards: We cast a commit into an object and it works. We can't cast an arbitrary object to a commit.
But maybe that direction _does_ happen if we check the object type and see that it's actually a commit underneath.
Show 13 quoted lines
> + > + /* > + * Index into the commit-slab arrays: unique per in-core commit, > + * and only meaningful within the current process. > + */ > + unsigned int index; > + > + /* > + * The committer date taken from the commit object, without any > + * adjustment. > + */ > timestamp_t date; > +
Perhaps instead of "taken from the commit object" you could say "as specified by the commit object" because we may actually load the date from the commit-graph file instead of parsing a commit object.
My comments are only nitpicks that _might_ improve the comments. But they might not, so do what you will.
Thanks, -Stolee