5import (
6 "context"
7▶ "errors"
8 "fmt"
9 "io"
· · ·
125// collected --depth commits. iter.ForEach surfaces whatever the callback
126// returns, so we can compare it back at the call site directly.
127▶var errStopIter = errors.New("history: stop iteration")
128
129// Bucketing divides [From, To] into N equal time slices. Used by the timeline
· · ·
201// (newest first → oldest first), and feeds every commit's first-parent diff
202// to the observer.
203▶func runHistory(repoPath string, observer CommitObserver) (HistoryWindow, error) {
204 repo, err := git.PlainOpenWithOptions(repoPath, &git.PlainOpenOptions{DetectDotGit: true})
205 if err != nil {
· · ·
206▶ return HistoryWindow{}, fmt.Errorf("open git repository: %w", err)
207 }
208
· · ·
209 head, err := repo.Head()
210 if err != nil {
211▶ if errors.Is(err, plumbing.ErrReferenceNotFound) {
212 observer.Finalise(HistoryWindow{}, emptySnapshot())
213 return HistoryWindow{}, nil
+ 12 more matches in this file