Returns an iterator over commits that skips any revs in the given list.
( commits iter.Seq[Commit], ignoreRevs []string, )
| 272 | |
| 273 | // Returns an iterator over commits that skips any revs in the given list. |
| 274 | func SkipIgnored( |
| 275 | commits iter.Seq[Commit], |
| 276 | ignoreRevs []string, |
| 277 | ) iter.Seq[Commit] { |
| 278 | ignoreSet := map[string]bool{} |
| 279 | for _, rev := range ignoreRevs { |
| 280 | ignoreSet[rev] = true |
| 281 | } |
| 282 | |
| 283 | return func(yield func(Commit) bool) { |
| 284 | for commit := range commits { |
| 285 | if shouldIgnore := ignoreSet[commit.Hash]; shouldIgnore { |
| 286 | continue // skip this commit |
| 287 | } |
| 288 | |
| 289 | if !yield(commit) { |
| 290 | break |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | } |