Skip to content

Commit

Permalink
fix: remove execa timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Mar 20, 2018
1 parent dff0a34 commit 3c46455
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions lib/git.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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);
}
Expand All @@ -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));
Expand All @@ -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);
}
Expand All @@ -49,22 +46,22 @@ 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']);
}

/**
* @return {string} The value of the remote git URL.
*/
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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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]);
}

/**
Expand All @@ -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}`]);
}

/**
Expand All @@ -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);
}
Expand Down

0 comments on commit 3c46455

Please sign in to comment.