Ævar Arnfjörð Bjarmason <[email protected]> writes:

> This is bad:
>
>     $ ./git --exec-path=$PWD -c diff.colorMoved=crap show
>     fatal: unable to parse 'diff.colormoved' from command-line config
>
> Fixed with:
>
>     diff --git a/diff.c b/diff.c
>     index 7cae4f1ddb..036dbc1c3c 100644
>     --- a/diff.c
>     +++ b/diff.c
>     @@ -278,7 +278,7 @@ int git_diff_ui_config(const char *var, const char 
> *value, void *cb)
>             if (!strcmp(var, "diff.colormoved")) {
>                     int cm = parse_color_moved(value);
>                     if (cm < 0)
>     -                       return -1;
>     +                       die("bad --color-moved argument: %s", value);
>                     diff_color_moved_default = cm;
>                     return 0;
>             }

You would want to model this after an existing practice nearby.

    $ git -c color.diff.new=frotz diff
    error: error: invalid color value: frotz
    fatal: unable to parse 'color.diff.new' from command-line config

It could be argued that it would even be better to show "here is the
list of valid values the configuration takes", but generally we do
not do that in other configuration variables.

Reply via email to