Re: What's cooking in git.git (Jun 2017, #06; Thu, 22)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 24, 2017, 00:33 UTC
- Message-ID
- <xmqqa84yb4x7.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <871sqajrgi.fsf@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 20 quoted lines
> 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 configIt 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.