Skip to content

Use shared clone for checkouts, dissociate on bender clone - #308

Merged
micprog merged 1 commit into
masterfrom
shared-git
Jun 1, 2026
Merged

micprog merged 1 commit into
masterfrom
shared-git

Conversation

@micprog

@micprog micprog commented May 29, 2026

Copy link
Copy Markdown
Member

Clone git checkouts with --shared so they borrow objects from the bare git database via alternates instead of copying the full object store, making checkouts faster and smaller on disk.

Since the resulting checkout is no longer self-contained, bender clone now repacks the copied working directory (git repack -a -d) and removes the alternates link so the cloned-out repository is standalone.

@micprog
micprog requested a review from fischeti May 29, 2026 16:54

@fischeti fischeti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! Git is pretty smart in saving storage meaning local clones imply --local which will hardlink objects. This means cloning with --shared will mainly be useful if database and checkout are on different file systems.

The repack also makes sense to me. I was suprised that we do an actual copy of the repository and not another git clone, but I guess that's because the checkout can be dirty.

Clone git checkouts with `--shared` so they borrow objects from the bare
git database via alternates instead of copying the full object store,
making checkouts faster and smaller on disk.

Since the resulting checkout is no longer self-contained, `bender clone`
now repacks the copied working directory (`git repack -a -d`) and removes
the alternates link so the cloned-out repository is standalone.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@micprog
micprog merged commit 4a144c4 into master Jun 1, 2026
18 checks passed
@micprog
micprog deleted the shared-git branch June 1, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants