MCPcopy Index your code
hub / github.com/anomalyco/opencode / hasNewCommits

Function hasNewCommits

packages/opencode/src/cli/cmd/github.handler.ts:1144–1154  ·  view source on GitHub ↗
(base: string, head: string)

Source from the content-addressed store, hash-verified

1142 // Falls back to fetching from origin when local refs are missing
1143 // (common in shallow clones from actions/checkout).
1144 async function hasNewCommits(base: string, head: string) {
1145 const result = await gitStatus(["rev-list", "--count", `${base}..${head}`])
1146 if (result.exitCode !== 0) {
1147 console.log(`rev-list failed, fetching origin/${base}...`)
1148 await gitStatus(["fetch", "origin", base, "--depth=1"])
1149 const retry = await gitStatus(["rev-list", "--count", `origin/${base}..${head}`])
1150 if (retry.exitCode !== 0) return true // assume dirty if we can't tell
1151 return parseInt(retry.stdout.toString().trim()) > 0
1152 }
1153 return parseInt(result.stdout.toString().trim()) > 0
1154 }
1155
1156 async function assertPermissions() {
1157 // Only called for non-schedule events, so actor is defined

Callers 1

createPRFunction · 0.85

Calls 2

gitStatusFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected