Skip to content

Commit

Permalink
fix: check missing config in Session ctor (nodejs#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere authored May 30, 2020
1 parent 75abd3a commit 7dc544d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions components/git/land.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ module.exports = {

async function main(state, argv, cli, req, dir) {
let session = new LandingSession(cli, req, dir);
if (session.warnForMissing()) {
return;
}

if (state !== AMEND && state !== CONTINUE && session.warnForWrongBranch()) {
return;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class Session {

const { upstream, owner, repo } = this;

if (this.warnForMissing()) {
throw new Error('Failed to create new session');
}

const upstreamHref = runSync('git', [
'config', '--get',
`remote.${upstream}.url`]).trim();
Expand Down
3 changes: 0 additions & 3 deletions lib/sync_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ class SyncSession extends Session {
}

async sync() {
if (this.warnForMissing()) {
return;
}
if (this.warnForWrongBranch()) {
return;
}
Expand Down

0 comments on commit 7dc544d

Please sign in to comment.