<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pub/scm/git/git.git/commit.c, branch master</title>
<subtitle>Git source code mirror</subtitle>
<id>http://kernel.varnish.org/pub/scm/git/git.git/atom/commit.c?h=master</id>
<link rel='self' href='http://kernel.varnish.org/pub/scm/git/git.git/atom/commit.c?h=master'/>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/'/>
<updated>2026-07-13T15:27:27Z</updated>
<entry>
<title>Merge branch 'kk/prio-queue-get-put-fusion'</title>
<updated>2026-07-13T15:27:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-07-13T15:27:27Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=3c775abab0b4acb9db2098ac07ee5d6565494080'/>
<id>urn:sha1:3c775abab0b4acb9db2098ac07ee5d6565494080</id>
<content type='text'>
The lazy priority queue optimization pattern (deferring actual removal
in 'prio_queue_get()' to allow get+put fusion) has been folded
directly into 'prio_queue' itself, speeding up commit traversal
workflows and simplifying callers.

* kk/prio-queue-get-put-fusion:
  prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion
  prio-queue: rename .nr to .nr_ and add accessor helpers
</content>
</entry>
<entry>
<title>Merge branch 'js/objects-larger-than-4gb-on-windows-more'</title>
<updated>2026-06-21T23:41:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-06-21T23:41:37Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=02bb39c5cbca65a4817854477cc3e1c31ea28c49'/>
<id>urn:sha1:02bb39c5cbca65a4817854477cc3e1c31ea28c49</id>
<content type='text'>
* js/objects-larger-than-4gb-on-windows-more:
  odb: use size_t for object_info.sizep and the size APIs
  packfile,delta: drop the `cast_size_t_to_ulong()` wrappers
  pack-objects: use size_t for in-core object sizes
  packfile: widen unpack_entry()'s size out-parameter to size_t
  pack-objects(check_pack_inflate()): use size_t instead of unsigned long
  patch-delta: use size_t for sizes
  compat/msvc: use _chsize_s for ftruncate
</content>
</entry>
<entry>
<title>Merge branch 'kk/streaming-walk-pqueue'</title>
<updated>2026-06-16T16:01:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-06-16T16:01:02Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=6e148f82dc91cf208c5f60dea66dce198d4ee4e2'/>
<id>urn:sha1:6e148f82dc91cf208c5f60dea66dce198d4ee4e2</id>
<content type='text'>
Streaming revision walks have been optimized by using a priority queue
for date-sorting commits, speeding up walks repositories with many
merges.

* kk/streaming-walk-pqueue:
  revision: use priority queue for non-limited streaming walks
  revision: introduce rev_walk_mode to clarify get_revision_1()
  pack-objects: call release_revisions() after cruft traversal
</content>
</entry>
<entry>
<title>odb: use size_t for object_info.sizep and the size APIs</title>
<updated>2026-06-15T14:45:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2026-06-15T11:52:29Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=c6a4629e3205fdb5af3a406477ca691de2a5ab31'/>
<id>urn:sha1:c6a4629e3205fdb5af3a406477ca691de2a5ab31</id>
<content type='text'>
When `js/objects-larger-than-4gb-on-windows` widened the streaming,
index-pack and unpack-objects code paths, in the interest of keeping the
patches somewhat reasonably-sized, it left the public ODB API still
typed in `unsigned long`. In particular `struct object_info::sizep` and
the four wrappers built on top of it (`odb_read_object`,
`odb_read_object_peeled`, `odb_read_object_info`, `odb_pretend_object`)
still return the unpacked size through `unsigned long *`, so on Windows
`cat-file -s` and the `git add` / `git status` paths for a &gt;4 GiB blob
silently cap at 4 GiB.

Widen the field and the four wrappers. The previous commits already
widened the `unpack_entry()` cascade and pack-objects' in-core size
accessors, so most of the cascade arrives here with no further work: the
temporary shims in `packed_object_info_with_index_pos()` and in
`unpack_entry()`'s delta-base recovery path go away, the two
`SET_SIZE(entry, cast_size_t_to_ulong(canonical_size))` calls in
`check_object()` and the matching one in `drop_reused_delta()` collapse
to plain `SET_SIZE`, and `oe_get_size_slow()`'s tail
`cast_size_t_to_ulong()` is gone too.

What remains narrow are the boundaries this series does not
intend to touch: the diff, blame, textconv and fast-import machinery.

Even so, this patch is unfortunately quite large.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion</title>
<updated>2026-06-09T18:11:46Z</updated>
<author>
<name>Kristofer Karlsson</name>
<email>krka@spotify.com</email>
</author>
<published>2026-06-08T19:10:51Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=9f75e7a150edfe931391047bf84c697b4b15c4c4'/>
<id>urn:sha1:9f75e7a150edfe931391047bf84c697b4b15c4c4</id>
<content type='text'>
Defer the actual removal in prio_queue_get() until the next
operation.  If that next operation is a prio_queue_put(), the
removal and insertion are fused into a single replace — writing
the new element at the root and sifting it down — which avoids
a full remove-rebalance-insert cycle.

This matches the dominant usage pattern in git's commit traversal:
get a commit, then put its parents.  The first parent insertion
after each get is now a replace operation automatically.

This generalizes the lazy_queue pattern from builtin/describe.c
(introduced in 08bb69d70f) into prio_queue itself.  Three callers
independently implemented the same get+put fusion:

  - builtin/describe.c had a full lazy_queue wrapper
  - commit.c:pop_most_recent_commit() used peek+replace
  - builtin/show-branch.c:join_revs() used peek+replace

All three now collapse to plain _get() and _put(), with the data
structure handling the fusion internally.  This simplifies callers
and means every prio_queue user gets the optimization for free
without needing to implement it manually.

Remove prio_queue_replace() since no external callers remain.

Benchmarked on a 1.8M-commit monorepo (30 interleaved runs,
paired t-test, Xeon @ 2.20GHz):

Code paths that previously did eager get+put (new optimization):

  Command                       base    patched  change      p
  merge-base --all A A~1000     3828ms  3725ms   -2.69%  0.0001
  rev-list --count A~1000..A    3055ms  2986ms   -2.27%  0.0601
  log --oneline A~1000..A       3408ms  3350ms   -1.71%  0.0482

Code paths that already had manual get+put fusion (expect
neutral — the optimization moves into prio_queue but the number
of heap operations stays the same):

  Command                       base    patched  change      p
  show-branch A A~1000          9156ms  9127ms   -0.32%  0.3470
  describe (4751 revs, 81K repo) 1983ms 1963ms  -1.02%  &lt;0.001

No regressions in any scenario.

Suggested-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Kristofer Karlsson &lt;krka@spotify.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-graph-lazy-load-fallback'</title>
<updated>2026-05-31T01:00:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-31T01:00:38Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=f6c8fe189b698845caa3c553bcffa226642948d5'/>
<id>urn:sha1:f6c8fe189b698845caa3c553bcffa226642948d5</id>
<content type='text'>
The logic to lazy-load trees from the commit-graph has been made
more robust by falling back to reading the commit object when
the commit-graph is no longer available.

* jk/commit-graph-lazy-load-fallback:
  commit: fall back to full read when maybe_tree is NULL
</content>
</entry>
<entry>
<title>revision: use priority queue for non-limited streaming walks</title>
<updated>2026-05-27T21:08:20Z</updated>
<author>
<name>Kristofer Karlsson</name>
<email>krka@spotify.com</email>
</author>
<published>2026-05-27T15:50:02Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=dd4bc01c0a8fc871a68a5027ed5ac953fa47fc6e'/>
<id>urn:sha1:dd4bc01c0a8fc871a68a5027ed5ac953fa47fc6e</id>
<content type='text'>
The streaming (non-limited) walk in get_revision_1() inserts newly
discovered parent commits into a date-sorted queue via
commit_list_insert_by_date(), which scans the linked list to find the
insertion point -- O(w) per insert, where w is the width of the active
walk frontier.  Replace this with an O(log w) priority queue.

Add a commit_queue field to rev_info alongside the existing commits
linked list.  The two representations are mutually exclusive: setup
and external callers that need list access use the linked list, then
get_revision_1() lazily drains it into the priority queue on first
call.  Add a REV_WALK_NO_WALK enum value to distinguish the no_walk
case (which still uses the commit list) from the streaming case.

The conversion function rev_info_commit_list_to_queue() is public so
callers that know they will iterate can convert early.

Combined with the limit_list() priority queue change already in
master, this eliminates all O(w) sorted linked-list insertion from
the revision walk machinery.

Signed-off-by: Kristofer Karlsson &lt;krka@spotify.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-sign-overflow-fix'</title>
<updated>2026-05-21T23:48:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-21T23:48:20Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=382705906f5b12980c8a4783a56b8374568a664f'/>
<id>urn:sha1:382705906f5b12980c8a4783a56b8374568a664f</id>
<content type='text'>
Leakfix.

* jk/commit-sign-overflow-fix:
  commit: handle large commit messages in utf8 verification
</content>
</entry>
<entry>
<title>commit: fall back to full read when maybe_tree is NULL</title>
<updated>2026-05-20T06:38:01Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2026-05-19T06:15:34Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=3d8e4004c604b206d70240a087816907cce70a08'/>
<id>urn:sha1:3d8e4004c604b206d70240a087816907cce70a08</id>
<content type='text'>
When we load a commit object from the commit graph (rather than reading
the object contents), we don't fill in its "maybe_tree" entry, but
rather wait to lazy-load it. This goes back to 7b8a21dba1 (commit-graph:
lazy-load trees for commits, 2018-04-06), and saves the work of
instantiating tree objects that nobody cares about.

But it creates a data dependency: now the commit struct depends on the
graph file to do that lazy load. This is a problem if we close the graph
file; now we have a commit struct that claims to be parsed but is
missing some of its data.

It's rare for this to be a problem in practice, because we don't tend to
close the graph files at all, and if we do we don't tend to look at
their commits afterward. But there is one case that is easy to trigger:
git-clone's --dissociate option will close the object database before
running the dissociate repack, and then afterwards still try to check
out the working tree. This will yield an error like:

  fatal: unable to parse commit b29edc0babef41810f7b1c9ee1d74058f22e4080
  warning: Clone succeeded, but checkout failed.

What happens is that we expect repo_get_commit_tree() to lazy-load the
tree, but commit_graph_position() returns COMMIT_NOT_FROM_GRAPH because
the position slab has gone away (and even if it hadn't, we don't have
the graph file itself available anymore).

Let's try harder to find the tree in repo_get_commit_tree() by actually
opening the commit object and parsing the tree line. This is extra work,
but no more than we'd have to go to if we hadn't done the initial graph
load in the first place.

It does mean that a corrupt commit (e.g., one that points to a non-tree
object for which we couldn't instantiate a struct) will repeatedly load
the object from disk, once for each call to repo_get_commit_tree(). But
such corruptions should be rare, and we don't tend to perform such calls
repeatedly (usually we'd abort the operation upon seeing corruption).

It also means we have to reimplement a bit of the commit parsing. We
can't just use parse_commit_buffer() here, because it expects an
unparsed struct and wants to load everything, including parent links.
But we don't know if the parent list has been munged during traversal,
so it's not safe for us to touch it. Fortunately, it's quite easy to
load just the tree, as it is always the first line of the commit object.

There is an alternative approach which I considered but rejected:
"complete" each graph-loaded commit struct when we close the graph file
by looking up and instantiating their trees at close time. This is the
most elegant solution in some sense, as it resolves the data dependency
at the moment it goes away. And it avoids ever opening the commit
objects at all, which can be more efficient.

But not always. The resolving effort scales with the number of
graph-loaded commits, even though we may only later access one or a few.
So the tradeoff depends on how many were loaded in total versus how many
will be later accessed.

And in most cases, we will not access any at all! Programs which close
the object database before exiting will then do a bunch of work for no
reason. This could be mitigated by requiring a separate function to
resolve the graph structs before closing the file. But now each close
call has to consider whether to call that resolving function. So we'd
fix this case in git-clone, but we don't know what other cases (if any)
are lurking.

Moreover, this strategy does nothing if we lose access to the graph file
unexpectedly (e.g., due to a system error). I'm not entirely sure this
is possible now (we mmap it, so I'd guess any error would turn into
SIGBUS anyway). But it feels like making the lazy-load more robust
(which this patch does) is the best way to handle a wide variety of
possible failure modes.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bc/sign-commit-with-custom-encoding'</title>
<updated>2026-05-20T01:30:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-20T01:30:57Z</published>
<link rel='alternate' type='text/html' href='http://kernel.varnish.org/pub/scm/git/git.git/commit/?id=cf7151110d46bd159b3ef4b370035c63ed2a6131'/>
<id>urn:sha1:cf7151110d46bd159b3ef4b370035c63ed2a6131</id>
<content type='text'>
Signing commit with custom encoding was passing the data to be
signed at a wrong stage in the pipeline, which has been corrected.

* bc/sign-commit-with-custom-encoding:
  commit: sign commit after mutating buffer
  commit: name UTF-8 function appropriately
</content>
</entry>
</feed>
