From ffe1062830af0ad07d625edbc9a2073ef0da3ff7 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Thu, 29 Nov 2018 20:00:01 -0500 Subject: [PATCH] fix: remove unnecessary `branch` parameter from `push` function --- index.js | 2 +- lib/git.js | 3 +-- test/git.test.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 0bbfa087..8a77527a 100644 --- a/index.js +++ b/index.js @@ -107,7 +107,7 @@ async function run(context, plugins) { } else { // Create the tag before calling the publish plugins as some require the tag to exists await tag(nextRelease.gitTag, {cwd, env}); - await push(options.repositoryUrl, options.branch, {cwd, env}); + await push(options.repositoryUrl, {cwd, env}); logger.success(`Created tag ${nextRelease.gitTag}`); } diff --git a/lib/git.js b/lib/git.js index be0cdaa1..9aa65885 100644 --- a/lib/git.js +++ b/lib/git.js @@ -143,12 +143,11 @@ async function tag(tagName, execaOpts) { * Push to the remote repository. * * @param {String} repositoryUrl The remote repository URL. - * @param {String} branch The branch to push. * @param {Object} [execaOpts] Options to pass to `execa`. * * @throws {Error} if the push failed. */ -async function push(repositoryUrl, branch, execaOpts) { +async function push(repositoryUrl, execaOpts) { await execa('git', ['push', '--tags', repositoryUrl], execaOpts); } diff --git a/test/git.test.js b/test/git.test.js index 82d4b0b1..661e4ef4 100644 --- a/test/git.test.js +++ b/test/git.test.js @@ -157,7 +157,7 @@ test('Push tag to remote repository', async t => { const commits = await gitCommits(['Test commit'], {cwd}); await tag('tag_name', {cwd}); - await push(repositoryUrl, 'master', {cwd}); + await push(repositoryUrl, {cwd}); t.is(await gitRemoteTagHead(repositoryUrl, 'tag_name', {cwd}), commits[0].hash); }); @@ -171,7 +171,7 @@ test('Push tag to remote repository with remote branch ahaed', async t => { await gitPush('origin', 'master', {cwd: tmpRepo}); await tag('tag_name', {cwd}); - await push(repositoryUrl, 'master', {cwd}); + await push(repositoryUrl, {cwd}); t.is(await gitRemoteTagHead(repositoryUrl, 'tag_name', {cwd}), commits[0].hash); });