git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff.c: die on unknown color-moved ws mode

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 12, 2018, 01:22 UTC
Message-ID
<xmqqin28dkm1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181011225928.76051-1-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 17 quoted lines
> Noticed-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> --- 
>
>
>    There is no "ignore-any" supported by the feature---I think that
>    the parser for the option should have noticed and barfed, but it
>    did not.  It merely emitted a message to the standard output and
>    let it scroll away with the huge diff before the reader noticed
>    it.
>    
> Addressed in this patch.
>
>    Am I missing something [...] ?
>
> Note that this parsing is used for both the parsing from command line
> as well as options, i.e.

Hmph, is it our convention for a value that is not yet known to the current version of Git found in a configuration file to cause it to die? I somehow thought that command line options are checked more strictly and configuration variables are parsed more leniently.

If that is the case, the place that dies need to be raised in the callchain; iow, instead of dying inside the parser, it is necessary to let it only detect a problem and allow the caller to decide what to do with the problem, I would think.

>   git config diff.colorMovedWS asdf
>   git format-patch HEAD^
> fatal: ignoring unknown color-moved-ws mode 'asdf'
>   git config --unset diff.colorMovedWS
Show 19 quoted lines
>
> (format-patch parses these color specific things, but doesn't apply it)
>    
>  diff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/diff.c b/diff.c
> index 145cfbae59..bdf4535d69 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -313,7 +313,7 @@ static int parse_color_moved_ws(const char *arg)
>  		else if (!strcmp(sb.buf, "allow-indentation-change"))
>  			ret |= COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE;
>  		else
> -			error(_("ignoring unknown color-moved-ws mode '%s'"), sb.buf);
> +			die(_("ignoring unknown color-moved-ws mode '%s'"), sb.buf);
>  
>  		strbuf_release(&sb);
>  	}
Previous: Stefan BellerNext: Stefan Beller
Message 14 of 34 in “What's cooking in git.git (Oct 2018, #01; Wed, 10)”
  1. Junio C HamanoOct 10, 2018
  2. Ævar Arnfjörð BjarmasonOct 10, 2018
  3. Jeff KingOct 10, 2018
  4. builtin stash/rebase, was Re: What's cooking in git.git (Oct 2018, #01; Wed, 10)Johannes Schindelin, Oct 10, 2018
  5. Junio C HamanoOct 10, 2018
  6. Junio C HamanoOct 11, 2018
  7. js/mingw-wants-vista-or-above, was Re: What's cooking in git.git (Oct 2018, #01; Wed, 10)Johannes Schindelin, Oct 10, 2018
  8. Junio C HamanoOct 10, 2018
  9. Phillip WoodOct 10, 2018
  10. Junio C HamanoOct 11, 2018
  11. Junio C HamanoOct 11, 2018
  12. diff.c: die on unknown color-moved ws modeStefan Beller, Oct 11, 2018
  13. Stefan BellerOct 11, 2018
  14. Junio C HamanoOct 12, 2018
  15. Stefan BellerOct 11, 2018
  16. Junio C HamanoOct 12, 2018
  17. Phillip WoodOct 12, 2018
  18. Junio C HamanoOct 12, 2018
  19. Phillip WoodOct 16, 2018
  20. Stefan BellerOct 16, 2018
  21. Thomas GummererOct 10, 2018
  22. Junio C HamanoOct 11, 2018
  23. `--rebase-merges' still failing badlyMichael Witten, Oct 10, 2018
  24. Michael WittenOct 10, 2018
  25. Junio C HamanoOct 10, 2018
  26. Michael WittenOct 11, 2018
  27. Johannes SchindelinOct 12, 2018
  28. Stefan BellerOct 10, 2018
  29. Junio C HamanoOct 11, 2018
  30. Tim SchumacherOct 10, 2018
  31. Johannes SixtOct 10, 2018
  32. Junio C HamanoOct 11, 2018
  33. Derrick StoleeOct 11, 2018
  34. Duy NguyenOct 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.