5import (
6 "context"
7▶ "errors"
8 "fmt"
9 "io"
· · ·
126// collected --depth commits. iter.ForEach surfaces whatever the callback
127// returns, so we can compare it back at the call site directly.
128▶var errStopIter = errors.New("history: stop iteration")
129
130// Bucketing divides [From, To] into N equal time slices. Used by the timeline
· · ·
202// (newest first → oldest first), and feeds every commit's first-parent diff
203// to the observer.
204▶func runHistory(repoPath string, observer CommitObserver) (HistoryWindow, error) {
205 // Turn GC back on because we have no idea how much we are about to process
206 EnableGc()
· · ·
208 repo, err := openRepository(repoPath)
209 if err != nil {
210▶ return HistoryWindow{}, fmt.Errorf("open git repository: %w", err)
211 }
212
· · ·
214 if err != nil {
215 // An unborn HEAD (freshly initialised, no commits yet) and a HEAD we
216▶ // simply could not resolve are the same error here, and there is no
217 // signal to tell them apart: both are a symbolic HEAD naming a ref
218 // that does not exist. So say what we actually know rather than
+ 16 more matches in this file