Web lists-archives.com

Re: [PATCH 4/5] difftool: make --gui, --tool and --extcmd exclusive




On Mon, Apr 22, 2019 at 1:07 AM Denton Liu <liu.denton@xxxxxxxxx> wrote:
> In git-difftool, these options specify which tool to ultimately run. As
> a result, they are logically conflicting. Explicitly disallow these
> options from being used together.
>
> Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx>
> ---
> diff --git a/builtin/difftool.c b/builtin/difftool.c
> @@ -731,6 +731,15 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
> +       if (use_gui_tool)
> +               count++;
> +       if (difftool_cmd)
> +               count++;
> +       if (extcmd)
> +               count++;
> +       if (count > 1)
> +               die(_("--gui, --tool and --extcmd are exclusive"));

The more typical way to check this condition in this codebase is:

    if (use_gui_tool + !!difftool_cmd + !!extcmd > 1)
        die(...);

Also, I think you might want: s/exclusive/mutually &/