After switching to --mirror clones (#123), apply the git config settings from the design doc (#23) to optimize upload-pack serving.
Changes required
internal/gitclone/manager.go
Add a configureMirror() helper called after git clone --mirror succeeds in executeClone(). It should run git config for each of:
Protocol:
protocol.version 2
uploadpack.allowFilter true (already set, move into this helper)
uploadpack.allowReachableSHA1InWant true
Bitmaps (biggest win for upload-pack):
repack.writeBitmaps true
pack.useBitmaps true
pack.useBitmapBoundaryTraversal true
Commit graph (no --changed-paths; Bloom filters do not help upload-pack):
core.commitGraph true
gc.writeCommitGraph true
fetch.writeCommitGraph true
Multi-pack-index (avoids full repack on every fetch):
Never unpack loose — keep fetched objects as packs:
transfer.unpackLimit 1
fetch.unpackLimit 1
Disable auto GC — maintenance is explicit (see #125):
Pack performance:
pack.threads 0
pack.deltaCacheSize 512m
pack.windowMemory 1g
Existing repos
Also call configureMirror() for repos discovered by DiscoverExisting() on startup, so repos cloned before these settings existed get updated.
Tests
- Test that after clone, the expected git config values are set (read them back with
git config --get).
After switching to
--mirrorclones (#123), apply the git config settings from the design doc (#23) to optimizeupload-packserving.Changes required
internal/gitclone/manager.goAdd a
configureMirror()helper called aftergit clone --mirrorsucceeds inexecuteClone(). It should rungit configfor each of:Protocol:
protocol.version 2uploadpack.allowFilter true(already set, move into this helper)uploadpack.allowReachableSHA1InWant trueBitmaps (biggest win for upload-pack):
repack.writeBitmaps truepack.useBitmaps truepack.useBitmapBoundaryTraversal trueCommit graph (no --changed-paths; Bloom filters do not help upload-pack):
core.commitGraph truegc.writeCommitGraph truefetch.writeCommitGraph trueMulti-pack-index (avoids full repack on every fetch):
core.multiPackIndex trueNever unpack loose — keep fetched objects as packs:
transfer.unpackLimit 1fetch.unpackLimit 1Disable auto GC — maintenance is explicit (see #125):
gc.auto 0Pack performance:
pack.threads 0pack.deltaCacheSize 512mpack.windowMemory 1gExisting repos
Also call
configureMirror()for repos discovered byDiscoverExisting()on startup, so repos cloned before these settings existed get updated.Tests
git config --get).