MCPcopy
hub / github.com/sinclairtarget/git-who / CommitsWithOpts

Function CommitsWithOpts

internal/git/git.go:70–115  ·  view source on GitHub ↗

Returns a single-use iterator over commits identified by the given revisions and paths.

(
	ctx context.Context,
	revs []string,
	pathspecs []string,
	filters cmd.LogFilters,
	populateDiffs bool,
	configFiles config.SupplementalFiles,
)

Source from the content-addressed store, hash-verified

68// Returns a single-use iterator over commits identified by the given revisions
69// and paths.
70func CommitsWithOpts(
71 ctx context.Context,
72 revs []string,
73 pathspecs []string,
74 filters cmd.LogFilters,
75 populateDiffs bool,
76 configFiles config.SupplementalFiles,
77) (
78 iter.Seq[Commit],
79 func() error,
80) {
81 empty := slices.Values([]Commit{})
82
83 ignoreRevs, err := configFiles.IgnoreRevs()
84 if err != nil {
85 return empty, func() error { return err }
86 }
87
88 subprocess, err := cmd.RunLog(
89 ctx,
90 revs,
91 pathspecs,
92 filters,
93 populateDiffs,
94 configFiles.HasMailmap(),
95 )
96 if err != nil {
97 return empty, func() error { return err }
98 }
99
100 lines, finishLines := subprocess.StdoutNullDelimitedLines()
101 commits, finishCommits := ParseCommits(lines)
102 commits = SkipIgnored(commits, ignoreRevs)
103
104 finish := func() error {
105 iterErr := finishCommits()
106 iterErr = errors.Join(iterErr, finishLines())
107 if iterErr != nil {
108 return fmt.Errorf("error iterating commits: %v", iterErr)
109 }
110
111 return subprocess.Wait()
112 }
113
114 return commits, finish
115}
116
117func RevList(
118 ctx context.Context,

Callers 4

HistFunction · 0.92
TreeFunction · 0.92
TableFunction · 0.92
ParseFunction · 0.92

Calls 7

RunLogFunction · 0.92
ParseCommitsFunction · 0.85
SkipIgnoredFunction · 0.85
IgnoreRevsMethod · 0.80
HasMailmapMethod · 0.80
WaitMethod · 0.80

Tested by

no test coverage detected