Re: [PATCH v2 11/13] merge-tree: provide easy access to `ls-files -u` style info
From: Junio C Hamano <hidden>
Date: 2022-02-02 21:32:57
"Elijah Newren via GitGitGadget" [off-list ref] writes:
quoted hunk ↗ jump to hunk
@@ -450,7 +451,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->exclude_modes_oids_stages) + 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);
OK. The addition (and disabling of the deduping) is quite trivial. We do not even have to worry about line termination since the extra pieces of info are prepended to the pathname. Nice.
quoted hunk ↗ jump to hunk
@@ -485,6 +490,10 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix) N_("do a trivial merge only"), 't'), OPT_BOOL(0, "messages", &o.show_messages, N_("also show informational/conflict messages")), + OPT_BOOL_F('l', "exclude-modes-oids-stages", + &o.exclude_modes_oids_stages, + N_("list conflicted files without modes/oids/stages"), + PARSE_OPT_NONEG),
Why does "-l" give shorter output than without it? "-l" strongly hints a longer output than without, at least to me. Just wondering if this will not become a source of confusion to future scripting users.
OPT_END() };