merge-ort: fix segmentation fault in read-only repositories
commit0b55d930a69692c7f4e7b90e35fa41f6c46df4bc
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 28 Sep 2022 07:29:21 +0000 (28 07:29 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Sep 2022 15:49:27 +0000 (28 08:49 -0700)
treea0f5e2bed339d234b2d3f609b3221d7a29bc36a6
parent1b3d6e17fe83eb6f79ffbac2f2c61bbf1eaef5f8
merge-ort: fix segmentation fault in read-only repositories

If the blob/tree objects cannot be written, we really need the merge
operations to fail, and not to continue (and then try to access the tree
object which is however still set to `NULL`).

Let's stop ignoring the return value of `write_object_file()` and
`write_tree()` and set `clean = -1` in the error case.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c
t/t4301-merge-tree-write-tree.sh