aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib
diff options
context:
space:
mode:
authorNevena Bojovic <nenabojov@gmail.com>2022-03-01 20:05:50 +0100
committerNevena Bojovic <nenabojov@gmail.com>2022-03-01 20:05:50 +0100
commit291803c31f829fe0d32bb3207bc11def95a7408c (patch)
treec7d43107d79291b19d8c9eceefbe91c9f9a52acf /sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib
parent1fa69862057db4db53cfda5be9c24b4228ef63f7 (diff)
Urađena test aplikacija. Povezan front i back.
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/clone.js163
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/errors.js36
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/find.js15
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/index.js9
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is-clean.js6
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is.js6
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/lines-to-revs.js141
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/make-error.js33
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/opts.js12
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/proc-log.js21
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/revs.js28
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/spawn.js43
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/utils.js3
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/which.js16
14 files changed, 532 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/clone.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/clone.js
new file mode 100644
index 00000000..6754fd76
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/clone.js
@@ -0,0 +1,163 @@
+// The goal here is to minimize both git workload and
+// the number of refs we download over the network.
+//
+// Every method ends up with the checked out working dir
+// at the specified ref, and resolves with the git sha.
+
+// Only certain whitelisted hosts get shallow cloning.
+// Many hosts (including GHE) don't always support it.
+// A failed shallow fetch takes a LOT longer than a full
+// fetch in most cases, so we skip it entirely.
+// Set opts.gitShallow = true/false to force this behavior
+// one way or the other.
+const shallowHosts = new Set([
+ 'github.com',
+ 'gist.github.com',
+ 'gitlab.com',
+ 'bitbucket.com',
+ 'bitbucket.org'
+])
+// we have to use url.parse until we add the same shim that hosted-git-info has
+// to handle scp:// urls
+const { parse } = require('url') // eslint-disable-line node/no-deprecated-api
+const { basename, resolve } = require('path')
+
+const revs = require('./revs.js')
+const spawn = require('./spawn.js')
+const { isWindows } = require('./utils.js')
+
+const pickManifest = require('npm-pick-manifest')
+const fs = require('fs')
+const mkdirp = require('mkdirp')
+
+module.exports = (repo, ref = 'HEAD', target = null, opts = {}) =>
+ revs(repo, opts).then(revs => clone(
+ repo,
+ revs,
+ ref,
+ resolveRef(revs, ref, opts),
+ target || defaultTarget(repo, opts.cwd),
+ opts
+ ))
+
+const maybeShallow = (repo, opts) => {
+ if (opts.gitShallow === false || opts.gitShallow) {
+ return opts.gitShallow
+ }
+ return shallowHosts.has(parse(repo).host)
+}
+
+const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) =>
+ resolve(cwd, basename(repo.replace(/[/\\]?\.git$/, '')))
+
+const clone = (repo, revs, ref, revDoc, target, opts) => {
+ if (!revDoc) {
+ return unresolved(repo, ref, target, opts)
+ }
+ if (revDoc.sha === revs.refs.HEAD.sha) {
+ return plain(repo, revDoc, target, opts)
+ }
+ if (revDoc.type === 'tag' || revDoc.type === 'branch') {
+ return branch(repo, revDoc, target, opts)
+ }
+ return other(repo, revDoc, target, opts)
+}
+
+const resolveRef = (revs, ref, opts) => {
+ const { spec = {} } = opts
+ ref = spec.gitCommittish || ref
+ /* istanbul ignore next - will fail anyway, can't pull */
+ if (!revs) {
+ return null
+ }
+ if (spec.gitRange) {
+ return pickManifest(revs, spec.gitRange, opts)
+ }
+ if (!ref) {
+ return revs.refs.HEAD
+ }
+ if (revs.refs[ref]) {
+ return revs.refs[ref]
+ }
+ if (revs.shas[ref]) {
+ return revs.refs[revs.shas[ref][0]]
+ }
+ return null
+}
+
+// pull request or some other kind of advertised ref
+const other = (repo, revDoc, target, opts) => {
+ const shallow = maybeShallow(repo, opts)
+
+ const fetchOrigin = ['fetch', 'origin', revDoc.rawRef]
+ .concat(shallow ? ['--depth=1'] : [])
+
+ const git = (args) => spawn(args, { ...opts, cwd: target })
+ return mkdirp(target)
+ .then(() => git(['init']))
+ .then(() => isWindows(opts)
+ ? git(['config', '--local', '--add', 'core.longpaths', 'true'])
+ : null)
+ .then(() => git(['remote', 'add', 'origin', repo]))
+ .then(() => git(fetchOrigin))
+ .then(() => git(['checkout', revDoc.sha]))
+ .then(() => updateSubmodules(target, opts))
+ .then(() => revDoc.sha)
+}
+
+// tag or branches. use -b
+const branch = (repo, revDoc, target, opts) => {
+ const args = [
+ 'clone',
+ '-b',
+ revDoc.ref,
+ repo,
+ target,
+ '--recurse-submodules'
+ ]
+ if (maybeShallow(repo, opts)) { args.push('--depth=1') }
+ if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') }
+ return spawn(args, opts).then(() => revDoc.sha)
+}
+
+// just the head. clone it
+const plain = (repo, revDoc, target, opts) => {
+ const args = [
+ 'clone',
+ repo,
+ target,
+ '--recurse-submodules'
+ ]
+ if (maybeShallow(repo, opts)) { args.push('--depth=1') }
+ if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') }
+ return spawn(args, opts).then(() => revDoc.sha)
+}
+
+const updateSubmodules = (target, opts) => new Promise(resolve =>
+ fs.stat(target + '/.gitmodules', er => {
+ if (er) {
+ return resolve(null)
+ }
+ return resolve(spawn([
+ 'submodule',
+ 'update',
+ '-q',
+ '--init',
+ '--recursive'
+ ], { ...opts, cwd: target }))
+ }))
+
+const unresolved = (repo, ref, target, opts) => {
+ // can't do this one shallowly, because the ref isn't advertised
+ // but we can avoid checking out the working dir twice, at least
+ const lp = isWindows(opts) ? ['--config', 'core.longpaths=true'] : []
+ const cloneArgs = ['clone', '--mirror', '-q', repo, target + '/.git']
+ const git = (args) => spawn(args, { ...opts, cwd: target })
+ return mkdirp(target)
+ .then(() => git(cloneArgs.concat(lp)))
+ .then(() => git(['init']))
+ .then(() => git(['checkout', ref]))
+ .then(() => updateSubmodules(target, opts))
+ .then(() => git(['rev-parse', '--revs-only', 'HEAD']))
+ .then(({ stdout }) => stdout.trim())
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/errors.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/errors.js
new file mode 100644
index 00000000..25b2b9f9
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/errors.js
@@ -0,0 +1,36 @@
+
+const maxRetry = 3
+
+class GitError extends Error {
+ shouldRetry () {
+ return false
+ }
+}
+
+class GitConnectionError extends GitError {
+ constructor (message) {
+ super('A git connection error occurred')
+ }
+
+ shouldRetry (number) {
+ return number < maxRetry
+ }
+}
+
+class GitPathspecError extends GitError {
+ constructor (message) {
+ super('The git reference could not be found')
+ }
+}
+
+class GitUnknownError extends GitError {
+ constructor (message) {
+ super('An unknown git error occurred')
+ }
+}
+
+module.exports = {
+ GitConnectionError,
+ GitPathspecError,
+ GitUnknownError
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/find.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/find.js
new file mode 100644
index 00000000..d58f01db
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/find.js
@@ -0,0 +1,15 @@
+const is = require('./is.js')
+const { dirname } = require('path')
+
+module.exports = async ({ cwd = process.cwd() } = {}) => {
+ if (await is({ cwd })) {
+ return cwd
+ }
+ while (cwd !== dirname(cwd)) {
+ cwd = dirname(cwd)
+ if (await is({ cwd })) {
+ return cwd
+ }
+ }
+ return null
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/index.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/index.js
new file mode 100644
index 00000000..20d7cfd0
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/index.js
@@ -0,0 +1,9 @@
+module.exports = {
+ clone: require('./clone.js'),
+ revs: require('./revs.js'),
+ spawn: require('./spawn.js'),
+ is: require('./is.js'),
+ find: require('./find.js'),
+ isClean: require('./is-clean.js'),
+ errors: require('./errors.js')
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is-clean.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is-clean.js
new file mode 100644
index 00000000..182373be
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is-clean.js
@@ -0,0 +1,6 @@
+const spawn = require('./spawn.js')
+
+module.exports = (opts = {}) =>
+ spawn(['status', '--porcelain=v1', '-uno'], opts)
+ .then(res => !res.stdout.trim().split(/\r?\n+/)
+ .map(l => l.trim()).filter(l => l).length)
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is.js
new file mode 100644
index 00000000..e2542f21
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/is.js
@@ -0,0 +1,6 @@
+// not an airtight indicator, but a good gut-check to even bother trying
+const { promisify } = require('util')
+const fs = require('fs')
+const stat = promisify(fs.stat)
+module.exports = ({ cwd = process.cwd() } = {}) =>
+ stat(cwd + '/.git').then(() => true, () => false)
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/lines-to-revs.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/lines-to-revs.js
new file mode 100644
index 00000000..9f879ca2
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/lines-to-revs.js
@@ -0,0 +1,141 @@
+// turn an array of lines from `git ls-remote` into a thing
+// vaguely resembling a packument, where docs are a resolved ref
+
+const semver = require('semver')
+
+module.exports = lines => finish(lines.reduce(linesToRevsReducer, {
+ versions: {},
+ 'dist-tags': {},
+ refs: {},
+ shas: {}
+}))
+
+const finish = revs => distTags(shaList(peelTags(revs)))
+
+// We can check out shallow clones on specific SHAs if we have a ref
+const shaList = revs => {
+ Object.keys(revs.refs).forEach(ref => {
+ const doc = revs.refs[ref]
+ if (!revs.shas[doc.sha]) {
+ revs.shas[doc.sha] = [ref]
+ } else {
+ revs.shas[doc.sha].push(ref)
+ }
+ })
+ return revs
+}
+
+// Replace any tags with their ^{} counterparts, if those exist
+const peelTags = revs => {
+ Object.keys(revs.refs).filter(ref => ref.endsWith('^{}')).forEach(ref => {
+ const peeled = revs.refs[ref]
+ const unpeeled = revs.refs[ref.replace(/\^\{\}$/, '')]
+ if (unpeeled) {
+ unpeeled.sha = peeled.sha
+ delete revs.refs[ref]
+ }
+ })
+ return revs
+}
+
+const distTags = revs => {
+ // not entirely sure what situations would result in an
+ // ichabod repo, but best to be careful in Sleepy Hollow anyway
+ const HEAD = revs.refs.HEAD || /* istanbul ignore next */ {}
+ const versions = Object.keys(revs.versions)
+ versions.forEach(v => {
+ // simulate a dist-tags with latest pointing at the
+ // 'latest' branch if one exists and is a version,
+ // or HEAD if not.
+ const ver = revs.versions[v]
+ if (revs.refs.latest && ver.sha === revs.refs.latest.sha) {
+ revs['dist-tags'].latest = v
+ } else if (ver.sha === HEAD.sha) {
+ revs['dist-tags'].HEAD = v
+ if (!revs.refs.latest) { revs['dist-tags'].latest = v }
+ }
+ })
+ return revs
+}
+
+const refType = ref => {
+ if (ref.startsWith('refs/tags/')) {
+ return 'tag'
+ }
+ if (ref.startsWith('refs/heads/')) {
+ return 'branch'
+ }
+ if (ref.startsWith('refs/pull/')) {
+ return 'pull'
+ }
+ if (ref === 'HEAD') {
+ return 'head'
+ }
+ // Could be anything, ignore for now
+ /* istanbul ignore next */
+ return 'other'
+}
+
+// return the doc, or null if we should ignore it.
+const lineToRevDoc = line => {
+ const split = line.trim().split(/\s+/, 2)
+ if (split.length < 2) { return null }
+
+ const sha = split[0].trim()
+ const rawRef = split[1].trim()
+ const type = refType(rawRef)
+
+ if (type === 'tag') {
+ // refs/tags/foo^{} is the 'peeled tag', ie the commit
+ // that is tagged by refs/tags/foo they resolve to the same
+ // content, just different objects in git's data structure.
+ // But, we care about the thing the tag POINTS to, not the tag
+ // object itself, so we only look at the peeled tag refs, and
+ // ignore the pointer.
+ // For now, though, we have to save both, because some tags
+ // don't have peels, if they were not annotated.
+ const ref = rawRef.substr('refs/tags/'.length)
+ return { sha, ref, rawRef, type }
+ }
+
+ if (type === 'branch') {
+ const ref = rawRef.substr('refs/heads/'.length)
+ return { sha, ref, rawRef, type }
+ }
+
+ if (type === 'pull') {
+ // NB: merged pull requests installable with #pull/123/merge
+ // for the merged pr, or #pull/123 for the PR head
+ const ref = rawRef.substr('refs/'.length).replace(/\/head$/, '')
+ return { sha, ref, rawRef, type }
+ }
+
+ if (type === 'head') {
+ const ref = 'HEAD'
+ return { sha, ref, rawRef, type }
+ }
+
+ // at this point, all we can do is leave the ref un-munged
+ return { sha, ref: rawRef, rawRef, type }
+}
+
+const linesToRevsReducer = (revs, line) => {
+ const doc = lineToRevDoc(line)
+
+ if (!doc) { return revs }
+
+ revs.refs[doc.ref] = doc
+ revs.refs[doc.rawRef] = doc
+
+ if (doc.type === 'tag') {
+ // try to pull a semver value out of tags like `release-v1.2.3`
+ // which is a pretty common pattern.
+ const match = !doc.ref.endsWith('^{}') &&
+ doc.ref.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)$/)
+ if (match && semver.valid(match[1], true)) {
+ revs.versions[semver.clean(match[1], true)] = doc
+ }
+ }
+
+ return revs
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/make-error.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/make-error.js
new file mode 100644
index 00000000..043a8e6e
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/make-error.js
@@ -0,0 +1,33 @@
+const {
+ GitConnectionError,
+ GitPathspecError,
+ GitUnknownError
+} = require('./errors.js')
+
+const connectionErrorRe = new RegExp([
+ 'remote error: Internal Server Error',
+ 'The remote end hung up unexpectedly',
+ 'Connection timed out',
+ 'Operation timed out',
+ 'Failed to connect to .* Timed out',
+ 'Connection reset by peer',
+ 'SSL_ERROR_SYSCALL',
+ 'The requested URL returned error: 503'
+].join('|'))
+
+const missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/
+
+function makeError (er) {
+ const message = er.stderr
+ let gitEr
+ if (connectionErrorRe.test(message)) {
+ gitEr = new GitConnectionError(message)
+ } else if (missingPathspecRe.test(message)) {
+ gitEr = new GitPathspecError(message)
+ } else {
+ gitEr = new GitUnknownError(message)
+ }
+ return Object.assign(gitEr, er)
+}
+
+module.exports = makeError
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/opts.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/opts.js
new file mode 100644
index 00000000..144e0a3a
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/opts.js
@@ -0,0 +1,12 @@
+// Values we want to set if they're not already defined by the end user
+// This defaults to accepting new ssh host key fingerprints
+const gitEnv = {
+ GIT_ASKPASS: 'echo',
+ GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new'
+}
+module.exports = (opts = {}) => ({
+ stdioString: true,
+ ...opts,
+ shell: false,
+ env: opts.env || { ...gitEnv, ...process.env }
+})
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/proc-log.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/proc-log.js
new file mode 100644
index 00000000..b2bdd9dc
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/proc-log.js
@@ -0,0 +1,21 @@
+// default logger.
+// emits 'log' events on the process
+const LEVELS = [
+ 'notice',
+ 'error',
+ 'warn',
+ 'info',
+ 'verbose',
+ 'http',
+ 'silly',
+ 'pause',
+ 'resume'
+]
+
+const log = level => (...args) => process.emit('log', level, ...args)
+
+const logger = {}
+for (const level of LEVELS) {
+ logger[level] = log(level)
+}
+module.exports = logger
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/revs.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/revs.js
new file mode 100644
index 00000000..81059594
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/revs.js
@@ -0,0 +1,28 @@
+const pinflight = require('promise-inflight')
+const spawn = require('./spawn.js')
+const LRU = require('lru-cache')
+
+const revsCache = new LRU({
+ max: 100,
+ maxAge: 5 * 60 * 1000
+})
+
+const linesToRevs = require('./lines-to-revs.js')
+
+module.exports = async (repo, opts = {}) => {
+ if (!opts.noGitRevCache) {
+ const cached = revsCache.get(repo)
+ if (cached) {
+ return cached
+ }
+ }
+
+ return pinflight(`ls-remote:${repo}`, () =>
+ spawn(['ls-remote', repo], opts)
+ .then(({ stdout }) => linesToRevs(stdout.trim().split('\n')))
+ .then(revs => {
+ revsCache.set(repo, revs)
+ return revs
+ })
+ )
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/spawn.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/spawn.js
new file mode 100644
index 00000000..1c89a4c5
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/spawn.js
@@ -0,0 +1,43 @@
+const spawn = require('@npmcli/promise-spawn')
+const promiseRetry = require('promise-retry')
+const makeError = require('./make-error.js')
+const whichGit = require('./which.js')
+const makeOpts = require('./opts.js')
+const procLog = require('./proc-log.js')
+
+module.exports = (gitArgs, opts = {}) => {
+ const gitPath = whichGit(opts)
+
+ if (gitPath instanceof Error) { return Promise.reject(gitPath) }
+
+ // undocumented option, mostly only here for tests
+ const args = opts.allowReplace || gitArgs[0] === '--no-replace-objects'
+ ? gitArgs
+ : ['--no-replace-objects', ...gitArgs]
+
+ const log = opts.log || procLog
+ let retry = opts.retry
+ if (retry === null || retry === undefined) {
+ retry = {
+ retries: opts.fetchRetries || 2,
+ factor: opts.fetchRetryFactor || 10,
+ maxTimeout: opts.fetchRetryMaxtimeout || 60000,
+ minTimeout: opts.fetchRetryMintimeout || 1000
+ }
+ }
+ return promiseRetry((retry, number) => {
+ if (number !== 1) {
+ log.silly('git', `Retrying git command: ${
+ args.join(' ')} attempt # ${number}`)
+ }
+
+ return spawn(gitPath, args, makeOpts(opts))
+ .catch(er => {
+ const gitError = makeError(er)
+ if (!gitError.shouldRetry(number)) {
+ throw gitError
+ }
+ retry(gitError)
+ })
+ }, retry)
+}
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/utils.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/utils.js
new file mode 100644
index 00000000..fcd9578a
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/utils.js
@@ -0,0 +1,3 @@
+const isWindows = opts => (opts.fakePlatform || process.platform) === 'win32'
+
+exports.isWindows = isWindows
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/which.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/which.js
new file mode 100644
index 00000000..a2f690e1
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/which.js
@@ -0,0 +1,16 @@
+const which = require('which')
+
+let gitPath
+try {
+ gitPath = which.sync('git')
+} catch (e) {}
+
+module.exports = (opts = {}) => {
+ if (opts.git) {
+ return opts.git
+ }
+ if (!gitPath || opts.git === false) {
+ return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' })
+ }
+ return gitPath
+}