Skip to content

Commit

Permalink
Merge pull request #143 from argos-ci/use-update-head-ok-to-fetch-branch
Browse files Browse the repository at this point in the history
fix: fix branch fetching on CircleCI
  • Loading branch information
gregberge authored Aug 29, 2024
2 parents 7043d16 + 2ae4b37 commit f54e3c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/ci-environment/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ function getMergeBaseCommitShaWithDepth(input: {
head: string;
depth: number;
}): string | null {
const head = input.head || `HEAD`;
try {
execSync(`git fetch origin ${head}:${head} --depth ${input.depth}`);
execSync(
`git fetch origin ${input.base}:${input.base} --depth ${input.depth}`,
`git fetch --update-head-ok --depth ${input.depth} origin ${input.head}:${input.head}`,
);
const mergeBase = execSync(`git merge-base ${head} ${input.base}`)
execSync(
`git fetch --update-head-ok --depth ${input.depth} origin ${input.base}:${input.base}`,
);
const mergeBase = execSync(`git merge-base ${input.head} ${input.base}`)
.toString()
.trim();
return mergeBase || null;
Expand Down

0 comments on commit f54e3c2

Please sign in to comment.