Merge branch 'js/rebase-autosquash-double-fixup-fix'

"rebase -i" segfaulted when rearranging a sequence that has a
fix-up that applies another fix-up (which may or may not be a
fix-up of yet another step).

* js/rebase-autosquash-double-fixup-fix:
  rebase --autosquash: fix a potential segfault
This commit is contained in:
Junio C Hamano
2020-05-14 14:39:43 -07:00
2 changed files with 21 additions and 2 deletions

View File

@ -5385,10 +5385,13 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
todo_list->items[i].command =
starts_with(subject, "fixup!") ?
TODO_FIXUP : TODO_SQUASH;
if (next[i2] < 0)
if (tail[i2] < 0) {
next[i] = next[i2];
next[i2] = i;
else
} else {
next[i] = next[tail[i2]];
next[tail[i2]] = i;
}
tail[i2] = i;
} else if (!hashmap_get_from_hash(&subject2item,
strhash(subject), subject)) {