allAncestors method

Future<Set<GitHash>?> allAncestors(
  1. GitCommit start, {
  2. required GitCommit shouldNotContain,
})

Implementation

Future<Set<GitHash>?> allAncestors(
  GitCommit start, {
  required GitCommit shouldNotContain,
}) async {
  if (start.hash == shouldNotContain.hash) null;

  var all = <GitHash>{};
  var iter = commitIteratorBFS(objStorage: objStorage, from: start);
  await for (var commit in iter) {
    if (commit.hash == shouldNotContain.hash) {
      return null;
    }

    all.add(commit.hash);
  }

  return all;
}