(repositoryUrl, branch, ciBranch, execaOptions)
| 104 | * @param {Object} [execaOpts] Options to pass to `execa`. |
| 105 | */ |
| 106 | export async function fetch(repositoryUrl, branch, ciBranch, execaOptions) { |
| 107 | const isDetachedHead = |
| 108 | (await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], { ...execaOptions, reject: false })).stdout === "HEAD"; |
| 109 | |
| 110 | try { |
| 111 | await execa( |
| 112 | "git", |
| 113 | [ |
| 114 | "fetch", |
| 115 | "--unshallow", |
| 116 | "--tags", |
| 117 | ...(branch === ciBranch && !isDetachedHead |
| 118 | ? [repositoryUrl] |
| 119 | : ["--update-head-ok", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]), |
| 120 | ], |
| 121 | execaOptions |
| 122 | ); |
| 123 | } catch { |
| 124 | await execa( |
| 125 | "git", |
| 126 | [ |
| 127 | "fetch", |
| 128 | "--tags", |
| 129 | ...(branch === ciBranch && !isDetachedHead |
| 130 | ? [repositoryUrl] |
| 131 | : ["--update-head-ok", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]), |
| 132 | ], |
| 133 | execaOptions |
| 134 | ); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Unshallow the git repository if necessary and fetch all the notes. |
no outgoing calls
no test coverage detected
searching dependent graphs…