MCPcopy
hub / github.com/semantic-release/semantic-release / fetch

Function fetch

lib/git.js:106–136  ·  view source on GitHub ↗
(repositoryUrl, branch, ciBranch, execaOptions)

Source from the content-addressed store, hash-verified

104 * @param {Object} [execaOpts] Options to pass to `execa`.
105 */
106export 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.

Callers 2

index.jsFile · 0.90
git.test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…