threads / discuss / 56181

Should "git apply"'s option "--3way" imply "--index" in option description?

Subject: Should "git apply"'s option "--3way" imply "--index" in option description?

## tl;dr

2 messages between Jul 30, 2021 and Jul 30, 2021.

replies: 1people: 2as markdown or json

lilinchao@oschina.cn· Jul 30, 2021, 08:32 UTC · lore
like this:
diff --git a/apply.c b/apply.c
index 44bc31d6eb..0b353af96c 100644
--- a/apply.c
+++ b/apply.c
@@ -5024,7 +5024,7 @@ int apply_parse_options(int argc, const char **argv,
                OPT_BOOL(0, "apply", force_apply,
                        N_("also apply the patch (use with --stat/--summary/--check)")),
                OPT_BOOL('3', "3way", &state->threeway,
-                        N_( "attempt three-way merge, fall back on normal patch if that fails")),
+                        N_( "attempt three-way merge, fall back on normal patch if that fails(implies --index)")),
                OPT_FILENAME(0, "build-fake-ancestor", &state->fake_ancestor,
                        N_("build a temporary index based on embedded index information")),
                /* Think twice before adding "--nul" synonym to this */
Junio C Hamano· Jul 30, 2021, 14:34 UTC · re: lilinchao@oschina.cn · lore

Re: Should "git apply"'s option "--3way" imply "--index" in option description?

"lilinchao@oschina.cn" <lilinchao@oschina.cn> writes:
Show 15 quoted lines
> like this:
>
> diff --git a/apply.c b/apply.c
> index 44bc31d6eb..0b353af96c 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -5024,7 +5024,7 @@ int apply_parse_options(int argc, const char **argv,
>                 OPT_BOOL(0, "apply", force_apply,
>                         N_("also apply the patch (use with --stat/--summary/--check)")),
>                 OPT_BOOL('3', "3way", &state->threeway,
> -                        N_( "attempt three-way merge, fall back on normal patch if that fails")),
> +                        N_( "attempt three-way merge, fall back on normal patch if that fails(implies --index)")),
>                 OPT_FILENAME(0, "build-fake-ancestor", &state->fake_ancestor,
>                         N_("build a temporary index based on embedded index information")),
>                 /* Think twice before adding "--nul" synonym to this */

It is not incorrect per-se, but because "--3way" implies "--index" only when "--cached" is not in effect, it may do more harm than it helps to mention only just the "--index" half of the story.

If we were to touch that line, I'd just chop off "if that fails" at the end---the phrase "fall back" already tells readers that it happens only when the non-fallback action does not work.

Thanks.

← back to recent threads