merge-tree: provide easy access to ls-files -u
style info
Much like `git merge` updates the index with information of the form (mode, oid, stage, name) provide this output for conflicted files for merge-tree as well. Provide a --name-only option for users to exclude the mode, oid, and stage and only get the list of conflicted filenames. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
7fa3338870
commit
b520bc6caa
@ -400,6 +400,7 @@ enum mode {
|
||||
struct merge_tree_options {
|
||||
int mode;
|
||||
int show_messages;
|
||||
int name_only;
|
||||
};
|
||||
|
||||
static int real_merge(struct merge_tree_options *o,
|
||||
@ -453,7 +454,11 @@ static int real_merge(struct merge_tree_options *o,
|
||||
merge_get_conflicted_files(&result, &conflicted_files);
|
||||
for (i = 0; i < conflicted_files.nr; i++) {
|
||||
const char *name = conflicted_files.items[i].string;
|
||||
if (last && !strcmp(last, name))
|
||||
struct stage_info *c = conflicted_files.items[i].util;
|
||||
if (!o->name_only)
|
||||
printf("%06o %s %d\t",
|
||||
c->mode, oid_to_hex(&c->oid), c->stage);
|
||||
else if (last && !strcmp(last, name))
|
||||
continue;
|
||||
write_name_quoted_relative(
|
||||
name, prefix, stdout, line_termination);
|
||||
@ -488,6 +493,10 @@ 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_BOOL_F(0, "name-only",
|
||||
&o.name_only,
|
||||
N_("list filenames without modes/oids/stages"),
|
||||
PARSE_OPT_NONEG),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user