Skip to content

Commit 15a39ac

Browse files
committed
fix: fixupAll flag should take precedence over autorebase
When running `git node land <pr> --autorebase --fixupAll`, ncu should squash all the commits first, then ignore the `--autorebase` flag as there is only one commit left. Refs: nodejs/node#40696 (comment)
1 parent 9029c9c commit 15a39ac

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/landing_session.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ class LandingSession extends Session {
214214
}
215215

216216
return this.final();
217+
} else if (this.fixupAll) {
218+
cli.log(`There are ${subjects.length} commits in the PR. ` +
219+
'Attempting to fixup everything into first commit.');
220+
await runAsync('git', ['reset', '--soft', `HEAD~${subjects.length - 1}`]);
221+
await runAsync('git', ['commit', '--amend', '--no-edit']);
222+
return await this.amend() && this.final();
217223
} else if (this.autorebase && this.canAutomaticallyRebase(subjects)) {
218224
// Run git rebase in interactive mode with autosquash but without editor
219225
// so that it will perform everything automatically.
@@ -239,12 +245,6 @@ class LandingSession extends Session {
239245
cli.log(`Couldn't rebase ${count} commits in the PR automatically`);
240246
this.makeRebaseSuggestion(subjects);
241247
}
242-
} else if (this.fixupAll) {
243-
cli.log(`There are ${subjects.length} commits in the PR. ` +
244-
'Attempting to fixup everything into first commit.');
245-
await runAsync('git', ['reset', '--soft', `HEAD~${subjects.length - 1}`]);
246-
await runAsync('git', ['commit', '--amend', '--no-edit']);
247-
return await this.amend() && this.final();
248248
} else {
249249
this.makeRebaseSuggestion(subjects);
250250
}

0 commit comments

Comments
 (0)