commitIteratorBFS function
Stream<GitCommit>
commitIteratorBFS({
- required ObjectStorage objStorage,
- required GitCommit from,
Implementation
Stream<GitCommit> commitIteratorBFS({
required ObjectStorage objStorage,
required GitCommit from,
}) async* {
var queue = Queue<GitHash>.from([from.hash]);
var seen = <GitHash>{};
while (queue.isNotEmpty) {
var hash = queue.removeFirst();
if (seen.contains(hash)) {
continue;
}
seen.add(hash);
var result = await objStorage.readCommit(hash);
var commit = result.get();
queue.addAll(commit.parents);
yield commit;
}
}