diff --git a/merge-ort.c b/merge-ort.c index e6622343347491..9eb518332188e2 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -557,6 +557,8 @@ enum conflict_and_info_types { * Keep this group _last_ other than NB_CONFLICT_TYPES */ CONFLICT_SUBMODULE_CORRUPT, + CONFLICT_THREEWAY_CONTENT_MERGE_FAILED, + CONFLICT_OBJECT_WRITE_FAILED, /* Keep this entry _last_ in the list */ NB_CONFLICT_TYPES, @@ -614,6 +616,10 @@ static const char *type_short_descriptions[] = { /* Something is seriously wrong; cannot even perform merge */ [CONFLICT_SUBMODULE_CORRUPT] = "CONFLICT (submodule corrupt)", + [CONFLICT_THREEWAY_CONTENT_MERGE_FAILED] = + "CONFLICT (three-way content merge failed)", + [CONFLICT_OBJECT_WRITE_FAILED] = + "CONFLICT (object write failed)", }; struct logical_conflict_info { @@ -2188,15 +2194,24 @@ static int handle_content_merge(struct merge_options *opt, pathnames, extra_marker_size, &result_buf); - if ((merge_status < 0) || !result_buf.ptr) - ret = error(_("failed to execute internal merge")); + if ((merge_status < 0) || !result_buf.ptr) { + path_msg(opt, CONFLICT_THREEWAY_CONTENT_MERGE_FAILED, 0, + pathnames[0], pathnames[1], pathnames[2], NULL, + _("failed to execute internal merge for %s"), + path); + ret = -1; + } if (!ret && write_object_file(result_buf.ptr, result_buf.size, - OBJ_BLOB, &result->oid)) - ret = error(_("unable to add %s to database"), path); - + OBJ_BLOB, &result->oid)) { + path_msg(opt, CONFLICT_OBJECT_WRITE_FAILED, 0, + pathnames[0], pathnames[1], pathnames[2], NULL, + _("unable to add %s to database"), path); + ret = -1; + } free(result_buf.ptr); + if (ret) return -1; if (merge_status > 0)