Use `git cherry` to determine which commits are/are not in main branch

1f1f24ef0caf6c55c4503fc03bfb2241d15de000

Tucker McKnight <tmcknight@instructure.com> | Sat Sep 12 2026

Use `git cherry` to determine which commits are/are not in main branch
src/repos.ts:189
Before
188
189
190
191
192
193
      return getRefShaAndFileList(tag, 'tag', repoName, repoLocation)
    }))

    const branchesWithCompareToInfo: Repository['branches'] = branches.map((branch) => {
      const branchDescription = branchesAndTags.branches.find(branchToAdd => branchToAdd.name === branch.name)
      const compareTo = branchDescription.compareTo || reposConfig.repos[repoName].defaultBranch
      const compareToBranch = branches.find((test) => test.name === compareTo)
After
188
189
190
191
192
193
      return getRefShaAndFileList(tag, 'tag', repoName, repoLocation)
    }))

    const branchesWithCompareToInfo: Repository['branches'] = await Promise.all(branches.map(async (branch) => {
      const branchDescription = branchesAndTags.branches.find(branchToAdd => branchToAdd.name === branch.name)
      const compareTo = branchDescription.compareTo || reposConfig.repos[repoName].defaultBranch
      const compareToBranch = branches.find((test) => test.name === compareTo)
src/repos.ts:210
Before
209
210
211

212
213
214


215
216
217
218
219
220

      // 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 = Array.from(thisBranchCommits).filter((thisBranchCommit) => {
        return !commits.get(thisBranchCommit).isMerge && !compareToBranchCommits.has(thisBranchCommit)
      }).length
⁣
⁣
      const onlyInCompareToBranch = Array.from(compareToBranchCommits).filter((compareToBranchCommit) => {
        return !commits.get(compareToBranchCommit).isMerge && !thisBranchCommits.has(compareToBranchCommit)
      }).length

      const compareToInfo = {
        ahead: onlyInThisBranch,
        behind: onlyInCompareToBranch,
After
209
210
211
212


213
214
215


216

217
218

      // 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 = (await exec(`git -C ${repoLocation} cherry ${compareTo} ${branch.name}`))
⁣
⁣
                              .stdout.split('\n').filter(line => !line.startsWith('-') && line !== '').length

      const onlyInCompareToBranch = (await exec(`git -C ${repoLocation} cherry ${branch.name} ${compareTo}`))
⁣
⁣
                                      .stdout.trim().split('\n').filter(line => !line.startsWith('-') && line !== '').length
⁣
      const compareToInfo = {
        ahead: onlyInThisBranch,
        behind: onlyInCompareToBranch,
src/repos.ts:224
Before
223
224
225
226
227
228
      }

      return {...branch, ...compareToInfo}
    })

    cachedRepos.push({
      name: repoName,
After
223
224
225
226
227
228
      }

      return {...branch, ...compareToInfo}
    }))

    cachedRepos.push({
      name: repoName,