Thread (1 message) 1 message, 1 author, 2018-10-12

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

From: Junio C Hamano <hidden>
Date: 2018-10-12 01:22:52

Stefan Beller [off-list ref] writes:
Noticed-by: Junio C Hamano [off-list ref]
Signed-off-by: Stefan Beller <redacted>
--- 


   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

quoted hunk
(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);
 	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help