# Drop now-unused ReachesCommit wrapper

`97b33b2`·  
  
Soph·1mo ago·3 files·+4 added/-16 removed

PlanRef now calls CheckAncestry directly, leaving ReachesCommit with no production caller — only a benchmark used it. Point the benchmark at CheckAncestry and remove the wrapper rather than leave dead exported surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

## Sessions

cf5b16a42703View transcript

[?\just remove .clawpatch from the commit but then just delete the folder, we don't need to keep itClaude Code·Opus 4.8[1m]·5 steps](/content/gh/entireio/git-sync/session/f82fa48e-a8dd-42c8-a49a-7193b101bbf5#timeline-cf5b16a42703/index.html)

## Changes

3

- internal

- planner

- Mbenchmark_test.go+3/-3

- Mplanner.go-12

- syncer

- Mintegration_test.go+1/-1

```
104 unmodified lines

105
106
107
108
108
109
110
111
11 unmodified lines

123
124
125
126
126
127
128
129
130
130
131
132
133

104 unmodified lines

}
}

func BenchmarkReachesCommit(b *testing.B) {
func BenchmarkCheckAncestry(b *testing.B) {
    repo, err := git.Init(memory.NewStorage(), nil)
    if err != nil {
        b.Fatalf("init repo: %v", err)
    }
11 unmodified lines

b.ResetTimer()
    for range b.N {
        ok, err := ReachesCommit(repo.Storer, tip, root)
        result, err := CheckAncestry(repo.Storer, tip, root)
        if err != nil {
            b.Fatal(err)
        }
        if !ok {
            if result != AncestryReachable {
                b.Fatal("expected tip to reach root")
            }
        }
    }
```

Minternal/planner/benchmark_test.go+3/-3

```
497 unmodified lines

498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
501
502
503

497 unmodified lines

return AncestryUnreachable, nil
}

// ReachesCommit reports whether targetHash is provably an ancestor of
// startHash. It is a convenience wrapper over CheckAncestry for callers that
// only care about a definite fast-forward; AncestryIndeterminate is reported
// as false (not provably reachable).
func ReachesCommit(store storer.EncodedObjectStorer, startHash, targetHash plumbing.Hash) (bool, error) {
    result, err := CheckAncestry(store, startHash, targetHash)
    if err != nil {
        return false, err
    }
    return result == AncestryReachable, nil
}

// ObjectsToPush computes the set of objects that need to be sent to the target.
//
// A fetch with target refs as haves prunes the source pack server-side, so
```

Minternal/planner/planner.go-12

```
293 unmodified lines

294
295
296
297
297
298
299
300

293 unmodified lines

// TestRun_IntegrationKeepsLocalFetchWhenAncestryNeeded ensures the fetch is
// still performed for a fast-forward update where BuildPlans calls
// ReachesCommit on the local store. Skipping it would crash the planner.
// CheckAncestry on the local store. Skipping it would crash the planner.
func TestRun_IntegrationKeepsLocalFetchWhenAncestryNeeded(t *testing.T) {
    sourceRepo, sourceFS := newSourceRepo(t)
    makeCommits(t, sourceRepo, sourceFS, 2)
```

Minternal/syncer/integration_test.go+1/-1
