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

Re: [PATCH 1/2] fetch-pack: use commit-graph when computing cutoff

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 2, 2022, 12:46 UTC
Message-ID
<Yfp9KsvvQa5yWuLE@ncase>
In-Reply-To
<YfhoWk1LFnzbFaQf@nand.local>
On Mon, Jan 31, 2022 at 05:53:14PM -0500, Taylor Blau wrote:
Show 44 quoted lines
> (+cc Stolee, in case anything I'm saying here is wrong)
> 
> On Fri, Jan 28, 2022 at 11:17:03AM +0100, Patrick Steinhardt wrote:
> > One thing to keep in mind though is that the commit-graph corrects
> > committer dates:
> >
> >     * A commit with at least one parent has corrected committer date
> >       equal to the maximum of its commiter date and one more than the
> >       largest corrected committer date among its parents.
> 
> This snippet refers to how correct committer dates are computed, not how
> the commit dates themselves are stored.
> 
> Indeed, the corrected committer date is used to compute the corrected
> commit date offset, which is the "v2" generation number scheme (as
> opposed to topological levels, which make up "v1").
> 
> But that is entirely separate from the committer dates stored by the
> commit-graph file, which are faithful representations of the exact
> committer date attached to each commit.
> 
> Looking at the very last few lines of the main loop in
> write_graph_chunk_data() (where the committer dates are stored):
> 
>     if (sizeof((*list)->date) > 4)
>       packedDate[0] = htonl(((*list)->date >> 32) & 0x3);
>     else
>       packedDate[0] = 0;
> 
>     packedDate[0] |= htonl(*topo_level_slab_at(ctx->topo_levels, *list) << 2);
>     packedDate[1] = htonl((*list)->date);
>     hashwrite(f, packedDate, 8);
> 
> the low-order 34 bits are used to store the commit's `->date` field, and
> the remaining high-order 30 bits are used to store the generation
> number. (You can look in `fill_commit_graph_info()` to see that we only
> use those 34 bits to write back the date field).
> 
> So I think this paragraph (and the ones related to it) about this being
> an approximation and that being OK since this is a heuristic can all go
> away.
> 
> Thanks,
> Taylor

Aha, that makes a lot of sense. Thanks a lot for correcting my misconception! I'll send a v2 of this patch series with the corrected commit message.

Patrick
Previous: Taylor BlauNext: Patrick Steinhardt
Message 4 of 16 in “fetch: speed up mirror-fetches with many refs”
  1. 0/2 fetch: speed up mirror-fetches with many refsPatrick Steinhardt, Jan 28, 2022
  2. 1/2 fetch-pack: use commit-graph when computing cutoffPatrick Steinhardt, Jan 28, 2022
  3. Taylor BlauJan 31, 2022
  4. Patrick SteinhardtFeb 2, 2022
  5. 2/2 fetch: skip computing output width when not printing anythingPatrick Steinhardt, Jan 28, 2022
  6. 0/2 fetch: speed up mirror-fetches with many refsPatrick Steinhardt, Feb 2, 2022
  7. 1/2 fetch-pack: use commit-graph when computing cutoffPatrick Steinhardt, Feb 2, 2022
  8. Christian CouderFeb 9, 2022
  9. Patrick SteinhardtFeb 10, 2022
  10. 2/2 fetch: skip computing output width when not printing anythingPatrick Steinhardt, Feb 2, 2022
  11. Christian CouderFeb 9, 2022
  12. Patrick SteinhardtFeb 10, 2022
  13. 0/2 fetch: speed up mirror-fetches with many refsPatrick Steinhardt, Feb 10, 2022
  14. 1/2 fetch-pack: use commit-graph when computing cutoffPatrick Steinhardt, Feb 10, 2022
  15. 2/2 fetch: skip computing output width when not printing anythingPatrick Steinhardt, Feb 10, 2022
  16. Junio C HamanoFeb 10, 2022

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.