{"thread":{"id":"4792","subject":"[PATCH] builtin-log: respect diff configuration options","startedAt":"2006-07-07T10:10:43Z","lastAt":"2006-07-08T08:50:02Z","messageCount":13,"participants":["Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23348","messageId":"11522670452824-git-send-email-normalperson@yhbt.net","threadId":"4792","inReplyTo":null,"subject":"[PATCH 0/1] I forgot to run format-patch with the -M flag","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-07T10:10:43Z","receivedAt":"2006-07-07T10:10:43Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Now I can forget more often :)  Unless the similarity is too low.\n\nI'm not too sure if I'd want to set similarity or find-copies-harder\ninto my config just yet, since they depend on the situation.  But I\nusually want renames in my diffs.\n\n-- \nEric Wong\n"},{"id":"23347","messageId":"11522670473116-git-send-email-normalperson@yhbt.net","threadId":"4792","inReplyTo":"11522670452824-git-send-email-normalperson@yhbt.net","subject":"[PATCH] diff.c: respect diff.renames config option","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-07T10:10:44Z","receivedAt":"2006-07-07T10:10:44Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"diff.renames is mentioned several times in the documentation,\nbut to my surprise it didn't do anything before this patch.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n Documentation/config.txt |    5 +++++\n diff.c                   |   12 ++++++++++++\n 2 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f075f19..5290a8f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -114,6 +114,11 @@ diff.renameLimit::\n \tThe number of files to consider when performing the copy/rename\n \tdetection; equivalent to the git diff option '-l'.\n \n+diff.renames::\n+\tTells git to detect renames.  If set to any boolean value, it\n+\twill enable basic rename detection.  If set to \"copies\" or\n+\t\"copy\", it will detect copies, as well.\n+\n format.headers::\n \tAdditional email headers to include in a patch to be submitted\n \tby mail.  See gitlink:git-format-patch[1].\ndiff --git a/diff.c b/diff.c\nindex 507e401..223622a 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -13,6 +13,7 @@ #include \"xdiff-interface.h\"\n \n static int use_size_cache;\n \n+static int diff_detect_rename_default = 0;\n static int diff_rename_limit_default = -1;\n static int diff_use_color_default = 0;\n \n@@ -120,6 +121,16 @@ int git_diff_config(const char *var, con\n \t\t\tdiff_use_color_default = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"diff.renames\")) {\n+\t\tif (!value)\n+\t\t\tdiff_detect_rename_default = DIFF_DETECT_RENAME;\n+\t\telse if (!strcasecmp(value, \"copies\") ||\n+\t\t\t !strcasecmp(value, \"copy\"))\n+\t\t\tdiff_detect_rename_default = DIFF_DETECT_COPY;\n+\t\telse\n+\t\t\tdiff_detect_rename_default = git_config_bool(var,value);\n+\t\treturn 0;\n+\t}\n \tif (!strncmp(var, \"diff.color.\", 11)) {\n \t\tint slot = parse_diff_color_slot(var, 11);\n \t\tdiff_colors[slot] = parse_diff_color_value(value, var);\n@@ -1429,6 +1440,7 @@ void diff_setup(struct diff_options *opt\n \toptions->change = diff_change;\n \toptions->add_remove = diff_addremove;\n \toptions->color_diff = diff_use_color_default;\n+\toptions->detect_rename = diff_detect_rename_default;\n }\n \n int diff_setup_done(struct diff_options *options)\n-- \n1.4.1.g3dc65\n"},{"id":"23346","messageId":"11522670482020-git-send-email-normalperson@yhbt.net","threadId":"4792","inReplyTo":"11522670473116-git-send-email-normalperson@yhbt.net","subject":"[PATCH] builtin-log: respect diff configuration options","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-07T10:10:45Z","receivedAt":"2006-07-07T10:10:45Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"The log commands are all capable of generating diffs, so we\nshould respect those configuration options for diffs here.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n builtin-log.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 864c6cd..698b71e 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -47,6 +47,7 @@ int cmd_whatchanged(int argc, const char\n {\n \tstruct rev_info rev;\n \n+\tgit_config(git_diff_config);\n \tinit_revisions(&rev);\n \trev.diff = 1;\n \trev.diffopt.recursive = 1;\n@@ -61,6 +62,7 @@ int cmd_show(int argc, const char **argv\n {\n \tstruct rev_info rev;\n \n+\tgit_config(git_diff_config);\n \tinit_revisions(&rev);\n \trev.diff = 1;\n \trev.diffopt.recursive = 1;\n@@ -77,6 +79,7 @@ int cmd_log(int argc, const char **argv,\n {\n \tstruct rev_info rev;\n \n+\tgit_config(git_diff_config);\n \tinit_revisions(&rev);\n \trev.always_show_header = 1;\n \tcmd_log_init(argc, argv, envp, &rev);\n@@ -102,7 +105,7 @@ static int git_format_config(const char \n \t\tstrcat(extra_headers, value);\n \t\treturn 0;\n \t}\n-\treturn git_default_config(var, value);\n+\treturn git_diff_config(var, value);\n }\n \n \n@@ -234,6 +237,7 @@ int cmd_format_patch(int argc, const cha\n \tstruct diff_options patch_id_opts;\n \tchar *add_signoff = NULL;\n \n+\tgit_config(git_format_config);\n \tinit_revisions(&rev);\n \trev.commit_format = CMIT_FMT_EMAIL;\n \trev.verbose_header = 1;\n@@ -243,7 +247,6 @@ int cmd_format_patch(int argc, const cha\n \trev.diffopt.msg_sep = \"\";\n \trev.diffopt.recursive = 1;\n \n-\tgit_config(git_format_config);\n \trev.extra_headers = extra_headers;\n \n \t/*\n-- \n1.4.1.g3dc65\n"},{"id":"23349","messageId":"7v7j2p3eac.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"11522670473116-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH] diff.c: respect diff.renames config option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T10:22:35Z","receivedAt":"2006-07-07T10:22:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> diff.renames is mentioned several times in the documentation,\n> but to my surprise it didn't do anything before this patch.\n\nI am really reluctant to do this at this low-level, especially\nsince there is no way to defeat the settings from the command\nline.\n\n> @@ -120,6 +121,16 @@ int git_diff_config(const char *var, con\n>  \t\t\tdiff_use_color_default = git_config_bool(var, value);\n>  \t\treturn 0;\n>  \t}\n> +\tif (!strcmp(var, \"diff.renames\")) {\n> +\t\tif (!value)\n> +\t\t\tdiff_detect_rename_default = DIFF_DETECT_RENAME;\n> +\t\telse if (!strcasecmp(value, \"copies\") ||\n> +\t\t\t !strcasecmp(value, \"copy\"))\n> +\t\t\tdiff_detect_rename_default = DIFF_DETECT_COPY;\n> +\t\telse\n> +\t\t\tdiff_detect_rename_default = git_config_bool(var,value);\n> +\t\treturn 0;\n> +\t}\n\nI suspect this works only because DIFF_DETECT_RENAME happens to\nbe 1?\n"},{"id":"23352","messageId":"7vy7v51yqr.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"11522670482020-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH] builtin-log: respect diff configuration options","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T10:43:40Z","receivedAt":"2006-07-07T10:43:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> The log commands are all capable of generating diffs, so we\n> should respect those configuration options for diffs here.\n>\n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n\nMakes sense.  This makes \"git log -p\" more colorful ;-).\n"},{"id":"23357","messageId":"7vpsghzmr1.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"20060707110123.GA23400@soma","subject":"Re: [PATCH] diff.c: respect diff.renames config option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T11:18:42Z","receivedAt":"2006-07-07T11:18:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> Nevertheless, it's still opt -in via repo-config, and most people will\n> find renames useful unless they need to export to non-git\n> systems.\n\nI am more worried about somebody who opts-in finds breakage of\ncommands that happen to internally use low-level diff machinery\nand expect the diff machinery does not automagically do funny\nrename detection without being told.\n\nFor example, revision walking with path pruning uses diff\nmachinery without renames.  I do not know what happens if I\noverride it with diff.renames to allow rename detection but I\nfear something might horribly break.\n\nThat is why I said I do not want this at _that_ low level.  I do\nnot have objections to have the configuration at a layer closer\nto the UI, e.g. things in builtin-log.c and builtin-diff.c.\n"},{"id":"23365","messageId":"7v64i9zk0j.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"7vpsghzmr1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] diff.c: respect diff.renames config option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T12:17:48Z","receivedAt":"2006-07-07T12:17:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> I am more worried about somebody who opts-in finds breakage of\n> commands that happen to internally use low-level diff machinery\n> and expect the diff machinery does not automagically do funny\n> rename detection without being told.\n> ...\n> That is why I said I do not want this at _that_ low level.  I do\n> not have objections to have the configuration at a layer closer\n> to the UI, e.g. things in builtin-log.c and builtin-diff.c.\n\nUpon closer look I think the revision pruning code is OK.  So\nlet's cook this as is in \"next\" and see what happens.\n"},{"id":"23366","messageId":"7vwtapy4vz.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"7vpsghzmr1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] diff.c: respect diff.renames config option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T12:29:52Z","receivedAt":"2006-07-07T12:29:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"In the same spirit...\n\nFrom: Junio C Hamano <junkio@cox.net>\nDate: Fri, 7 Jul 2006 05:27:24 -0700\nSubject: [PATCH] diff.c: --no-color to defeat diff.color configuration.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n diff.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 2534fce..39e608f 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1622,6 +1622,8 @@ int diff_opt_parse(struct diff_options *\n \t}\n \telse if (!strcmp(arg, \"--color\"))\n \t\toptions->color_diff = 1;\n+\telse if (!strcmp(arg, \"--no-color\"))\n+\t\toptions->color_diff = 0;\n \telse if (!strcmp(arg, \"-w\") || !strcmp(arg, \"--ignore-all-space\"))\n \t\toptions->xdl_opts |= XDF_IGNORE_WHITESPACE;\n \telse if (!strcmp(arg, \"-b\") || !strcmp(arg, \"--ignore-space-change\"))\n-- \n1.4.1.gfff4c\n"},{"id":"23367","messageId":"7vr70xy4ul.fsf_-_@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"7vpsghzmr1.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] update Documentation/diff-options.txt","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T12:30:42Z","receivedAt":"2006-07-07T12:30:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We've been lazy and left things undocumented for some time.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n Documentation/diff-options.txt |   24 +++++++++++++++++++++---\n 1 files changed, 21 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex f523ec2..fdcfd68 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -4,18 +4,21 @@\n -u::\n \tSynonym for \"-p\".\n \n+--raw::\n+\tGenerate the raw format.\n+\n --patch-with-raw::\n-\tGenerate patch but keep also the default raw diff output.\n+\tSynonym for \"-p --raw\".\n \n --stat::\n-\tGenerate a diffstat instead of a patch.\n+\tGenerate a diffstat.\n \n --summary::\n \tOutput a condensed summary of extended header information\n \tsuch as creations, renames and mode changes.\n \n --patch-with-stat::\n-\tGenerate patch and prepend its diffstat.\n+\tSynonym for \"-p --stat\".\n \n -z::\n \t\\0 line termination on output\n@@ -26,11 +29,26 @@\n --name-status::\n \tShow only names and status of changed files.\n \n+--color::\n+\tShow colored diff.\n+\n+--no-color::\n+\tTurn off colored diff, even when the configuration file\n+\tgives the default to color output.\n+\n+--no-renames::\n+\tTurn off rename detection, even when the configuration\n+\tfile gives the default to do so.\n+\n --full-index::\n \tInstead of the first handful characters, show full\n \tobject name of pre- and post-image blob on the \"index\"\n \tline when generating a patch format output.\t\n \n+--binary::\n+\tIn addition to --full-index, output \"binary diff\" that\n+\tcan be applied with \"git apply\".\n+\n --abbrev[=<n>]::\n \tInstead of showing the full 40-byte hexadecimal object\n \tname in diff-raw format output and diff-tree header\n-- \n1.4.1.gfff4c\n"},{"id":"23399","messageId":"20060708015844.GA13769@soma","threadId":"4792","inReplyTo":"7v64i9zk0j.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Fix several places where diff.renames in config can be problematic","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-08T01:58:46Z","receivedAt":"2006-07-08T01:58:46Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"git-cvsexportcommit.perl:\ngit-cvsserver.perl:\n\tCVS can't handle renames, so we best not show them to\n\tusers.\n\ntemplates/hooks--update:\n\treplace diffstat calls with git diff --stat\n\nThere may be other places where users having diff.renames can be\nproblematic, too.  diff.renames is opt-in, but maybe some users\nhave enabled it in their configs previously because it's been\nin examples for a long time...\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n Junio C Hamano <junkio@cox.net> wrote:\n > Junio C Hamano <junkio@cox.net> writes:\n > \n > > I am more worried about somebody who opts-in finds breakage of\n > > commands that happen to internally use low-level diff machinery\n > > and expect the diff machinery does not automagically do funny\n > > rename detection without being told.\n > > ...\n > > That is why I said I do not want this at _that_ low level.  I do\n > > not have objections to have the configuration at a layer closer\n > > to the UI, e.g. things in builtin-log.c and builtin-diff.c.\n > \n > Upon closer look I think the revision pruning code is OK.  So\n > let's cook this as is in \"next\" and see what happens.\n\n Cool.  I've found these that could be potential issues.  There could be\n more, and possibly many in 3rd-party scripts outside our control, too.\n\n git-cvsexportcommit.perl |    8 +++++---\n git-cvsserver.perl       |    2 +-\n templates/hooks--update  |    4 ++--\n 3 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex d1051d0..09ff2cc 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -91,7 +91,8 @@ close MSG;\n $? && die \"Error extracting the commit message\";\n \n my (@afiles, @dfiles, @mfiles, @dirs);\n-my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);\n+my @files = safe_pipe_capture('git-diff-tree','--no-renames','-r',\n+\t\t\t\t$parent, $commit);\n #print @files;\n $? && die \"Error in git-diff-tree\";\n foreach my $f (@files) {\n@@ -175,7 +176,8 @@ foreach my $d (@dirs) {\n \n print \"'Patching' binary files\\n\";\n \n-my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree', '-p', $parent, $commit));\n+my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree','--no-renames',\n+\t\t\t\t\t\t'-p', $parent, $commit));\n @bfiles = map { chomp } @bfiles;\n foreach my $f (@bfiles) {\n     # check that the file in cvs matches the \"old\" file\n@@ -206,7 +208,7 @@ ## apply non-binary changes\n my $fuzz = $opt_p ? 0 : 2;\n \n print \"Patching non-binary files\\n\";\n-print `(git-diff-tree -p $parent -p $commit | patch -p1 -F $fuzz ) 2>&1`;\n+print `(git-diff-tree --no-renames -p $parent -p $commit | patch -p1 -F $fuzz ) 2>&1`;\n \n my $dirtypatch = 0;\n if (($? >> 8) == 2) {\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 5ccca4f..ae878ea 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -2295,7 +2295,7 @@ sub update\n \n         if ( defined ( $lastpicked ) )\n         {\n-            my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '-r', $lastpicked, $commit->{hash}) or die(\"Cannot call git-diff-tree : $!\");\n+            my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '--no-merges', '-r', $lastpicked, $commit->{hash}) or die(\"Cannot call git-diff-tree : $!\");\n             while ( <FILELIST> )\n             {\n                 unless ( /^:\\d{6}\\s+\\d{3}(\\d)\\d{2}\\s+[a-zA-Z0-9]{40}\\s+([a-zA-Z0-9]{40})\\s+(\\w)\\s+(.*)$/o )\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex d7a8f0a..76d5ac2 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -60,7 +60,7 @@ then\n \t\t\techo \"Changes since $prev:\"\n \t\t\tgit rev-list --pretty $prev..$3 | $short\n \t\t\techo ---\n-\t\t\tgit diff $prev..$3 | diffstat -p1\n+\t\t\tgit diff --stat $prev..$3\n \t\t\techo ---\n \t\tfi\n \t\t;;\n@@ -75,7 +75,7 @@ else\n \tbase=$(git-merge-base \"$2\" \"$3\")\n \tcase \"$base\" in\n \t\"$2\")\n-\t\tgit diff \"$3\" \"^$base\" | diffstat -p1\n+\t\tgit diff --stat \"$3\" \"^$base\"\n \t\techo\n \t\techo \"New commits:\"\n \t\t;;\n-- \n1.4.1.gc57e\n"},{"id":"23410","messageId":"7vsllcr077.fsf@assigned-by-dhcp.cox.net","threadId":"4792","inReplyTo":"20060708015844.GA13769@soma","subject":"Re: [PATCH] Fix several places where diff.renames in config can be problematic","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-08T08:05:16Z","receivedAt":"2006-07-08T08:05:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> -my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);\n> +my @files = safe_pipe_capture('git-diff-tree','--no-renames','-r',\n> +\t\t\t\t$parent, $commit);\n\nI changed my mind.\n\n-- >8 --\ndiff: do not use configuration magic at the core-level\n\nThe Porcelainish has become so much usable as the UI that there\nis not much reason people should be using the core programs by\nhand anymore.  At this point we are better off making the\nbehaviour of the core programs predictable by keeping them\nunaffected by the configuration variables.  Otherwise they will\nbecome very hard to use as reliable building blocks.\n\nFor example, \"git-commit -a\" internally uses git-diff-files to\nfigure out the set of paths that need to be updated in the\nindex, and we should never allow diff.renames that happens to be\nin the configuration to interfere (or slow down the process).\n\nThe UI level configuration such as showing renamed diff and\ncoloring are still honored by the Porcelainish (\"git log\" family\nand \"git diff\"), but not by the core anymore.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n builtin-diff-files.c  |    2 +-\n builtin-diff-index.c  |    2 +-\n builtin-diff-stages.c |    2 +-\n builtin-diff-tree.c   |    2 +-\n builtin-diff.c        |    2 +-\n builtin-log.c         |    8 ++++----\n diff.c                |    8 +++++++-\n diff.h                |    2 +-\n 8 files changed, 17 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin-diff-files.c b/builtin-diff-files.c\nindex a655eea..81ac2fe 100644\n--- a/builtin-diff-files.c\n+++ b/builtin-diff-files.c\n@@ -18,7 +18,7 @@ int cmd_diff_files(int argc, const char \n \tstruct rev_info rev;\n \tint silent = 0;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_default_config); /* no \"diff\" UI options */\n \tinit_revisions(&rev);\n \trev.abbrev = 0;\n \ndiff --git a/builtin-diff-index.c b/builtin-diff-index.c\nindex b37c9e8..a1fa1b8 100644\n--- a/builtin-diff-index.c\n+++ b/builtin-diff-index.c\n@@ -15,7 +15,7 @@ int cmd_diff_index(int argc, const char \n \tint cached = 0;\n \tint i;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_default_config); /* no \"diff\" UI options */\n \tinit_revisions(&rev);\n \trev.abbrev = 0;\n \ndiff --git a/builtin-diff-stages.c b/builtin-diff-stages.c\nindex 30931fe..9c62702 100644\n--- a/builtin-diff-stages.c\n+++ b/builtin-diff-stages.c\n@@ -61,7 +61,7 @@ int cmd_diff_stages(int ac, const char *\n \tconst char *prefix = setup_git_directory();\n \tconst char **pathspec = NULL;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_default_config); /* no \"diff\" UI options */\n \tread_cache();\n \tdiff_setup(&diff_options);\n \twhile (1 < ac && av[1][0] == '-') {\ndiff --git a/builtin-diff-tree.c b/builtin-diff-tree.c\nindex ae1cde9..b610668 100644\n--- a/builtin-diff-tree.c\n+++ b/builtin-diff-tree.c\n@@ -67,7 +67,7 @@ int cmd_diff_tree(int argc, const char *\n \tstatic struct rev_info *opt = &log_tree_opt;\n \tint read_stdin = 0;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_default_config); /* no \"diff\" UI options */\n \tnr_sha1 = 0;\n \tinit_revisions(opt);\n \topt->abbrev = 0;\ndiff --git a/builtin-diff.c b/builtin-diff.c\nindex d520c7c..1df531b 100644\n--- a/builtin-diff.c\n+++ b/builtin-diff.c\n@@ -250,7 +250,7 @@ int cmd_diff(int argc, const char **argv\n \t * Other cases are errors.\n \t */\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_diff_ui_config);\n \tinit_revisions(&rev);\n \n \targc = setup_revisions(argc, argv, &rev, NULL);\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 698b71e..dd5a5a2 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -47,7 +47,7 @@ int cmd_whatchanged(int argc, const char\n {\n \tstruct rev_info rev;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_diff_ui_config);\n \tinit_revisions(&rev);\n \trev.diff = 1;\n \trev.diffopt.recursive = 1;\n@@ -62,7 +62,7 @@ int cmd_show(int argc, const char **argv\n {\n \tstruct rev_info rev;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_diff_ui_config);\n \tinit_revisions(&rev);\n \trev.diff = 1;\n \trev.diffopt.recursive = 1;\n@@ -79,7 +79,7 @@ int cmd_log(int argc, const char **argv,\n {\n \tstruct rev_info rev;\n \n-\tgit_config(git_diff_config);\n+\tgit_config(git_diff_ui_config);\n \tinit_revisions(&rev);\n \trev.always_show_header = 1;\n \tcmd_log_init(argc, argv, envp, &rev);\n@@ -105,7 +105,7 @@ static int git_format_config(const char \n \t\tstrcat(extra_headers, value);\n \t\treturn 0;\n \t}\n-\treturn git_diff_config(var, value);\n+\treturn git_diff_ui_config(var, value);\n }\n \n \ndiff --git a/diff.c b/diff.c\nindex 1bf1ed0..493650c 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -102,7 +102,13 @@ static const char *parse_diff_color_valu\n \tdie(\"bad config value '%s' for variable '%s'\", value, var);\n }\n \n-int git_diff_config(const char *var, const char *value)\n+/*\n+ * These are to give UI layer defaults.\n+ * The core-level commands such as git-diff-files should\n+ * never be affected by the setting of diff.renames\n+ * the user happens to have in the configuration file.\n+ */\n+int git_diff_ui_config(const char *var, const char *value)\n {\n \tif (!strcmp(var, \"diff.renamelimit\")) {\n \t\tdiff_rename_limit_default = git_config_int(var, value);\ndiff --git a/diff.h b/diff.h\nindex 8ab0448..a06f959 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -123,7 +123,7 @@ #define DIFF_SETUP_REVERSE      \t1\n #define DIFF_SETUP_USE_CACHE\t\t2\n #define DIFF_SETUP_USE_SIZE_CACHE\t4\n \n-extern int git_diff_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 extern int diff_setup_done(struct diff_options *);\n"},{"id":"23411","messageId":"20060708084121.GD29036@hand.yhbt.net","threadId":"4792","inReplyTo":"7vsllcr077.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix several places where diff.renames in config can be problematic","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-08T08:41:22Z","receivedAt":"2006-07-08T08:41:22Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > -my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);\n> > +my @files = safe_pipe_capture('git-diff-tree','--no-renames','-r',\n> > +\t\t\t\t$parent, $commit);\n> \n> I changed my mind.\n> \n> -- >8 --\n> diff: do not use configuration magic at the core-level\n> \n> The Porcelainish has become so much usable as the UI that there\n> is not much reason people should be using the core programs by\n> hand anymore.  At this point we are better off making the\n> behaviour of the core programs predictable by keeping them\n> unaffected by the configuration variables.  Otherwise they will\n> become very hard to use as reliable building blocks.\n> \n> For example, \"git-commit -a\" internally uses git-diff-files to\n> figure out the set of paths that need to be updated in the\n> index, and we should never allow diff.renames that happens to be\n> in the configuration to interfere (or slow down the process).\n> \n> The UI level configuration such as showing renamed diff and\n> coloring are still honored by the Porcelainish (\"git log\" family\n> and \"git diff\"), but not by the core anymore.\n\nFull ack on this.  I was ready to let my diff.renames patch drop\nif there were too many potential incompatibilities/breakages,\nbut this should alleviate that.\n\nI should work on breaking out of the habit of using git\ndiff-{index,tree} in my day-to-day use and finally start using git diff\nmore to save some keystrokes.\n\n-- \nEric Wong\n"},{"id":"23412","messageId":"20060708085002.GA3428@soma","threadId":"4792","inReplyTo":"20060708084121.GD29036@hand.yhbt.net","subject":"[PATCH] templates/hooks--update: replace diffstat calls with git diff --stat","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-08T08:50:02Z","receivedAt":"2006-07-08T08:50:02Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Signed-off-by: Eric Wong <normalperson@yhbt.net>\n---\n This was part of the previous patch, but useful on its own since\n we have our own internal diffstat\n\n templates/hooks--update |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex d7a8f0a..76d5ac2 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -60,7 +60,7 @@ then\n \t\t\techo \"Changes since $prev:\"\n \t\t\tgit rev-list --pretty $prev..$3 | $short\n \t\t\techo ---\n-\t\t\tgit diff $prev..$3 | diffstat -p1\n+\t\t\tgit diff --stat $prev..$3\n \t\t\techo ---\n \t\tfi\n \t\t;;\n@@ -75,7 +75,7 @@ else\n \tbase=$(git-merge-base \"$2\" \"$3\")\n \tcase \"$base\" in\n \t\"$2\")\n-\t\tgit diff \"$3\" \"^$base\" | diffstat -p1\n+\t\tgit diff --stat \"$3\" \"^$base\"\n \t\techo\n \t\techo \"New commits:\"\n \t\t;;\n-- \n1.4.1.g6a62\n"}]}