feat: allow local repo reference clones to save disk

Use git --reference-if-able when a local repo is provided so rigs and crew share objects without changing remotes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Dan Shapiro
2026-01-02 22:30:39 -08:00
parent 386dbf85fb
commit 4727f5079f
9 changed files with 240 additions and 14 deletions

View File

@@ -44,8 +44,9 @@ func TestRigsConfigRoundTrip(t *testing.T) {
Version: 1,
Rigs: map[string]RigEntry{
"gastown": {
GitURL: "git@github.com:steveyegge/gastown.git",
AddedAt: time.Now().Truncate(time.Second),
GitURL: "git@github.com:steveyegge/gastown.git",
LocalRepo: "/tmp/local-repo",
AddedAt: time.Now().Truncate(time.Second),
BeadsConfig: &BeadsConfig{
Repo: "local",
Prefix: "gt-",
@@ -74,6 +75,9 @@ func TestRigsConfigRoundTrip(t *testing.T) {
if rig.BeadsConfig == nil || rig.BeadsConfig.Prefix != "gt-" {
t.Errorf("BeadsConfig.Prefix = %v, want 'gt-'", rig.BeadsConfig)
}
if rig.LocalRepo != "/tmp/local-repo" {
t.Errorf("LocalRepo = %q, want %q", rig.LocalRepo, "/tmp/local-repo")
}
}
func TestAgentStateRoundTrip(t *testing.T) {
@@ -140,6 +144,7 @@ func TestRigConfigRoundTrip(t *testing.T) {
original := NewRigConfig("gastown", "git@github.com:test/gastown.git")
original.CreatedAt = time.Now().Truncate(time.Second)
original.Beads = &BeadsConfig{Prefix: "gt-"}
original.LocalRepo = "/tmp/local-repo"
if err := SaveRigConfig(path, original); err != nil {
t.Fatalf("SaveRigConfig: %v", err)
@@ -162,6 +167,9 @@ func TestRigConfigRoundTrip(t *testing.T) {
if loaded.GitURL != "git@github.com:test/gastown.git" {
t.Errorf("GitURL = %q, want expected URL", loaded.GitURL)
}
if loaded.LocalRepo != "/tmp/local-repo" {
t.Errorf("LocalRepo = %q, want %q", loaded.LocalRepo, "/tmp/local-repo")
}
if loaded.Beads == nil || loaded.Beads.Prefix != "gt-" {
t.Error("Beads.Prefix not preserved")
}