Skip to content

Apply mirror git config for serving performance #124

@alecthomas

Description

@alecthomas

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):

  • core.multiPackIndex true

Never unpack loose — keep fetched objects as packs:

  • transfer.unpackLimit 1
  • fetch.unpackLimit 1

Disable auto GC — maintenance is explicit (see #125):

  • gc.auto 0

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions