]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.c
rebase -i: fix SIGSEGV when 'merge <branch>' fails
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 15 Aug 2018 09:39:35 +0000 (10:39 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Aug 2018 15:54:50 +0000 (08:54 -0700)
commitbc9238bb0910f6d21e021e5c3061bf2124c3a176
tree2dbaa5e5e6e7a0e5e3e4be774d210df7713b6358
parentd54e18986291474f077283c9d4cb5e970e1373a4
rebase -i: fix SIGSEGV when 'merge <branch>' fails

If a merge command in the todo list specifies just a branch to merge
with no -C/-c argument then item->commit is NULL. This means that if
there are merge conflicts error_with_patch() is passed a NULL commit
which causes a segmentation fault when make_patch() tries to look it up.

This commit implements a minimal fix which fixes the crash and allows
the user to successfully commit a conflict resolution with 'git rebase
--continue'. It does not write .git/rebase-merge/patch,
.git/rebase-merge/stopped-sha or update REBASE_HEAD. To sensibly get the
hashes of the merge parents would require refactoring do_merge() to
extract the code that parses the merge parents into a separate function
which error_with_patch() could then use to write the parents into the
stopped-sha file. To create meaningful output make_patch() and 'git
rebase --show-current-patch' would also need to be modified to diff the
merge parent and merge base in this case.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3430-rebase-merges.sh