Skip to content

Commit

Permalink
Fix push repo for dist release
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Nov 12, 2018
1 parent 158274f commit 7e34aac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/git.js
@@ -1,3 +1,4 @@
const _ = require('lodash');
const { format } = require('./util');
const { run, runTemplateCommand } = require('./shell');
const { config } = require('./config');
Expand All @@ -19,7 +20,7 @@ const getBranchName = () => run('git rev-parse --abbrev-ref HEAD', { isReadOnly:
const tagExists = tag =>
run(`git show-ref --tags --quiet --verify -- "refs/tags/${tag}"`, { isReadOnly: true }).then(() => true, () => false);

const isRemoteName = remoteUrlOrName => !remoteUrlOrName.includes('/');
const isRemoteName = remoteUrlOrName => !_.includes(remoteUrlOrName, '/');

const getRemoteUrl = (remoteUrlOrName = 'origin') =>
isRemoteName(remoteUrlOrName)
Expand Down Expand Up @@ -90,7 +91,7 @@ const getLatestTag = () =>
);

const push = async ({ pushRepo = '', hasUpstreamBranch, args = '' } = {}) => {
const remoteName = isRemoteName(pushRepo) ? pushRepo : 'origin';
const remoteName = pushRepo && isRemoteName(pushRepo) ? pushRepo : 'origin';
const setUpstream = hasUpstreamBranch === false ? `-u ${remoteName} ${await getBranchName()}` : '';
const repository = setUpstream ? '' : invalidPushRepoRe.test(pushRepo) ? 'origin' : pushRepo;
return run(`git push --follow-tags ${args} ${repository} ${setUpstream}`);
Expand Down

0 comments on commit 7e34aac

Please sign in to comment.