Skip to content

Commit

Permalink
fix lint violations.
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri committed Nov 20, 2020
1 parent 39f5ac9 commit 045d3dc
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions source/git-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports.currentBranch = async () => {
};

exports.verifyCurrentBranchIsReleaseBranch = async releaseBranch => {
const expectedBranch = await exports.defaultBranch();
const expectedBranch = await exports.defaultBranch(releaseBranch);
const currentBranch = await exports.currentBranch();
if (!expectedBranch === currentBranch) {
throw new Error(`Not on \`${expectedBranch}\` branch. Use --any-branch to publish anyway, or set a different release branch using --branch.`);
Expand Down Expand Up @@ -135,24 +135,26 @@ exports.tagExistsOnRemote = async tagName => {

exports.defaultBranch = async options => {
if (options.releaseBranch) {
return releaseBranch;
return options.releaseBranch;
}

for (branch of ['main', 'master', 'gh-pages']) {
for (const branch of ['main', 'master', 'gh-pages']) {
try {
await execa("git", [
"show-ref",
"--verify",
"--quiet",
`refs/heads/${branch}`,
// eslint-disable-next-line no-await-in-loop
await execa('git', [
'show-ref',
'--verify',
'--quiet',
`refs/heads/${branch}`
]);
return branch;
} catch (err) {}
} catch {}
}

throw new Error(
"Could not determine a default branch. Please specify one via --branch."
'Could not determine a default branch. Please specify one via --branch.'
);
}
};

exports.verifyTagDoesNotExistOnRemote = async tagName => {
if (await exports.tagExistsOnRemote(tagName)) {
Expand Down

0 comments on commit 045d3dc

Please sign in to comment.