fix: use git ls-remote to verify if the remote branch is ahead

This commit is contained in:
Pierre Vanduynslager
2018-06-15 16:16:55 -04:00
parent 24a8052038
commit 2b6378f26f
6 changed files with 35 additions and 31 deletions
+7 -8
View File
@@ -56,17 +56,16 @@ async function run(options, plugins) {
options.repositoryUrl = await getGitAuthUrl(options);
if (!(await isBranchUpToDate(options.branch))) {
logger.log(
"The local branch %s is behind the remote one, therefore a new version won't be published.",
options.branch
);
return false;
}
try {
await verifyAuth(options.repositoryUrl, options.branch);
} catch (err) {
if (!(await isBranchUpToDate(options.repositoryUrl, options.branch))) {
logger.log(
"The local branch %s is behind the remote one, therefore a new version won't be published.",
options.branch
);
return false;
}
logger.error(`The command "${err.cmd}" failed with the error message %s.`, err.stderr);
throw getError('EGITNOPERMISSION', {options});
}