MCPcopy
hub / github.com/ampproject/amphtml / gitBranchCreationPoint

Function gitBranchCreationPoint

build-system/common/git.js:23–31  ·  view source on GitHub ↗

* Returns the commit at which the current PR branch was forked off of the main * branch. During CI, there is an additional merge commit, so we must pick the * first of the boundary commits (prefixed with a -) returned by git rev-list. * On local branches, this is merge base of the current branch

()

Source from the content-addressed store, hash-verified

21 * @return {string}
22 */
23function gitBranchCreationPoint() {
24 if (isPullRequestBuild()) {
25 const prSha = ciPullRequestSha();
26 return getStdout(
27 `git rev-list --boundary ${prSha}...origin/main | grep "^-" | head -n 1 | cut -c2-`
28 ).trim();
29 }
30 return gitMergeBaseLocalMain();
31}
32
33/**
34 * Returns the main branch parent of the merge commit (current HEAD) during CI

Callers 2

printChangeSummaryFunction · 0.85
gitDiffCommitLogFunction · 0.85

Calls 4

isPullRequestBuildFunction · 0.85
ciPullRequestShaFunction · 0.85
getStdoutFunction · 0.85
gitMergeBaseLocalMainFunction · 0.85

Tested by

no test coverage detected