Repository navigation
perf(git): skip bitmaps for incremental upload-pack and bundle builds - #467
Merged
Merged
Conversation
When an upload-pack request's haves aren't covered by a bitmap, git first fills one in by walking their whole tree. On the cash-server mirror (bb-block staging, git 2.52.1, MIDX bitmap 9 minutes old, boundary traversal on), a v2 fetch through http-backend for a 47-commit gap took 13-15s and sent 4.3 MB with bitmaps, against under 1s and 1.1 MB without. A 2,000-commit gap took 24s and 72 MB against 8s and 42 MB. Delta bundle builds (HEAD ^base) hit the same fill-in: 14s against about 1s. serveReadyRepo already buffers the request body. A git-upload-pack request whose body (gzip-aware, same inspect window as clone counting) has "have" lines now runs http-backend with pack.useBitmaps=false through GIT_CONFIG_COUNT. The "not our ref" replay gets the same override. Clones, ls-refs and info/refs keep bitmaps, which a full object walk needs. v0 and v2 requests both take this path. Bundles are built with -c pack.useBitmaps=false. The mirror config is unchanged. Co-authored-by: Sleeper Service <a6659a6442a259afd31da6e85f71b9e9f3fe127dd3cc88d2ae9fb544922bcb3c>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
jrobotham-square
approved these changes
Nov 25, 2026
stuartwdouglas
deleted the
sleeper/upload-pack-no-bitmaps-incremental
branch
November 25, 2026 07:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an upload-pack request's haves aren't covered by a bitmap, git first fills one in by walking the whole tree on the haves side (
haves/boundary→boundary-fill-in). On a large monorepo mirror, that costs about the same for a 47-commit gap as for weeks of history. It affects two paths:serveReadyRepo→git http-backend→ upload-pack.git bundle create HEAD ^base), which a clone waits on when the bundle isn't cached yet.Change
serveReadyRepoalready buffers the request body for the "not our ref" replay. A/git-upload-packrequest whose body hashavelines is now marked incremental. Detection uses the same gzip-aware 64 KiB inspect window as clone counting;decodeUploadPackPrefixis factored out ofinspectUploadPackBody.GIT_CONFIG_COUNT=1,pack.useBitmaps=false. This is command-scope config, and the mirror's own config is unchanged. The "not our ref" replay gets the same override.ls-refsandinfo/refskeep bitmaps, because a full object walk benefits from them. v0 and v2 requests both take this path.havefalls past the 64 KiB window is treated as a clone and keeps bitmaps. That is today's behaviour.-c pack.useBitmaps=false.Measurements
These were taken on the bb-block staging cash-server mirror (git 2.52.1, MIDX bitmap fresh and covering HEAD, boundary traversal on). Each fetch is a protocol v2
fetchthroughgit http-backendwith the CGI env cachew uses, two runs each:pack-objectsruns on the same mirror:Production baseline for a cold bundle build:
snapshot.bundle?base=<main~47>against bb-block prod took 37.2s to first byte (4.49 MB). Part of that may be time spent waiting behind a mirror fetch underWithFetchExclusion.Not measured: a client advertising many unrelated branch tips as haves. If that proves slow, a cap on
havelines is the limit to add.Testing
TestUploadPackSkipsBitmapsOnlyForIncrementalFetchesdrives the real POST handler and a realgit http-backendon the fixture mirror. A PATH wrapper records thepack.usebitmapsvalue each backend run sees. There are six cases:false)The clone and ls-refs cases expect the value unset. With detection forced off, the three with-haves cases fail.
The fake-git bundle test now matches
bundle createanywhere in argv, because-cshifts the arguments.go test -race ./internal/strategy/git/ ./internal/gitclone/passes andtskis clean.Follow-up: #466, now a draft, will carry the bundle staleness fix and the
tip=hint after this merges.🤖 Generated with Claude Code