Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-06-18 03:20:58 +0300
committerJunio C Hamano <gitster@pobox.com>2022-06-23 02:10:06 +0300
commit7c48b27822b280222be1df7ec9f9e98d688f933b (patch)
tree0d2a9f250d1d1a0671bec02ed630bef9877e940e /builtin/merge-tree.c
parentde90581141a886a79cccd0d9adb76814f3e1ab2c (diff)
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.c4
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"),