Skip to content

Commit 2f6b1d1

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf5c057 commit 2f6b1d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3403,7 +3403,7 @@ int rearrange_squash(void)
34033403
struct subject2item_entry *entry;
34043404

34053405
next[i] = tail[i] = -1;
3406-
if (item->command >= TODO_EXEC) {
3406+
if (!item->commit || item->command == TODO_DROP) {
34073407
subjects[i] = NULL;
34083408
continue;
34093409
}

0 commit comments

Comments
 (0)