]> git.ipfire.org Git - thirdparty/git.git/commit
negotiator: add have_sent() interface
authorDerrick Stolee <stolee@gmail.com>
Tue, 19 May 2026 16:24:52 +0000 (16:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 May 2026 02:33:24 +0000 (11:33 +0900)
commit22b2f3d2a319af32e9f3add0b3cc7732cbf4733b
treedae797c32d6234ea8ff2afdfce9b308b313aa1fe
parent8bb252f86c30a3066ec64f99f94719c01a53743a
negotiator: add have_sent() interface

In a future change, we will introduce a capability to choose specific commit
OIDs as 'have's in fetch negotiation, with the ability to have the
negotiator choose more 'have's to increase coverage beyond that required
core set. The negotiator works to avoid emitting 'have's that can reach each
other, but that logic is hidden beneath the negotiator's iterator function
pointer ('next'). We need a way to communicate to the negotiator that we
have picked a 'have' so it could incorporate that into its logic.

Add a have_sent() method to the fetch_negotiator interface. This is the
signal that allows the negotiator to track the commit as already shown and
can perform the proper bookkeeping to avoid emitting those objects or
anything they can reach.

For our non-trivial negotiators, it is sufficient to mark these commits as
common, so the implementation is quite simple. This logic will be exercised
in the next change.

Reviewed-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-negotiator.h
negotiator/default.c
negotiator/noop.c
negotiator/skipping.c