From b14d19240bf8e42f30d5922aacec60b33045317c Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 28 May 2020 10:59:10 -0700 Subject: [PATCH] fix: check missing config in Session ctor --- components/git/land.js | 4 +--- lib/session.js | 4 ++++ lib/sync_session.js | 3 --- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/components/git/land.js b/components/git/land.js index 049f05c0..a9c2e6fa 100644 --- a/components/git/land.js +++ b/components/git/land.js @@ -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; } diff --git a/lib/session.js b/lib/session.js index 81087fa3..02d07c1a 100644 --- a/lib/session.js +++ b/lib/session.js @@ -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(); diff --git a/lib/sync_session.js b/lib/sync_session.js index 5a3af892..5c092088 100644 --- a/lib/sync_session.js +++ b/lib/sync_session.js @@ -9,9 +9,6 @@ class SyncSession extends Session { } async sync() { - if (this.warnForMissing()) { - return; - } if (this.warnForWrongBranch()) { return; }