merge-ort: optionally produce machine-readable output

With the new `detailed` parameter, a new mode can be triggered when
displaying the merge messages: The `detailed` mode prints NUL-delimited
fields of the following form:

	<path-count> NUL <path>... NUL <conflict-type> NUL <message>

The `<path-count>` field determines how many `<path>` fields there are.

The intention of this mode is to support server-side operations, where
worktree-less merges can lead to conflicts and depending on the type
and/or path count, the caller might know how to handle said conflict.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2022-06-18 00:20:57 +00:00
committed by Junio C Hamano
parent cb2607759e
commit de90581141
3 changed files with 23 additions and 3 deletions

View File

@ -468,7 +468,8 @@ static int real_merge(struct merge_tree_options *o,
}
if (o->show_messages) {
putchar(line_termination);
merge_display_update_messages(&opt, &result);
merge_display_update_messages(&opt, line_termination == '\0',
&result);
}
merge_finalize(&opt, &result);
return !result.clean; /* result.clean < 0 handled above */