Skip to content

Commit 3a427ee

Browse files
authored
feat(git-node): suggest abort previous session (#1042)
1 parent 25082a4 commit 3a427ee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

components/git/land.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ async function main(state, argv, cli, dir) {
189189
cli.warn(
190190
'Failed to detect previous session. ' +
191191
'please run `git node land --abort`');
192+
cli.setErrorCode(1);
192193
return;
193194
}
194195

@@ -197,10 +198,11 @@ async function main(state, argv, cli, dir) {
197198
cli.warn(
198199
'Previous `git node land` session for ' +
199200
`${session.pullName} in progress.`);
200-
cli.log('run `git node land --abort` before starting a new session');
201-
return;
201+
const response = await cli.prompt('Do you want to abort it?', { defaultAnswer: false });
202+
if (!response) throw new Error('Please run `git node land --abort`');
203+
await session.abort();
204+
session = new LandingSession(cli, req, dir, argv);
202205
}
203-
session = new LandingSession(cli, req, dir, argv);
204206
const metadata = await getMetadata(session.argv, argv.skipRefs, cli);
205207
return session.start(metadata);
206208
} else if (state === APPLY) {

0 commit comments

Comments
 (0)