* 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
()
| 21 | * @return {string} |
| 22 | */ |
| 23 | function 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 |
no test coverage detected