[PATCH 0/2] receive-pack: use advertised reference tips to inform connectivity check
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 28, 2022, 14:42 UTC
- Message-ID
- <cover.1666967670.git.ps@pks.im>
Hi,
this patch series improves the connectivity check done by stateful git-receive-pack(1) to only consider references as reachable that have been advertised to the client. This has two advantages:
- A client shouldn't assume objects to exist that have not been part
of the reference advertisement. But if it excluded an object from
the packfile that is reachable via any ref that is excluded from
the reference advertisement due to `transfer.hideRefs` we'd have
accepted the push anyway. I'd argue that this is a bug in the
current implementation. - Second, by using advertised refs as inputs instead of `git
rev-list --not --all` we avoid looking up all refs that are
irrelevant to the current push. This can be a huge performance
improvement in repos that have a huge amount of internal, hidden
refs. In one of our repos with 7m refs, of which 6.8m are hidden,
this speeds up pushes from ~30s to ~4.5s.One downside is that we need to pass in the object IDs that were part of the reference advertisement via the standard input, which is seemingly slower than reading them from the refdb. I'm discussing this in the second commit.
Patrick
Patrick Steinhardt (2):
connected: allow supplying different view of reachable objects
receive-pack: use advertised reference tips to inform connectivity
checkbuiltin/receive-pack.c | 31 ++++++++++++++++++++++--------- connected.c | 9 ++++++++- connected.h | 7 +++++++ 3 files changed, 37 insertions(+), 10 deletions(-)
-- 2.38.1