Skip to content

Commit

Permalink
git-node: add a prompt for force landing commits with invalid message
Browse files Browse the repository at this point in the history
Makes it possible to land a commit that does not pass
the core-validate-commit checks in case there is a bug
in the validator.
  • Loading branch information
joyeecheung authored and priyank-p committed Jun 11, 2019
1 parent 412e68a commit 286a61e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/landing_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,23 @@ class LandingSession extends Session {
__dirname,
'../node_modules/.bin/core-validate-commit' + (isWindows ? '.cmd' : '')
);
await runAsync(validateCommand, stray);

try {
await forceRunAsync(validateCommand, stray, { ignoreFailure: false });
} catch (e) {
let forceLand = false;
if (e.code === 1) {
forceLand = await cli.prompt(
'The commit did not pass the validation. ' +
'Do you still want to land it?',
false);
}

if (!forceLand) {
cli.info('Please fix the commit message and try again.');
process.exit(1);
}
}

cli.separator();
cli.log('The following commits are ready to be pushed to ' +
Expand Down

0 comments on commit 286a61e

Please sign in to comment.