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, )
| 68 | // Returns a single-use iterator over commits identified by the given revisions |
| 69 | // and paths. |
| 70 | func 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 | |
| 117 | func RevList( |
| 118 | ctx context.Context, |
no test coverage detected