From: Johannes Schindelin Date: Wed, 25 Apr 2018 12:28:25 +0000 (+0200) Subject: sequencer: make rearrange_squash() a bit more obvious X-Git-Tag: v2.18.0-rc0~48^2~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2f6b1d13aa730901fe328fc2d88f208ea44d4f9e sequencer: make rearrange_squash() a bit more obvious There are some commands that have to be skipped from rearranging by virtue of not handling any commits. However, the logic was not quite obvious: it skipped commands based on their position in the enum todo_command. Instead, let's make it explicit that we skip all commands that do not handle any commit. With one exception: the `drop` command, because it, well, drops the commit and is therefore not eligible to rearranging. Note: this is a bit academic at the moment because the only time we call `rearrange_squash()` is directly after generating the todo list, when we have nothing but `pick` commands anyway. However, the upcoming `merge` command *will* want to be handled by that function, and it *can* handle commits. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/sequencer.c b/sequencer.c index 674e26bf82..c131e39fa9 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3403,7 +3403,7 @@ int rearrange_squash(void) struct subject2item_entry *entry; next[i] = tail[i] = -1; - if (item->command >= TODO_EXEC) { + if (!item->commit || item->command == TODO_DROP) { subjects[i] = NULL; continue; }