{"thread":{"id":"11464","subject":"[BUG] git-diff-* --color oddness","startedAt":"2008-01-04T08:14:29Z","lastAt":"2008-01-04T09:45:31Z","messageCount":12,"participants":["Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64415","messageId":"20080104081429.GA30635@coredump.intra.peff.net","threadId":"11464","inReplyTo":null,"subject":"[BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T08:14:29Z","receivedAt":"2008-01-04T08:14:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"I encountered some weirdness today with git-diff-{files,tree,index} and\n--color.  They parse the --color command line option, but do _not_ call\ngit_config(git_diff_ui_config), so if the user has colors specified in\nthe config, they are not used.\n\nOrdinarily, I would say \"nobody should use --color with diff-files\". But\nwe do, in git-add--interactive (see Wincent's 4af756f3). So we can\nprobably fix that with a \"git_diff_minimal_ui_config\" which does just\nthe colors, and use that from the plumbing diff scripts (or just move\nthe color stuff into git_default_config).\n\nBut it gets worse. Try this:\n\n  # make a custom color\n  git config color.diff.meta yellow\n  # now show a plumbing diff\n  git diff-tree --color -p 257f3020^ 257f3020\n\nThe first two lines of meta-info will be in the stock colors, but\neverything after will be in the custom colors. So we are actually\nreading the diff_ui options _during_ the diff. The culprit is\nfuncname_pattern, which calls read_config_if_needed.\n\nIt's my understanding that diff_ui_config is about porcelain diff\noptions, so it is a bit worrisome that in the middle of a plumbing diff\nprocess, we load porcelain config. Fortunately, most of them aren't\nlooked at except in diff_setup, which has already run. Colors actually\naffect globals which are used during the diff, and so are noticed.\n\nSo I think the best course is probably:\n  1. before v1.5.4, we need to fix the color handling in \"git-diff -i\",\n     either by declaring git-diff-files --color illegal and finding\n     another way to do 4af756f3, or by moving the diff color\n     functionality into the default config.\n\n  2. Probably post-v1.5.4, some thought should be given to\n     how the diff ui config is demand-loaded by\n     diff.c:read_config_if_needed. I don't _think_ it is a problem for\n     now except for the colors, because most parts just get used in\n     diff_setup. But it seems a bit flaky.\n\n-Peff\n"},{"id":"64416","messageId":"7vejcym21q.fsf@gitster.siamese.dyndns.org","threadId":"11464","inReplyTo":"20080104081429.GA30635@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T08:24:01Z","receivedAt":"2008-01-04T08:24:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I encountered some weirdness today with git-diff-{files,tree,index} and\n> --color.  They parse the --color command line option, but do _not_ call\n> git_config(git_diff_ui_config), so if the user has colors specified in\n> the config, they are not used.\n\nThis is very deliberate.  ui_config is about the Porcelains.\n\n> Ordinarily, I would say \"nobody should use --color with diff-files\". But\n> we do, in git-add--interactive (see Wincent's 4af756f3).\n\nThe plumbing deliberately not calling ui_config does not have\nanything to do with them supporting explicit --color options.\n"},{"id":"64417","messageId":"7vabnmm1ww.fsf@gitster.siamese.dyndns.org","threadId":"11464","inReplyTo":"20080104081429.GA30635@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T08:26:55Z","receivedAt":"2008-01-04T08:26:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> The first two lines of meta-info will be in the stock colors, but\n> everything after will be in the custom colors. So we are actually\n> reading the diff_ui options _during_ the diff. The culprit is\n> funcname_pattern, which calls read_config_if_needed.\n\nYuck.  Why is funcname_pattern do ui-config stuff?  I know it\nwants to get custom regexp crap, but that should belong to the\nplumbing part, not Porcelain-only thing, shouldn't it?\n"},{"id":"64418","messageId":"20080104082842.GA3300@coredump.intra.peff.net","threadId":"11464","inReplyTo":"7vejcym21q.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T08:28:42Z","receivedAt":"2008-01-04T08:28:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 12:24:01AM -0800, Junio C Hamano wrote:\n\n> > Ordinarily, I would say \"nobody should use --color with diff-files\". But\n> > we do, in git-add--interactive (see Wincent's 4af756f3).\n> \n> The plumbing deliberately not calling ui_config does not have\n> anything to do with them supporting explicit --color options.\n\nI'm not sure what you mean here. Are you saying that it is the desired\nbehavior for \"git-diff --color\" to use my color.diff.* variables, but\nfor \"git-diff-files --color\" not to?\n\nI think that's insane, and it makes \"git-add -i\" depending on\ngit-diff-file's colorization wrong (since in other parts it uses the\ncolor.diff.* variables).\n\nNot to mention the other bug (that diff-files _does_ read the config,\njust halfway through).\n\n-Peff\n"},{"id":"64420","messageId":"20080104083252.GB3300@coredump.intra.peff.net","threadId":"11464","inReplyTo":"7vabnmm1ww.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T08:32:52Z","receivedAt":"2008-01-04T08:32:52Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 12:26:55AM -0800, Junio C Hamano wrote:\n\n> > The first two lines of meta-info will be in the stock colors, but\n> > everything after will be in the custom colors. So we are actually\n> > reading the diff_ui options _during_ the diff. The culprit is\n> > funcname_pattern, which calls read_config_if_needed.\n> \n> Yuck.  Why is funcname_pattern do ui-config stuff?  I know it\n> wants to get custom regexp crap, but that should belong to the\n> plumbing part, not Porcelain-only thing, shouldn't it?\n\nIt's for user diff drivers, and it looks like the funcname pattern. Not\nsure why we want to demand-load that stuff at all...I wonder if it\nshould just go into git_default_config (or a git_basic_diff_config).\n\n-Peff\n"},{"id":"64422","messageId":"7v63yam1i9.fsf@gitster.siamese.dyndns.org","threadId":"11464","inReplyTo":"20080104082842.GA3300@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T08:35:42Z","receivedAt":"2008-01-04T08:35:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I'm not sure what you mean here. Are you saying that it is the desired\n> behavior for \"git-diff --color\" to use my color.diff.* variables, but\n> for \"git-diff-files --color\" not to?\n\nWhat I meant is \"git diff\" without --color can be colorized\nbecause of config but we should never allow \"git diff-files\"\nwithout --color to be colorized by user's config.  I realize\nthat you were talking about the choice of colors, which is a\ndifferent issue.\n\nI do not much care ;-), but I guess we would want to be\nconsistent.\n\n> Not to mention the other bug (that diff-files _does_ read the config,\n> just halfway through).\n\nThat one _is_ a bug.  diff-files should not be affected by\n\"diff.color = auto\" or somesuch in the config, even when the\nuser uses custom function header crap.\n"},{"id":"64425","messageId":"20080104084345.GA3472@coredump.intra.peff.net","threadId":"11464","inReplyTo":"7v63yam1i9.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T08:43:46Z","receivedAt":"2008-01-04T08:43:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 12:35:42AM -0800, Junio C Hamano wrote:\n\n> What I meant is \"git diff\" without --color can be colorized\n> because of config but we should never allow \"git diff-files\"\n> without --color to be colorized by user's config.  I realize\n> that you were talking about the choice of colors, which is a\n> different issue.\n> \n> I do not much care ;-), but I guess we would want to be\n> consistent.\n\nOK, yes, I knew that about diff.color already. But I think it is a bug\nto not use the user's colors in \"git add -i\", and I think the right fix\nis to make diff-files consistent in its color choices. Patch will\nfollow.\n\n> That one _is_ a bug.  diff-files should not be affected by\n> \"diff.color = auto\" or somesuch in the config, even when the\n> user uses custom function header crap.\n\nIt doesn't use it, actually, but I think that is a happy accident of the\nway most config options are used (i.e., we _do_ read and change the\nconfig, but we just never look at it again because we have done our\ndiff_setup). If you could provoke any of the diff plumbing to call\ndiff_setup twice, you would be in trouble (but even diff-tree --stdin\ndoesn't do that).\n\n-Peff\n"},{"id":"64426","messageId":"7vsl1ekmg5.fsf@gitster.siamese.dyndns.org","threadId":"11464","inReplyTo":"20080104083252.GB3300@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T08:46:18Z","receivedAt":"2008-01-04T08:46:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Jan 04, 2008 at 12:26:55AM -0800, Junio C Hamano wrote:\n>\n>> > The first two lines of meta-info will be in the stock colors, but\n>> > everything after will be in the custom colors. So we are actually\n>> > reading the diff_ui options _during_ the diff. The culprit is\n>> > funcname_pattern, which calls read_config_if_needed.\n>> \n>> Yuck.  Why is funcname_pattern do ui-config stuff?  I know it\n>> wants to get custom regexp crap, but that should belong to the\n>> plumbing part, not Porcelain-only thing, shouldn't it?\n>\n> It's for user diff drivers, and it looks like the funcname pattern. Not\n> sure why we want to demand-load that stuff at all...I wonder if it\n> should just go into git_default_config (or a git_basic_diff_config).\n\nYeah, moving some to the diff-basic-config sounds sane.\n\n * I'd prefer to keep low-level produce consistent diff that can\n   be reliably applied with git-apply without getting broken by\n   user configuration while Porcelain level diff can be tweaked\n   by the user to do whatever \"human readable\" crap they would\n   want to see on the screen (such as \"side by side\"), and my\n   gut feeling is that we should keep the user-level driver\n   definition in ui-config, never to affect plumbing.\n\n * using or not-using colors should stay in ui-config;\n\n * funcname-pattern can go either way; that affects what appears\n   at the end of @@ context @@ lines, and would not have risk to\n   corrupt the patch for plumbing.\n\n * color choice can also go either way, but probably is better\n   to be in the low-level.  Cnce color is used the output cannot\n   be fed sanely to patch or git-apply _anyway_ so we can be\n   sure that \"git diff-plumbing --color\" is run to produce human\n   readable output.\n"},{"id":"64427","messageId":"20080104085934.GA3706@coredump.intra.peff.net","threadId":"11464","inReplyTo":"7vsl1ekmg5.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T08:59:34Z","receivedAt":"2008-01-04T08:59:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 12:46:18AM -0800, Junio C Hamano wrote:\n\n> > It's for user diff drivers, and it looks like the funcname pattern. Not\n> > sure why we want to demand-load that stuff at all...I wonder if it\n> > should just go into git_default_config (or a git_basic_diff_config).\n> \n> Yeah, moving some to the diff-basic-config sounds sane.\n\nOK, below is a patch that fixes the color issues I was having.\n\n>  * I'd prefer to keep low-level produce consistent diff that can\n>    be reliably applied with git-apply without getting broken by\n>    user configuration while Porcelain level diff can be tweaked\n>    by the user to do whatever \"human readable\" crap they would\n>    want to see on the screen (such as \"side by side\"), and my\n>    gut feeling is that we should keep the user-level driver\n>    definition in ui-config, never to affect plumbing.\n\nOK. In that case, we need a way for the plumbing to tell the diff\nmachinery \"don't ever try loading the ui config.\"\n\n>  * using or not-using colors should stay in ui-config;\n\nAgreed.\n\n>  * funcname-pattern can go either way; that affects what appears\n>    at the end of @@ context @@ lines, and would not have risk to\n>    corrupt the patch for plumbing.\n\nI don't personally use this, so I don't care too much. But I am inclined\nto say low-level since it cannot break the patch (and it will be used\nand presented by porcelains like \"git add -i\").\n\n>  * color choice can also go either way, but probably is better\n>    to be in the low-level.  Cnce color is used the output cannot\n>    be fed sanely to patch or git-apply _anyway_ so we can be\n>    sure that \"git diff-plumbing --color\" is run to produce human\n>    readable output.\n\nDefinitely low-level IMHO, since we have porcelain which relies on the\nlow-level's output (and there is no way to set it manually from the\ncommand line).\n\nPatch to add diff_basic_config infrastructure and fix the color\nselection issue is below. It just does the color, but we can move other\nstuff over as discussion ensues.\n\n-- >8 --\nadd a \"basic\" diff config callback\n\nThe diff porcelain uses git_diff_ui_config to set\nporcelain-ish config options, like automatically turning on\ncolor. The plumbing specifically avoids calling this\nfunction, since it doesn't want things like automatic color\nor rename detection.\n\nHowever, some diff options should be set for both plumbing\nand porcelain. For example, one can still turn on color in\ngit-diff-files using the --color command line option. This\nmeans we want the color config from color.diff.* (so that\nonce color is on, we use the user's preferred scheme), but\n_not_ the color.diff variable.\n\nWe split the diff config into \"ui\" and \"basic\", where\n\"basic\" is suitable for use by plumbing (so _most_ things\naffecting the output should still go into the \"ui\" part).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin-diff-files.c |    2 +-\n builtin-diff-index.c |    2 +-\n builtin-diff-tree.c  |    2 +-\n diff.c               |    6 ++++++\n diff.h               |    1 +\n 5 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-diff-files.c b/builtin-diff-files.c\nindex 9c04111..4abe3c2 100644\n--- a/builtin-diff-files.c\n+++ b/builtin-diff-files.c\n@@ -21,7 +21,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)\n \n \tprefix = setup_git_directory_gently(&nongit);\n \tinit_revisions(&rev, prefix);\n-\tgit_config(git_default_config); /* no \"diff\" UI options */\n+\tgit_config(git_diff_basic_config); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n \n \tif (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))\ndiff --git a/builtin-diff-index.c b/builtin-diff-index.c\nindex 0f2390a..2b955de 100644\n--- a/builtin-diff-index.c\n+++ b/builtin-diff-index.c\n@@ -17,7 +17,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \tint result;\n \n \tinit_revisions(&rev, prefix);\n-\tgit_config(git_default_config); /* no \"diff\" UI options */\n+\tgit_config(git_diff_basic_config); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n \n \targc = setup_revisions(argc, argv, &rev, NULL);\ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex ebc50ef..832797f 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -68,7 +68,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)\n \tint read_stdin = 0;\n \n \tinit_revisions(opt, prefix);\n-\tgit_config(git_default_config); /* no \"diff\" UI options */\n+\tgit_config(git_diff_basic_config); /* no \"diff\" UI options */\n \tnr_sha1 = 0;\n \topt->abbrev = 0;\n \topt->diff = 1;\ndiff --git a/diff.c b/diff.c\nindex f6a8515..6bb0f62 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -183,6 +183,12 @@ int git_diff_ui_config(const char *var, const char *value)\n \t\t\t\treturn parse_funcname_pattern(var, ep, value);\n \t\t}\n \t}\n+\n+\treturn git_diff_basic_config(var, value);\n+}\n+\n+int git_diff_basic_config(const char *var, const char *value)\n+{\n \tif (!prefixcmp(var, \"diff.color.\") || !prefixcmp(var, \"color.diff.\")) {\n \t\tint slot = parse_diff_color_slot(var, 11);\n \t\tcolor_parse(value, var, diff_colors[slot]);\ndiff --git a/diff.h b/diff.h\nindex beccf85..073d5cb 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -172,6 +172,7 @@ extern void diff_unmerge(struct diff_options *,\n #define DIFF_SETUP_USE_CACHE\t\t2\n #define DIFF_SETUP_USE_SIZE_CACHE\t4\n \n+extern int git_diff_basic_config(const char *var, const char *value);\n extern int git_diff_ui_config(const char *var, const char *value);\n extern void diff_setup(struct diff_options *);\n extern int diff_opt_parse(struct diff_options *, const char **, int);\n-- \n1.5.4.rc2.1123.gce734-dirty\n"},{"id":"64432","messageId":"20080104092505.GA2320@coredump.intra.peff.net","threadId":"11464","inReplyTo":"20080104085934.GA3706@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T09:25:05Z","receivedAt":"2008-01-04T09:25:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 03:59:34AM -0500, Jeff King wrote:\n\n> OK. In that case, we need a way for the plumbing to tell the diff\n> machinery \"don't ever try loading the ui config.\"\n\n> >  * funcname-pattern can go either way; that affects what appears\n> >    at the end of @@ context @@ lines, and would not have risk to\n> >    corrupt the patch for plumbing.\n\nI just sent a patch to put the funcname pattern in the \"basic\" config,\nand to get rid of the lazy config loading. So that fixes one call by the\nplumbing to read_config_if_needed.\n\nAnd it looks like the second call is already OK. We don't try parsing\nthe config to get the external diff command unless ALLOW_EXTERNAL is\nset, which the plumbing already disallows (though I am still confused\nwhy it would need to be loaded lazily in the first place -- I wonder if\nread_config_if_needed is needed at all).\n\n-Peff\n"},{"id":"64433","messageId":"7vodc2kk2d.fsf@gitster.siamese.dyndns.org","threadId":"11464","inReplyTo":"20080104092505.GA2320@coredump.intra.peff.net","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T09:37:46Z","receivedAt":"2008-01-04T09:37:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Jan 04, 2008 at 03:59:34AM -0500, Jeff King wrote:\n>\n>> OK. In that case, we need a way for the plumbing to tell the diff\n>> machinery \"don't ever try loading the ui config.\"\n>\n>> >  * funcname-pattern can go either way; that affects what appears\n>> >    at the end of @@ context @@ lines, and would not have risk to\n>> >    corrupt the patch for plumbing.\n>\n> I just sent a patch to put the funcname pattern in the \"basic\" config,\n> and to get rid of the lazy config loading. So that fixes one call by the\n> plumbing to read_config_if_needed.\n>\n> And it looks like the second call is already OK. We don't try parsing\n> the config to get the external diff command unless ALLOW_EXTERNAL is\n> set, which the plumbing already disallows (though I am still confused\n> why it would need to be loaded lazily in the first place -- I wonder if\n> read_config_if_needed is needed at all).\n\nI think that was a premature optimization without benching.  It\nis expected that most trees would not have attributes to define\ncustom low-level diff types, and without them we do not need to\nparse the configuration to find out the external commands to be\nused.\n"},{"id":"64434","messageId":"20080104094531.GA30122@coredump.intra.peff.net","threadId":"11464","inReplyTo":"7vodc2kk2d.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git-diff-* --color oddness","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T09:45:31Z","receivedAt":"2008-01-04T09:45:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 01:37:46AM -0800, Junio C Hamano wrote:\n\n> > And it looks like the second call is already OK. We don't try parsing\n> > the config to get the external diff command unless ALLOW_EXTERNAL is\n> > set, which the plumbing already disallows (though I am still confused\n> > why it would need to be loaded lazily in the first place -- I wonder if\n> > read_config_if_needed is needed at all).\n> \n> I think that was a premature optimization without benching.  It\n> is expected that most trees would not have attributes to define\n> custom low-level diff types, and without them we do not need to\n> parse the configuration to find out the external commands to be\n> used.\n\nAh. But we were parsing them anyway in git_diff_ui_config at the\nbeginning of the program (and we need to, since you will always have\ndiff.default.*). So I think this is safe to do, and can replace my other\n\"only read config once\" patch from a few minutes ago:\n\n-- >8 --\ndiff: remove lazy config loading\n\nThere is no point to this. Either:\n\n  1. The program has already loaded git_diff_ui_config, in\n     which case this is a noop.\n  2. The program didn't, which means it is plumbing that\n     does not _want_ git_diff_ui_config to be loaded.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n diff.c |   12 ------------\n 1 files changed, 0 insertions(+), 12 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex ecf2fd6..2c78d74 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -59,17 +59,6 @@ static struct ll_diff_driver {\n \tchar *cmd;\n } *user_diff, **user_diff_tail;\n \n-static void read_config_if_needed(void)\n-{\n-\tstatic int done = 0;\n-\tif (done)\n-\t\treturn;\n-\n-\tuser_diff_tail = &user_diff;\n-\tgit_config(git_diff_ui_config);\n-\tdone = 1;\n-}\n-\n /*\n  * Currently there is only \"diff.<drivername>.command\" variable;\n  * because there are \"diff.color.<slot>\" variables, we are parsing\n@@ -1825,7 +1814,6 @@ static const char *external_diff_attr(const char *name)\n \t\t    !ATTR_UNSET(value)) {\n \t\t\tstruct ll_diff_driver *drv;\n \n-\t\t\tread_config_if_needed();\n \t\t\tfor (drv = user_diff; drv; drv = drv->next)\n \t\t\t\tif (!strcmp(drv->name, value))\n \t\t\t\t\treturn drv->cmd;\n-- \n1.5.4.rc2.1125.ga305e-dirty\n"}]}