MCPcopy
hub / github.com/peter-evans/create-pull-request / buildBranchCommits

Function buildBranchCommits

src/create-or-update-branch.ts:51–70  ·  view source on GitHub ↗
(
  git: GitCommandManager,
  base: string,
  branch: string
)

Source from the content-addressed store, hash-verified

49}
50
51export async function buildBranchCommits(
52 git: GitCommandManager,
53 base: string,
54 branch: string
55): Promise<Commit[]> {
56 const output = await git.exec(['log', '--format=%H', `${base}..${branch}`])
57 const shas = output.stdout
58 .split('\n')
59 .filter(x => x !== '')
60 .reverse()
61 const commits: Commit[] = []
62 for (const sha of shas) {
63 const commit = await git.getCommit(sha)
64 commits.push(commit)
65 for (const unparsedChange of commit.unparsedChanges) {
66 core.warning(`Skipping unexpected diff entry: ${unparsedChange}`)
67 }
68 }
69 return commits
70}
71
72// Return the number of commits that branch2 is ahead of branch1
73async function commitsAhead(

Callers 2

createOrUpdateBranchFunction · 0.85

Calls 3

execMethod · 0.80
pushMethod · 0.80
getCommitMethod · 0.45

Tested by

no test coverage detected