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

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

Previous: Kristofer Karlsson via GitGitGadgetNext: Kristofer Karlsson
Message 8 of 12 in “commit: remove padding from struct commit”
  1. commit: remove padding from struct commitKristofer Karlsson via GitGitGadget, Nov 12, 2026
  2. Derrick StoleeNov 12, 2026
  3. Kristofer KarlssonNov 12, 2026
  4. Junio C HamanoNov 12, 2026
  5. Kristofer KarlssonNov 12, 2026
  6. Oswald BuddenhagenNov 13, 2026
  7. commit: remove padding from struct commitKristofer Karlsson via GitGitGadget, Nov 13, 2026
  8. Derrick StoleeNov 13, 2026
  9. Kristofer KarlssonNov 13, 2026
  10. Junio C HamanoNov 13, 2026
  11. Junio C HamanoNov 13, 2026
  12. commit: remove padding from struct commitKristofer Karlsson via GitGitGadget, Nov 15, 2026

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.