diff --git a/lib/git.js b/lib/git.js index 4a746edc..29d10f92 100644 --- a/lib/git.js +++ b/lib/git.js @@ -1,8 +1,5 @@ const execa = require('execa'); const debug = require('debug')('semantic-release:git'); -const envCi = require('env-ci'); - -const timeout = envCi().isCi ? 10000 : 0; /** * Get the commit sha for a given tag. @@ -13,7 +10,7 @@ const timeout = envCi().isCi ? 10000 : 0; */ async function gitTagHead(tagName) { try { - return await execa.stdout('git', ['rev-list', '-1', tagName], {timeout}); + return await execa.stdout('git', ['rev-list', '-1', tagName]); } catch (err) { debug(err); } @@ -24,7 +21,7 @@ async function gitTagHead(tagName) { * @throws {Error} If the `git` command fails. */ async function gitTags() { - return (await execa.stdout('git', ['tag'], {timeout})) + return (await execa.stdout('git', ['tag'])) .split('\n') .map(tag => tag.trim()) .filter(tag => Boolean(tag)); @@ -39,7 +36,7 @@ async function gitTags() { */ async function isRefInHistory(ref) { try { - return (await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], {timeout})).code === 0; + return (await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'])).code === 0; } catch (err) { debug(err); } @@ -49,14 +46,14 @@ async function isRefInHistory(ref) { * Unshallow the git repository (retriving every commits and tags). */ async function unshallow() { - await execa('git', ['fetch', '--unshallow', '--tags'], {reject: false, timeout}); + await execa('git', ['fetch', '--unshallow', '--tags'], {reject: false}); } /** * @return {string} the sha of the HEAD commit. */ async function gitHead() { - return execa.stdout('git', ['rev-parse', 'HEAD'], {timeout}); + return execa.stdout('git', ['rev-parse', 'HEAD']); } /** @@ -64,7 +61,7 @@ async function gitHead() { */ async function repoUrl() { try { - return await execa.stdout('git', ['remote', 'get-url', 'origin'], {timeout}); + return await execa.stdout('git', ['remote', 'get-url', 'origin']); } catch (err) { debug(err); } @@ -75,7 +72,7 @@ async function repoUrl() { */ async function isGitRepo() { try { - return (await execa('git', ['rev-parse', '--git-dir'], {timeout})).code === 0; + return (await execa('git', ['rev-parse', '--git-dir'])).code === 0; } catch (err) { debug(err); } @@ -91,7 +88,7 @@ async function isGitRepo() { */ async function verifyAuth(origin, branch) { try { - return (await execa('git', ['push', '--dry-run', origin, `HEAD:${branch}`], {timeout})).code === 0; + return (await execa('git', ['push', '--dry-run', origin, `HEAD:${branch}`])).code === 0; } catch (err) { debug(err); } @@ -104,7 +101,7 @@ async function verifyAuth(origin, branch) { * @throws {Error} if the tag creation failed. */ async function tag(tagName) { - await execa('git', ['tag', tagName], {timeout}); + await execa('git', ['tag', tagName]); } /** @@ -115,7 +112,7 @@ async function tag(tagName) { * @throws {Error} if the push failed. */ async function push(origin, branch) { - await execa('git', ['push', '--tags', origin, `HEAD:${branch}`], {timeout}); + await execa('git', ['push', '--tags', origin, `HEAD:${branch}`]); } /** @@ -126,7 +123,7 @@ async function push(origin, branch) { */ async function verifyTagName(tagName) { try { - return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`], {timeout})).code === 0; + return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`])).code === 0; } catch (err) { debug(err); }