diff options
author | Elijah Newren <newren@gmail.com> | 2022-06-18 02:20:58 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-23 01:10:06 +0200 |
commit | 7c48b27822b280222be1df7ec9f9e98d688f933b (patch) | |
tree | 0d2a9f250d1d1a0671bec02ed630bef9877e940e /builtin/merge-tree.c | |
parent | merge-ort: optionally produce machine-readable output (diff) | |
download | git-7c48b27822b280222be1df7ec9f9e98d688f933b.tar.xz git-7c48b27822b280222be1df7ec9f9e98d688f933b.zip |
merge-tree: allow `ls-files -u` style info to be NUL terminated
Much as `git ls-files` has a -z option, let's add one to merge-tree so
that the conflict-info section can be NUL terminated (and avoid quoting
of unusual filenames).
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-tree.c')
-rw-r--r-- | builtin/merge-tree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index b3c5692498..c159e31774 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -445,7 +445,7 @@ static int real_merge(struct merge_tree_options *o, if (o->show_messages == -1) o->show_messages = !result.clean; - puts(oid_to_hex(&result.tree->object.oid)); + printf("%s%c", oid_to_hex(&result.tree->object.oid), line_termination); if (!result.clean) { struct string_list conflicted_files = STRING_LIST_INIT_NODUP; const char *last = NULL; @@ -494,6 +494,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix) N_("do a trivial merge only"), MODE_TRIVIAL), OPT_BOOL(0, "messages", &o.show_messages, N_("also show informational/conflict messages")), + OPT_SET_INT('z', NULL, &line_termination, + N_("separate paths with the NUL character"), '\0'), OPT_BOOL_F(0, "name-only", &o.name_only, N_("list filenames without modes/oids/stages"), |