openai/git
patches / upstream status

$ git branch --contains <commit>

git: notes on large repositories

OpenAI's work on Git for large repositories

From
openai scm
Repository
openai/git
Upstream
git/git
Checked
31 Jul 2026
verified against git/git
  1. 23cooking here
  2. 5seen
  3. 0next
  4. 2master

master2 threads

Already merged into upstream Git's master branch.

[01]

stash: avoid sparse-index expansion for in-cone paths

master
From
Ted Nyman
Date
20 Jul 2026
Patches
2

A path-limited git stash expanded the full sparse index even when every requested path was already inside the sparse checkout.

Keep the index sparse when possible, expand it when a pathspec needs the full index, and fix a related out-of-bounds read. Paths outside the sparse-checkout cone retain their existing behavior.

18.87 s four index expansions

0.06 s zero index expansions

[02]

pack-objects: use bitmaps and delta islands with path-walk

master
From
Taylor Blau
Date
21 Jun 2026
Patches
4

Path-based pack traversal could not use reachability bitmaps or delta islands.

Enable both existing pack optimizations during path-walk by collecting commit and tree information from its existing callback. Fall back to ordinary traversal when a bitmap cannot satisfy the request.

seen5 threads

In upstream seen and still under review.

[03]

http: make concurrent packfile-URI downloads safe

seen
From
Ted Nyman
Date
26 Jul 2026
Patches
6

Concurrent pack downloads could corrupt a partial pack, race cleanup, or mishandle a completed resume.

Write each download at the correct offset, keep the pack available for indexing, and handle completed downloads. Accept an existing keep file only when its pack hash matches the advertised value.

[04]

packfile: recover safely from duplicate object entries

seen
From
Taylor Blau
Date
24 Jul 2026
Patches
5

Duplicate objects in a pack could confuse reverse indexes, multi-pack indexes, and bitmap reuse.

Match objects to their actual pack offsets, recover usable copies when resolving deltas, and avoid unsafe bitmap reuse. Fall back to ordinary packing when a selected index entry does not match its physical pack position.

[05]

send-pack: negotiate packs without REF_DELTA objects

seen
From
Taylor Blau
Date
12 Jul 2026
Patches
4

Some Git servers cannot accept REF_DELTA objects, but clients could not negotiate that restriction.

Add a no-ref-delta capability and teach send-pack and pack-objects to honor it. Keep the new restriction independent of ofs-delta so servers can state exactly which object formats they accept.

[06]

repack: combine geometric rollups with cruft packs

seen
From
Taylor Blau
Date
26 Jun 2026
Patches
10

Git could not combine geometric repacking and cruft packs in the same operation.

Roll older packs together while writing unreachable objects to a separate cruft pack. Leave packs outside the geometric rollup available and use a consistent reference snapshot when generating bitmaps.

[07]

midx: honor custom incremental base layers

seen
From
Taylor Blau
Date
12 Jun 2026
Patches
3

Incremental multi-pack-index writes ignored the requested base and omitted packs needed by later layers.

Honor the selected base and include newer packs so the resulting index and bitmap remain usable. Packs above the requested base are included instead of being silently excluded from the new layer.

cooking here23 threads

In our topic branches; not yet merged upstream.

[08]

checkout: avoid rewriting an unchanged index

cooking here
From
Ted Nyman
Date
28 Jul 2026
Patches
1

Checking out or restoring an unchanged path rewrote the index even when nothing changed.

Skip the index write when checkout does not change any entries. Both git checkout and git restore retain their existing behavior when an installed post-index-change hook requires the write.

[09]

branch: avoid a six-hour Coccinelle matching slowdown

cooking here
From
Ted Nyman
Date
24 Jul 2026
Patches
1

A reused loop index made Coccinelle's static analysis run for hours and hit CI's six-hour limit.

Declare separate loop indexes so static analysis can finish normally. Branch deletion behaves exactly as before; each loop variable now stays within the loop that uses it.

6 h static-analysis timeout

5 lines isolated loop indexes

[10]

fetch-pack: trace external packfile-URI downloads

cooking here
From
Ted Nyman
Date
26 Jul 2026
Commit
b1262a537b6c
Patches
1

Trace2 showed fetch negotiation but not the time spent downloading packfile URIs.

Add one Trace2 region around the downloads and record the number of advertised packfiles. This exposes external download time without emitting a separate tracing event for every pack.

[11]

pack-bitmap: weight graph paths by dominated history

cooking here
From
Taylor Blau
Date
14 Jul 2026
Patches
5

Bitmap selection undervalued merge commits that expose large amounts of repository history.

Choose bitmap commits based on the history they make reachable rather than path length alone. The measured build fell from 984.73 seconds to 200.06 seconds while both runs selected the same 578 bitmaps.

984.73 s MIDX bitmap write

200.06 s MIDX bitmap write

[12]

parallel-checkout: trace per-worker load

cooking here
From
Taylor Blau
Date
20 Jul 2026
Patches
2

Parallel checkout reported collisions but not how work was distributed among workers.

Record each worker's item count, bytes, failures, elapsed time, and slowest item when Trace2 is enabled. These counters show whether a long checkout comes from uneven work or one unusually slow file.

[13]

dir: skip recursively valid empty UNTR subtrees

cooking here
From
Taylor Blau
Date
23 Jul 2026

Git reopened cached directories even after confirming they contained no untracked files.

Reuse cached empty directories after confirming that their contents and ignore rules have not changed. A modified .gitignore still triggers the normal directory checks.

[14]

read-cache: decode TREE and UNTR in parallel

cooking here
From
Taylor Blau
Date
21 Jul 2026

Git decoded its cache-tree and untracked-cache index extensions one after the other.

Decode the two independent extensions in parallel when enough index workers are available. Use the additional worker only for large extensions and leave split-index assembly unaffected.

[15]

fsmonitor: bind daemon queries to their worktree

cooking here
From
Taylor Blau
Date
10 Jul 2026

Linked worktrees could ask the wrong filesystem-monitor daemon for change history.

Associate each daemon query with the correct worktree before using its results. Check both the canonical worktree path and its filesystem identity so linked checkouts cannot share the wrong history.

[16]

fsmonitor: invalidate attributes for directory events

cooking here
From
Taylor Blau
Date
24 Jul 2026

A changed directory could leave outdated .gitattributes rules cached.

Refresh cached attributes when a filesystem-monitor event affects tracked files in that directory. Unrelated directory events keep their existing fallback behavior.

[17]

status: recheck filesystem changes after scanning

cooking here
From
Taylor Blau
Date
29 Jul 2026

Files could change while git status was scanning the worktree.

Check the filesystem monitor again after the scan so changes during the scan are not missed. If the monitor reports an intervening edit, repeat the affected scan instead of trusting the earlier result.

[18]

status: track configuration before reusing clean results

cooking here
From
Taylor Blau
Date
10 Jul 2026

A cached clean status becomes invalid when relevant Git configuration changes.

Track settings that affect status and file conversion, and discard cached results when those settings change. Keep unrelated configuration changes from invalidating an otherwise usable result.

[19]

attr: track external attribute files

cooking here
From
Taylor Blau
Date
10 Jul 2026

Global, system, and repository attributes can change how Git interprets tracked files.

Track those attribute files and their locations before reusing an earlier status result. Include missing files and replaced directories so a changed attribute source cannot go unnoticed.

[20]

status: hold external attributes stable across refresh

cooking here
From
Taylor Blau
Date
20 Jul 2026

An external attributes file could be replaced between its initial check and the later status scan.

Use the same snapshot of external attributes throughout the scan. This prevents Git from checking the index against one set of rules and collecting status against another.

[21]

commit: recheck filesystem changes after pre-commit hooks

cooking here
From
Taylor Blau
Date
21 Jul 2026

A pre-commit hook can modify a tracked file after Git has already refreshed its index.

Check the filesystem monitor again after the hook so later status does not reuse stale results. This also catches edits that preserve the file's size and modification time.

[22]

t7529: cover APFS directory and root replacement

cooking here
From
Taylor Blau
Date
28 Jul 2026

A directory or worktree root can be replaced while an APFS scan is running.

Pause the scan, replace either a child directory or the worktree root, and confirm Git rejects the collected results. Normal status then falls back to a fresh filesystem scan.

[23]

status: avoid checking bulk-scan results twice

cooking here
From
Taylor Blau
Date
23 Jul 2026

A bulk scan already detects deleted files and size changes that git status otherwise checks again.

Reuse already detected deletions and size changes instead of rediscovering them later. Continue inspecting files whose metadata changed without clearly establishing whether their contents changed.

[24]

dir: reject oversized pattern files before allocation

cooking here
From
Taylor Blau
Date
24 Jul 2026

Git allocated memory for ignore and attribute files before rejecting files larger than 100 MiB.

Check file size before allocation to avoid wasted memory and allocation failures. Preserve the existing warning and retain the later size check for inputs read from the index.

[25]

status: reuse complete APFS untracked preload results

cooking here
From
Taylor Blau
Date
21 Jul 2026

Git status walked the worktree twice: once during APFS preload and again to find untracked files.

Reuse untracked-file results from the completed scan when the same ignore rules still apply. Keep the ordinary directory walk for changed ignore files, nested repositories, and unsupported reporting modes.

[26]

preload-index: enable bulk scans on Linux

cooking here
From
Taylor Blau
Date
21 Jul 2026

Linux needed one backend to coordinate bulk filesystem scans and their safety checks.

Combine directory enumeration, file metadata, anchored opens, and filesystem checks before accepting scan results. Limit the fast path to supported Linux filesystems and fall back when a required system feature is missing.

[27]

status: refresh index metadata after content checks

cooking here
From
Taylor Blau
Date
21 Jul 2026

Git rechecked unchanged file contents because refreshed metadata was not written back to the index.

Update index metadata after a successful content check when Git holds the index lock. Later status runs can then trust the refreshed file information instead of reading the same contents again.

[28]

status: recheck filesystem changes after bulk scans

cooking here
From
Taylor Blau
Date
29 Jul 2026

Files can change between a bulk content check and the final filesystem-monitor query.

Keep the scanned file descriptors and metadata available until the final filesystem-monitor check. Accept the results only after confirming that no concurrent worktree change invalidated the scan.

[29]

Documentation: describe cached clean status

cooking here
From
Taylor Blau
Date
21 Jul 2026

Document an optional .csts file that records a known-clean git status --porcelain=v2 result.

On a main APFS worktree, reuse the result only after checking the index, HEAD, configuration, attributes, ignore rules, and filesystem-monitor history. Missing, stale, or malformed cache files always fall back to ordinary status.

[30]

Merge the status optimization topics

cooking here
From
Taylor Blau
Date
29 Jul 2026
Patches
105

Combine the 18 git status topic branches into one 105-patch series.

Keep the filesystem-monitor, untracked-cache, bulk-scan, and index changes together without dropping their tests. Preserve the branch dependencies so all 105 patches remain represented at the integration tip.