[WIP] add ahead/behind commit count for branches. Something is currently broken here.

e0741812ba2deb68e548d35f48b78c5dc1ede665

Tucker McKnight | Mon Jan 19 2026

[WIP] add ahead/behind commit count for branches. Something is currently broken here.
main.ts:317
Before
317
After
317
  console.log(flatFilesData.filter(entry => entry.file.includes('njk')))
src/repos.ts:117
Before
117
After
117

    branches.forEach((branch) => {
      const branchDescription = branchesToAdd.find(branchToAdd => branchToAdd.name === branch.name)
      const compareTo = branchDescription.compareTo || reposConfig.repos[repoName].defaultBranch
      const compareToBranch = branches.find((test) => test.name = compareTo)

      const compareToBranchCommits = new Set()
      let currentCommit = commits.get(compareToBranch.head)
      while (currentCommit !== undefined) {
        compareToBranchCommits.add(currentCommit.hash)
        currentCommit = commits.get(currentCommit.parent)
      }

      const thisBranchCommits = new Set()
      currentCommit = commits.get(branch.head)
      while (currentCommit !== undefined) {
        thisBranchCommits.add(currentCommit.hash)
        currentCommit = commits.get(currentCommit.parent)
      }

      // At this point, we have all commits in the compareTo branch in one set, and
      // all commits from this branch in another set.
      const onlyInThisBranch = thisBranchCommits.difference(compareToBranchCommits).size
      const onlyInCompareToBranch = compareToBranchCommits.difference(thisBranchCommits).size
      
      branch['ahead'] = onlyInThisBranch
      branch['behind'] = onlyInCompareToBranch
      branch['compareTo'] = compareTo
    })
src/vcses/git/operations.ts:9
Before
9
After
9
  if (branchName === 'main') {
    console.log(files)
  }
tsconfig.json:6
Before
6
    "lib": ["es2023", "dom"],
After
6
    "lib": ["esnext", "dom"],