{"thread":{"id":"3270","subject":"gitweb using \"--cc\"?","startedAt":"2006-02-08T23:44:58Z","lastAt":"2006-02-11T20:59:36Z","messageCount":27,"participants":["Linus Torvalds","Junio C Hamano","Brian Gerst","Kay Sievers","Marco Costalba"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15741","messageId":"Pine.LNX.4.64.0602081532360.2458@g5.osdl.org","threadId":"3270","inReplyTo":null,"subject":"gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-08T23:44:58Z","receivedAt":"2006-02-08T23:44:58Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nI just did an arm merge that needed some (very trivial) manual fixups \n(commit ID cce0cac1, in case anybody cares).\n\nAs usual, git-diff-tree --cc does a beautiful job on it, but I also \nchecked the gitweb output, which seems to not do as well (the commit \nmessage about a manual conflict merge doesn't make any sense at all).\n\nNow, in this case, what gitweb shows is actually \"sensible\": it will show \nthe diff of what the merge \"brought in\" to the mainline kernel, and in \nthat sense I can certainly understand it. It basically diffs the merge \nagainst the first parent.\n\nSo looking at that particular example, arguably gitweb does something \n\"different\" from what the commit message is talking about, but in many \nways it's a perfectly logical thing.\n\nHowever, diffing against the first parent, while it sometimes happens to \nbe a sane thing to do, really isn't very sane in general. The merge may go \nthe other way (subdevelopers merging my code), like in commit b2faf597, \nand sometimes there might not be a single reference tree, but more of a \n\"couple of main branches\" approach with merging back and forth). Then the \ncurrent gitweb behaviour makes no sense at all.\n\nSo it would be much nicer if gitweb had some alternate approach to showing \nmerge diffs. My suggested approach would be to just let the user choose: \nhave separate \"diff against fist/second[/third[/..]] parent\" buttons. And \none of the choices would be the \"conflict view\" that git-diff-tree --cc \ngives (I'd argue for that being the default one, because it's the only one \nthat doesn't have a \"preferred parent\").\n\nKay?\n\n\t\tLinus\n"},{"id":"15744","messageId":"7vu0b9mmij.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602081532360.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-08T23:57:56Z","receivedAt":"2006-02-08T23:57:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> So it would be much nicer if gitweb had some alternate approach to showing \n> merge diffs. My suggested approach would be to just let the user choose: \n> have separate \"diff against fist/second[/third[/..]] parent\" buttons. And \n> one of the choices would be the \"conflict view\" that git-diff-tree --cc \n> gives (I'd argue for that being the default one, because it's the only one \n> that doesn't have a \"preferred parent\").\n\nI have something very rough, but I will be sending them out\nanyways.\n"},{"id":"15745","messageId":"7vmzh1mmd4.fsf_-_@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7vu0b9mmij.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Use describe to come up with the closest tag.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T00:01:11Z","receivedAt":"2006-02-09T00:01:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * This gives saner output than what is currently there.  It\n   does not have direct relation to the diff-tree --cc patch,\n   but over there I already use describe so this patch is to\n   make things consistent.\n\n gitweb.cgi |   15 +++------------\n 1 files changed, 3 insertions(+), 12 deletions(-)\n\n3fb28888448edc8b2d4aeab55bc13d78746e5a45\ndiff --git a/gitweb.cgi b/gitweb.cgi\nindex c1bb624..3c43695 100755\n--- a/gitweb.cgi\n+++ b/gitweb.cgi\n@@ -2051,20 +2051,11 @@ sub git_commitdiff_plain {\n \tclose $fd or die_error(undef, \"Reading diff-tree failed.\");\n \n \t# try to figure out the next tag after this commit\n-\tmy $tagname;\n \tmy $refs = read_info_ref(\"tags\");\n-\topen $fd, \"-|\", \"$gitbin/git-rev-list HEAD\";\n-\tchomp (my (@commits) = <$fd>);\n+\topen $fd, \"-|\", \"$gitbin/git-describe $hash\";\n+\tmy ($tagname) = <$fd>;\n+\tchomp($tagname);\n \tclose $fd;\n-\tforeach my $commit (@commits) {\n-\t\tif (defined $refs->{$commit}) {\n-\t\t\t$tagname = $refs->{$commit}\n-\t\t}\n-\t\tif ($commit eq $hash) {\n-\t\t\tlast;\n-\t\t}\n-\t}\n-\n \tprint $cgi->header(-type => \"text/plain\", -charset => 'utf-8', '-content-disposition' => \"inline; filename=\\\"git-$hash.patch\\\"\");\n \tmy %co = git_read_commit($hash);\n \tmy %ad = date_str($co{'author_epoch'}, $co{'author_tz'});\n-- \n1.1.6.gbb042\n"},{"id":"15746","messageId":"7vhd79mmbe.fsf_-_@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7vu0b9mmij.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Allow using --cc when showing a merge.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T00:02:13Z","receivedAt":"2006-02-09T00:02:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * This does not do the colorized diff, but just to show ideas\n   where to put the link to ask for the combined diff.\n\n gitweb.cgi |   60 +++++++++++++++++++++++++++++++++++++++++++++++-------------\n 1 files changed, 47 insertions(+), 13 deletions(-)\n\n1f19febaefbf90dc04a6b37d79ba3a9337decaff\ndiff --git a/gitweb.cgi b/gitweb.cgi\nindex c1bb624..d2659ea 100755\n--- a/gitweb.cgi\n+++ b/gitweb.cgi\n@@ -191,6 +191,9 @@ if (!defined $action || $action eq \"summ\n } elsif ($action eq \"commitdiff_plain\") {\n \tgit_commitdiff_plain();\n \texit;\n+} elsif ($action eq \"combinediff\") {\n+\tgit_combinediff();\n+\texit;\n } elsif ($action eq \"history\") {\n \tgit_history();\n \texit;\n@@ -1762,7 +1765,15 @@ sub git_commit {\n \t      \"</tr>\\n\";\n \tprint \"<tr><td>committer</td><td>\" . esc_html($co{'committer'}) . \"</td></tr>\\n\";\n \tprint \"<tr><td></td><td> $cd{'rfc2822'}\" . sprintf(\" (%02d:%02d %s)\", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . \"</td></tr>\\n\";\n-\tprint \"<tr><td>commit</td><td style=\\\"font-family:monospace\\\">$co{'id'}</td></tr>\\n\";\n+\tprint \"<tr><td>commit</td><td style=\\\"font-family:monospace\\\">$co{'id'}</td>\";\n+\tif (1 < @{$co{'parents'}}) {\n+\t\tprint '<td class=\"link\">';\n+\t\tprint $cgi->a({-href => \"$my_uri?\" .\n+\t\t\t\t   esc_param(\"p=$project;a=combinediff;\".\n+\t\t\t\t\t     \"h=$hash\")}, \"combinediff\");\n+\t\tprint '</td>';\n+\t}\n+\tprint \"</tr>\\n\";\n \tprint \"<tr>\" .\n \t      \"<td>tree</td>\" .\n \t      \"<td style=\\\"font-family:monospace\\\">\" .\n@@ -2044,6 +2055,38 @@ sub git_commitdiff {\n \tgit_footer_html();\n }\n \n+sub git_combinediff {\n+\tmkdir($git_temp, 0700);\n+\tmy $fd;\n+\tmy $refs = read_info_ref(\"tags\");\n+\topen $fd, \"-|\", \"$gitbin/git-describe $hash\";\n+\tmy ($tagname) = <$fd>;\n+\tchomp($tagname);\n+\tclose $fd;\n+\tprint $cgi->header(-type => \"text/plain\", -charset => 'utf-8', '-content-disposition' => \"inline; filename=\\\"git-$hash.patch\\\"\");\n+\tmy %co = git_read_commit($hash);\n+\tmy %ad = date_str($co{'author_epoch'}, $co{'author_tz'});\n+\tmy $comment = $co{'comment'};\n+\tprint \"From: $co{'author'}\\n\" .\n+\t      \"Date: $ad{'rfc2822'} ($ad{'tz_local'})\\n\".\n+\t      \"Subject: $co{'title'}\\n\";\n+\tif (defined $tagname) {\n+\t      print \"X-Git-Tag: $tagname\\n\";\n+\t}\n+\tprint \"\\n\";\n+\n+\tforeach my $line (@$comment) {;\n+\t\tprint \"$line\\n\";\n+\t}\n+\tprint \"---\\n\\n\";\n+\n+\topen $fd, \"-|\", \"$gitbin/git-diff-tree --cc $hash\";\n+\twhile (<$fd>) {\n+\t\tprint $_;\n+\t}\n+\tclose $fd;\n+}\n+\n sub git_commitdiff_plain {\n \tmkdir($git_temp, 0700);\n \topen my $fd, \"-|\", \"$gitbin/git-diff-tree -r $hash_parent $hash\" or die_error(undef, \"Open failed.\");\n@@ -2051,20 +2094,11 @@ sub git_commitdiff_plain {\n \tclose $fd or die_error(undef, \"Reading diff-tree failed.\");\n \n \t# try to figure out the next tag after this commit\n-\tmy $tagname;\n \tmy $refs = read_info_ref(\"tags\");\n-\topen $fd, \"-|\", \"$gitbin/git-rev-list HEAD\";\n-\tchomp (my (@commits) = <$fd>);\n+\topen $fd, \"-|\", \"$gitbin/git-describe $hash\";\n+\tmy ($tagname) = <$fd>;\n+\tchomp($tagname);\n \tclose $fd;\n-\tforeach my $commit (@commits) {\n-\t\tif (defined $refs->{$commit}) {\n-\t\t\t$tagname = $refs->{$commit}\n-\t\t}\n-\t\tif ($commit eq $hash) {\n-\t\t\tlast;\n-\t\t}\n-\t}\n-\n \tprint $cgi->header(-type => \"text/plain\", -charset => 'utf-8', '-content-disposition' => \"inline; filename=\\\"git-$hash.patch\\\"\");\n \tmy %co = git_read_commit($hash);\n \tmy %ad = date_str($co{'author_epoch'}, $co{'author_tz'});\n-- \n1.1.6.gbb042\n"},{"id":"15760","messageId":"43EAA560.8030504@didntduck.org","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602081532360.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Brian Gerst","fromEmail":"bgerst@didntduck.org","sentAt":"2006-02-09T02:13:52Z","receivedAt":"2006-02-09T02:13:52Z","isPatch":false,"sender":{"key":"bgerst@didntduck.org","avatar":null},"body":"Linus Torvalds wrote:\n> I just did an arm merge that needed some (very trivial) manual fixups \n> (commit ID cce0cac1, in case anybody cares).\n> \n> As usual, git-diff-tree --cc does a beautiful job on it, but I also \n> checked the gitweb output, which seems to not do as well (the commit \n> message about a manual conflict merge doesn't make any sense at all).\n> \n> Now, in this case, what gitweb shows is actually \"sensible\": it will show \n> the diff of what the merge \"brought in\" to the mainline kernel, and in \n> that sense I can certainly understand it. It basically diffs the merge \n> against the first parent.\n> \n> So looking at that particular example, arguably gitweb does something \n> \"different\" from what the commit message is talking about, but in many \n> ways it's a perfectly logical thing.\n> \n> However, diffing against the first parent, while it sometimes happens to \n> be a sane thing to do, really isn't very sane in general. The merge may go \n> the other way (subdevelopers merging my code), like in commit b2faf597, \n> and sometimes there might not be a single reference tree, but more of a \n> \"couple of main branches\" approach with merging back and forth). Then the \n> current gitweb behaviour makes no sense at all.\n> \n> So it would be much nicer if gitweb had some alternate approach to showing \n> merge diffs. My suggested approach would be to just let the user choose: \n> have separate \"diff against fist/second[/third[/..]] parent\" buttons. And \n> one of the choices would be the \"conflict view\" that git-diff-tree --cc \n> gives (I'd argue for that being the default one, because it's the only one \n> that doesn't have a \"preferred parent\").\n> \n> Kay?\n> \n> \t\tLinus\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n\ngit-whatchanged doesn't show that merge commit either.\n\n--\n\t\t\t\tBrian Gerst\n"},{"id":"15761","messageId":"Pine.LNX.4.64.0602081817040.2458@g5.osdl.org","threadId":"3270","inReplyTo":"43EAA560.8030504@didntduck.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T02:26:39Z","receivedAt":"2006-02-09T02:26:39Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 8 Feb 2006, Brian Gerst wrote:\n> \n> git-whatchanged doesn't show that merge commit either.\n\nActually, it does. You just have to ask it.\n\n\tgit-whatchanged --cc\n\nThe thing is, \"git-whatchanged\" is different from \"git diff\" and other \nhelpers, in that it by default shows the \"raw\" git representation. Which \nindeed doesn't show that merge as being anything interesting.\n\nBut with \"--cc\", the merge suddenly blossoms.\n\nNow, arguably, the raw format should default to the same kind of \"were \nthere data conflicts\" that \"-c\" does for merges, but it doesn't, so it's \nsilent ;(\n\n\t\tLinus\n"},{"id":"15762","messageId":"20060209031302.GA7214@vrfy.org","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602081532360.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Kay Sievers","fromEmail":"kay.sievers@suse.de","sentAt":"2006-02-09T03:13:02Z","receivedAt":"2006-02-09T03:13:02Z","isPatch":false,"sender":{"key":"kay.sievers@vrfy.org","avatar":null},"body":"On Wed, Feb 08, 2006 at 03:44:58PM -0800, Linus Torvalds wrote:\n> \n> I just did an arm merge that needed some (very trivial) manual fixups \n> (commit ID cce0cac1, in case anybody cares).\n> \n> As usual, git-diff-tree --cc does a beautiful job on it, but I also \n> checked the gitweb output, which seems to not do as well (the commit \n> message about a manual conflict merge doesn't make any sense at all).\n> \n> Now, in this case, what gitweb shows is actually \"sensible\": it will show \n> the diff of what the merge \"brought in\" to the mainline kernel, and in \n> that sense I can certainly understand it. It basically diffs the merge \n> against the first parent.\n> \n> So looking at that particular example, arguably gitweb does something \n> \"different\" from what the commit message is talking about, but in many \n> ways it's a perfectly logical thing.\n> \n> However, diffing against the first parent, while it sometimes happens to \n> be a sane thing to do, really isn't very sane in general. The merge may go \n> the other way (subdevelopers merging my code), like in commit b2faf597, \n> and sometimes there might not be a single reference tree, but more of a \n> \"couple of main branches\" approach with merging back and forth). Then the \n> current gitweb behaviour makes no sense at all.\n> \n> So it would be much nicer if gitweb had some alternate approach to showing \n> merge diffs. My suggested approach would be to just let the user choose: \n> have separate \"diff against fist/second[/third[/..]] parent\" buttons. And \n> one of the choices would be the \"conflict view\" that git-diff-tree --cc \n> gives (I'd argue for that being the default one, because it's the only one \n> that doesn't have a \"preferred parent\").\n\nHmm, I have no real clue what all the --cc is about. It's not obvious\nfor someone who never thought about \"meta patches\" or \"complex merges\". :)\n\nIf nobody else can do the changes to gitweb, sure, I'll do this and try\nto understand what is needed, but then I will need it explained in more\ndetails, what functionality we want to see here. At best with some commented\ncommandline examples that produce the data you want to see. So that I\ncan imagine what you are looking for and can give it a try ...\n\nOn the technical side for the kernel.org installation:\n  does git diff use /usr/bin/diff?\n\n  does git diff create temp files?\n\n  how can i specify the location for the temp files?\n  (wasn't possible some months ago, but needed on kernel.org)\n\n  is the temp file naming safe for a lot of git diff running in parallel?\n\n  is a --cc capable git already available on the kernel.org boxes?\n\nThanks,\nKay\n"},{"id":"15763","messageId":"7vu0b9jkad.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602081817040.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T03:14:18Z","receivedAt":"2006-02-09T03:14:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Now, arguably, the raw format should default to the same kind of \"were \n> there data conflicts\" that \"-c\" does for merges, but it doesn't, so it's \n> silent ;(\n\nTrue.  There was a discussion to come up with a sensible\nsemantics for -c without -p (currently --cc and -c implies -p),\nbut I haven't got around to it, since --cc was more useful in\ngeneral.\n\nVolunteers?\n"},{"id":"15790","messageId":"Pine.LNX.4.64.0602090822100.2458@g5.osdl.org","threadId":"3270","inReplyTo":"7vu0b9jkad.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T16:35:02Z","receivedAt":"2006-02-09T16:35:02Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 8 Feb 2006, Junio C Hamano wrote:\n> \n> True.  There was a discussion to come up with a sensible\n> semantics for -c without -p (currently --cc and -c implies -p),\n> but I haven't got around to it, since --cc was more useful in\n> general.\n> \n> Volunteers?\n\nThis is a first try at it.\n\nNOTE! This makes \"-c\" be the default, which effectively means that merges \nare never ignored any more, and \"-m\" is a no-op. So it changes semantics.\n\nI would also like to make \"--cc\" the default if you do patches, but didn't \nactually do that.\n\nThe raw output format is not wonderfully pretty, but it's distinguishable \nfrom a \"normal patch\" in that a normal patch with just one parent has just \none colon at the beginning, while a multi-parent raw diff has <n> colons \nfor <n> parents.\n\nSo now, in the kernel, when you do\n\n\tgit-diff-tree cce0cac125623f9b68f25dd1350f6d616220a8dd\n\n(to see the manual ARM merge that had a conflict in arch/arm/Kconfig), you \nget\n\n\tcce0cac125623f9b68f25dd1350f6d616220a8dd\n\t::100644 100644 100644 4a63a8e2e45247a11c068c6ed66c6e7aba29ddd9 77eee38762d69d3de95ae45dd9278df9b8225e2c 2f61726d2f4b636f6e66696700dbf71a59dad287       arch/arm/Kconfig\n\nie you see two colons (two parents), then three modes (parent modes \nfollowed by result mode), then three sha1s (parent sha1s followed by\nresult sha1).\n\nWhich is pretty close to the normal raw diff output.\n\nNOTE! There are a few known issues:\n\n - a normal raw output will also do the \"what happened\" status character. \n   I didn't. I'm stupid and lazy. It's not strictly needed (since it's \n   obvious from the multiple colons), but I suspect we should do \n   something to perhaps clarify what it is. Or just put \"M\" for \"modified \n   in merge\")\n\n - It doesn't honor the \"EOL\" character, so \"git-diff-tree -z\" does the \n   wrong thing. Gaah. I should have just passed down the whole \n   \"diff_options\" instead of just the format. I'm a retard.\n\nbut it's a beginning..\n\n\t\tLinus\n\n---\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 6a9f368..935ba2a 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -776,8 +776,35 @@ int show_combined_diff(struct combine_di\n \treturn shown_header;\n }\n \n+#define COLONS \"::::::::::::::::::::::::::::::::\"\n+\n+static void show_raw_diff(struct combine_diff_path *p, int num_parent, const char *header)\n+{\n+\tint i, offset;\n+\tconst char *prefix;\n+\n+\tif (header)\n+\t\tputs(header);\n+\toffset = strlen(COLONS) - num_parent;\n+\tif (offset < 0)\n+\t\toffset = 0;\n+\tprefix = COLONS + offset;\n+\n+\t/* Show the modes */\n+\tfor (i = 0; i < num_parent; i++) {\n+\t\tprintf(\"%s%06o\", prefix, p->parent[i].mode);\n+\t\tprefix = \" \";\n+\t}\n+\tprintf(\"%s%06o\", prefix, p->mode);\n+\tfor (i = 0; i < num_parent; i++) {\n+\t\tprintf(\"%s%s\", prefix, sha1_to_hex(p->parent[i].sha1));\n+\t\tprefix = \" \";\n+\t}\n+\tprintf(\"%s%s\\t%s\\n\", prefix, sha1_to_hex(p->parent[i].sha1), p->path);\n+}\n+\n int diff_tree_combined_merge(const unsigned char *sha1,\n-\t\t\t     const char *header, int dense)\n+\t\t\t     const char *header, int dense, int format)\n {\n \tstruct commit *commit = lookup_commit(sha1);\n \tstruct diff_options diffopts;\n@@ -815,6 +842,11 @@ int diff_tree_combined_merge(const unsig\n \t\tfor (p = paths; p; p = p->next) {\n \t\t\tif (!p->len)\n \t\t\t\tcontinue;\n+\t\t\tif (format == DIFF_FORMAT_RAW) {\n+\t\t\t\tshow_raw_diff(p, num_parent, header);\n+\t\t\t\theader = NULL;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (show_combined_diff(p, num_parent, dense, header))\n \t\t\t\theader = NULL;\n \t\t}\ndiff --git a/diff-tree.c b/diff-tree.c\nindex 7148323..78bce06 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -6,7 +6,7 @@ static int show_root_diff = 0;\n static int no_commit_id = 0;\n static int verbose_header = 0;\n static int ignore_merges = 1;\n-static int combine_merges = 0;\n+static int combine_merges = 1;\n static int dense_combined_merges = 0;\n static int read_stdin = 0;\n static int always_show_header = 0;\n@@ -118,7 +118,8 @@ static int diff_tree_commit(struct commi\n \t\telse if (combine_merges) {\n \t\t\theader = generate_header(sha1, sha1, commit);\n \t\t\treturn diff_tree_combined_merge(sha1, header,\n-\t\t\t\t\t\t\tdense_combined_merges);\n+\t\t\t\t\t\t\tdense_combined_merges,\n+\t\t\t\t\t\t\tdiff_options.output_format);\n \t\t}\n \t}\n \n@@ -285,10 +286,12 @@ int main(int argc, const char **argv)\n \t\tusage(diff_tree_usage);\n \t}\n \n-\tif (combine_merges) {\n-\t\tdiff_options.output_format = DIFF_FORMAT_PATCH;\n+\tif (combine_merges)\n \t\tignore_merges = 0;\n-\t}\n+\n+\t/* We can only do dense combined merges with diff output */\n+\tif (dense_combined_merges)\n+\t\tdiff_options.output_format = DIFF_FORMAT_PATCH;\n \n \tif (diff_options.output_format == DIFF_FORMAT_PATCH)\n \t\tdiff_options.recursive = 1;\ndiff --git a/diff.h b/diff.h\nindex 5c5e7fa..f7b3d2a 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -77,7 +77,7 @@ struct combine_diff_path {\n int show_combined_diff(struct combine_diff_path *elem, int num_parent,\n \t\t       int dense, const char *header);\n \n-extern int diff_tree_combined_merge(const unsigned char *sha1, const char *, int);\n+extern int diff_tree_combined_merge(const unsigned char *sha1, const char *, int, int);\n \n extern void diff_addremove(struct diff_options *,\n \t\t\t   int addremove,\n"},{"id":"15792","messageId":"Pine.LNX.4.64.0602090838460.2458@g5.osdl.org","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602090822100.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T16:42:39Z","receivedAt":"2006-02-09T16:42:39Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 9 Feb 2006, Linus Torvalds wrote:\n> \n> This is a first try at it.\n\nBtw, if it wasn't clear, this patch _does_ fix the fact that \n\"git-whatchanged\" didn't show merges even if they have conflicts.\n\nOf course, since the raw format is equivalent to \"-c\" and only bases its \n\"should I show\" logic on whether the file has changed at all, it very \nfundamentally will never be able to tell the difference between a real \ncontent conflict and something that just had file-level automatic merging. \n\nSo \"git-whatchanged\" will now show a lot of merges that didn't really \nchange anything, but that just merged on a file level (ie the whole merge \njust goes away when you specify \"--cc\").\n\nStill, that's actually interesting information too, so you can consider \nthis a feature.\n\n\t\tLinus\n"},{"id":"15793","messageId":"Pine.LNX.4.64.0602091029310.2458@g5.osdl.org","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602090822100.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T18:30:28Z","receivedAt":"2006-02-09T18:30:28Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n[ Apologies if this comes several times. I had a few failed attempts ]\n\nOn Thu, 9 Feb 2006, Linus Torvalds wrote:\n> \n> NOTE! There are a few known issues:\n> \n>  - a normal raw output will also do the \"what happened\" status character. \n>    I didn't. I'm stupid and lazy. It's not strictly needed (since it's \n>    obvious from the multiple colons), but I suspect we should do \n>    something to perhaps clarify what it is. Or just put \"M\" for \"modified \n>    in merge\")\n> \n>  - It doesn't honor the \"EOL\" character, so \"git-diff-tree -z\" does the \n>    wrong thing. Gaah. I should have just passed down the whole \n>    \"diff_options\" instead of just the format. I'm a retard.\n\nA few more:\n\n - it doesn't honor \"--abbrev\", which it really should\n\n - git-diff-tree doesn't do the right thing for \"header_prefix\".\n\nAnyway, this updated patch (throw the old one away) should fix all these \nissues.\n\nCool/stupid exercise:\n\n\tgit-whatchanged | grep '^::' | cut -f2- | sort | uniq -c | sort -n | less -S\n\nwill show which files have needed the most file-level merge conflict \nresolution. Useful? Probably not. But kind of interesting (for the kernel, \nit's \n\n     ....\n     10 arch/ia64/Kconfig\n     11 drivers/scsi/Kconfig\n     12 drivers/net/Makefile\n     17 include/linux/libata.h\n     18 include/linux/pci_ids.h\n     23 drivers/net/Kconfig\n     24 drivers/scsi/libata-scsi.c\n     28 drivers/scsi/libata-core.c\n     43 MAINTAINERS\n\nin case anybody cares).\n\n\t\tLinus\n\n---\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 6a9f368..15f369e 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -776,8 +776,52 @@ int show_combined_diff(struct combine_di\n \treturn shown_header;\n }\n \n-int diff_tree_combined_merge(const unsigned char *sha1,\n-\t\t\t     const char *header, int dense)\n+#define COLONS \"::::::::::::::::::::::::::::::::\"\n+\n+static void show_raw_diff(struct combine_diff_path *p, int num_parent, const char *header, struct diff_options *opt)\n+{\n+\tint i, offset, mod_type = 'A';\n+\tconst char *prefix;\n+\tint line_termination, inter_name_termination;\n+\n+\tline_termination = opt->line_termination;\n+\tinter_name_termination = '\\t';\n+\tif (!line_termination)\n+\t\tinter_name_termination = 0;\n+\n+\tif (header)\n+\t\tputs(header);\n+\toffset = strlen(COLONS) - num_parent;\n+\tif (offset < 0)\n+\t\toffset = 0;\n+\tprefix = COLONS + offset;\n+\n+\t/* Show the modes */\n+\tfor (i = 0; i < num_parent; i++) {\n+\t\tint mode = p->parent[i].mode;\n+\t\tif (mode)\n+\t\t\tmod_type = 'M';\n+\t\tprintf(\"%s%06o\", prefix, mode);\n+\t\tprefix = \" \";\n+\t}\n+\tprintf(\"%s%06o\", prefix, p->mode);\n+\tif (!p->mode)\n+\t\tmod_type = 'D';\n+\n+\t/* Show sha1's */\n+\tfor (i = 0; i < num_parent; i++) {\n+\t\tprintf(\"%s%s\", prefix, diff_unique_abbrev(p->parent[i].sha1, opt->abbrev));\n+\t\tprefix = \" \";\n+\t}\n+\tprintf(\"%s%s\", prefix, diff_unique_abbrev(p->sha1, opt->abbrev));\n+\n+\t/* Modification type, terminations, filename */\n+\tprintf(\" %c%c%s%c\", mod_type, inter_name_termination, p->path, line_termination);\n+}\n+\n+const char *diff_tree_combined_merge(const unsigned char *sha1,\n+\t\t\t     const char *header, int dense,\n+\t\t\t     struct diff_options *opt)\n {\n \tstruct commit *commit = lookup_commit(sha1);\n \tstruct diff_options diffopts;\n@@ -815,6 +859,11 @@ int diff_tree_combined_merge(const unsig\n \t\tfor (p = paths; p; p = p->next) {\n \t\t\tif (!p->len)\n \t\t\t\tcontinue;\n+\t\t\tif (opt->output_format == DIFF_FORMAT_RAW) {\n+\t\t\t\tshow_raw_diff(p, num_parent, header, opt);\n+\t\t\t\theader = NULL;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (show_combined_diff(p, num_parent, dense, header))\n \t\t\t\theader = NULL;\n \t\t}\n@@ -826,5 +875,5 @@ int diff_tree_combined_merge(const unsig\n \t\tpaths = paths->next;\n \t\tfree(tmp);\n \t}\n-\treturn 0;\n+\treturn header;\n }\ndiff --git a/diff-tree.c b/diff-tree.c\nindex 7148323..df6fd97 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -6,7 +6,7 @@ static int show_root_diff = 0;\n static int no_commit_id = 0;\n static int verbose_header = 0;\n static int ignore_merges = 1;\n-static int combine_merges = 0;\n+static int combine_merges = 1;\n static int dense_combined_merges = 0;\n static int read_stdin = 0;\n static int always_show_header = 0;\n@@ -117,8 +117,12 @@ static int diff_tree_commit(struct commi\n \t\t\treturn 0;\n \t\telse if (combine_merges) {\n \t\t\theader = generate_header(sha1, sha1, commit);\n-\t\t\treturn diff_tree_combined_merge(sha1, header,\n-\t\t\t\t\t\t\tdense_combined_merges);\n+\t\t\theader = diff_tree_combined_merge(sha1, header,\n+\t\t\t\t\t\t\tdense_combined_merges,\n+\t\t\t\t\t\t\t&diff_options);\n+\t\t\tif (!header && verbose_header)\n+\t\t\t\theader_prefix = \"\\ndiff-tree \";\n+\t\t\treturn 0;\n \t\t}\n \t}\n \n@@ -285,10 +289,12 @@ int main(int argc, const char **argv)\n \t\tusage(diff_tree_usage);\n \t}\n \n-\tif (combine_merges) {\n-\t\tdiff_options.output_format = DIFF_FORMAT_PATCH;\n+\tif (combine_merges)\n \t\tignore_merges = 0;\n-\t}\n+\n+\t/* We can only do dense combined merges with diff output */\n+\tif (dense_combined_merges)\n+\t\tdiff_options.output_format = DIFF_FORMAT_PATCH;\n \n \tif (diff_options.output_format == DIFF_FORMAT_PATCH)\n \t\tdiff_options.recursive = 1;\ndiff --git a/diff.h b/diff.h\nindex 5c5e7fa..9088519 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -74,10 +74,10 @@ struct combine_diff_path {\n \t(sizeof(struct combine_diff_path) + \\\n \t sizeof(struct combine_diff_parent) * (n) + (l) + 1)\n \n-int show_combined_diff(struct combine_diff_path *elem, int num_parent,\n-\t\t       int dense, const char *header);\n+extern int show_combined_diff(struct combine_diff_path *elem, int num_parent,\n+\t\t\t      int dense, const char *header);\n \n-extern int diff_tree_combined_merge(const unsigned char *sha1, const char *, int);\n+extern const char *diff_tree_combined_merge(const unsigned char *sha1, const char *, int, struct diff_options *opt);\n \n extern void diff_addremove(struct diff_options *,\n \t\t\t   int addremove,\n"},{"id":"15795","messageId":"7v3bisb9qn.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091029310.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T19:41:36Z","receivedAt":"2006-02-09T19:41:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I was wondering if we could teach not diff_tree_combined_merge\nbut show_combined_diff to do this, so that diff-files -c would\nbenefit from the raw output as wel.\n\nThat aside, one remaining nit with your patch is printing\np->path.  diff.c::diff_flush_raw() does something like this:\n\n\tif (line_termination) {\n\t\tpath_one = quote_one(path_one);\n\t\tpath_two = quote_one(path_two);\n\t}\n\t...\n\tprintf(\"%s%c%s\", status, inter_name_termination, path_one);\n\nBut otherwise from a cursory look the patch appears correct.\n\nThanks.\n"},{"id":"15800","messageId":"Pine.LNX.4.64.0602091216460.2458@g5.osdl.org","threadId":"3270","inReplyTo":"7v3bisb9qn.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T20:27:58Z","receivedAt":"2006-02-09T20:27:58Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 9 Feb 2006, Junio C Hamano wrote:\n>\n> I was wondering if we could teach not diff_tree_combined_merge\n> but show_combined_diff to do this, so that diff-files -c would\n> benefit from the raw output as wel.\n\nI wanted to do it that way, but it seemed less intrusive this way.\n\nI agree that it is the correct thing to do, though.\n\n> That aside, one remaining nit with your patch is printing\n> p->path.  diff.c::diff_flush_raw() does something like this:\n> \n> \tif (line_termination) {\n> \t\tpath_one = quote_one(path_one);\n> \t\tpath_two = quote_one(path_two);\n> \t}\n> \t...\n> \tprintf(\"%s%c%s\", status, inter_name_termination, path_one);\n\nGood point.\n\nI found another nitpick: file removal doesn't seem to generate a good \ndiff in \"git-diff-tree --cc\" (but it's correct in the new \"raw\" format \ndiff).\n\nHere's a test-case, in case you care. Do \"git-diff-tree --cc HEAD\" in the \nmerge-test directory.\n\nFinally, I think it would be good to have a \"--ignore-mode\" flag that \ndrops the mode info from the raw format (that repeating \"100644\" really \nisn't very interesting, and caring about mode changes is pretty rare).\n\n\t\tLinus\n\n---\n#!/bin/sh\nrm -rf merge-test\nmkdir merge-test\ncd merge-test/\ngit-init-db \n\necho \"hello\" > a\necho \"hi there\" > b\ngit add a b\ngit commit -m \"Initial commit of 'a' and 'b'\"\ngit branch other\n\necho \"different hello\" > a\ngit commit -m \"Changed 'a'\" a\n\ngit checkout other\necho \"another different hello\" > a\ngit commit -m \"Changed 'a' differently\" a\n\ngit checkout master\ngit merge \"merge other\" HEAD other >& /dev/null\n\necho \"final hello\" > a\nrm -f b\necho \"new file\" > c\ngit-update-index --add --remove a b c\ngit commit -m \"Evil merge\"\n"},{"id":"15801","messageId":"Pine.LNX.4.64.0602091235210.2458@g5.osdl.org","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091216460.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T20:37:09Z","receivedAt":"2006-02-09T20:37:09Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 9 Feb 2006, Linus Torvalds wrote:\n> \n> Here's a test-case, in case you care. Do \"git-diff-tree --cc HEAD\" in the \n> merge-test directory.\n\nBtw, that test-case is also designed to show the different M/A/D cases for \nthe merge result. The merge diff obviously doesn't do rename/copy \ndetection (I don't think it's necessarily even a well-defined op, or if \nit is, it's damn complicated).\n\n\t\tLinus\n"},{"id":"15802","messageId":"7vd5hw9sk1.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091216460.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T20:38:06Z","receivedAt":"2006-02-09T20:38:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> I found another nitpick: file removal doesn't seem to generate a good \n> diff in \"git-diff-tree --cc\" (but it's correct in the new \"raw\" format \n> diff).\n>\n> Here's a test-case, in case you care.\n\nActually, I've known about the removals and have excuse in one\nof the commits why it does not show them.\n\nIt is an excuse (the internal data structure is not really\nsuited to show removal diff), but I think what the excuse gives\nas the official reasoning behind it sort of make sense from\nusability point of view as well.\n"},{"id":"15803","messageId":"7v8xsk9s3v.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091235210.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T20:47:48Z","receivedAt":"2006-02-09T20:47:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Thu, 9 Feb 2006, Linus Torvalds wrote:\n>> \n>> Here's a test-case, in case you care. Do \"git-diff-tree --cc HEAD\" in the \n>> merge-test directory.\n>\n> Btw, that test-case is also designed to show the different M/A/D cases for \n> the merge result. The merge diff obviously doesn't do rename/copy \n> detection (I don't think it's necessarily even a well-defined op, or if \n> it is, it's damn complicated).\n\nAlthough I've never seriously tried it, I think \"diff-tree --cc\"\nwith -M or -C should do a decent job.  The initial phase to feed\ncombine-diff runs with the supplied rename/copy options if I am\nnot mistaken, and from the result it grabs one->{sha1,mode} (for\nparent) and two->{sha1,mode} (obviously for merge result) to\nfeed combine-diff logic, while discarding one->path information.\n\nSo obviously it would show the final paths and would not talk\nabout which different path from each parent contributed to the\nresult, but otherwise it should not be broken too much.  At\nleast that was the way I intended..\n"},{"id":"15804","messageId":"Pine.LNX.4.64.0602091246010.2458@g5.osdl.org","threadId":"3270","inReplyTo":"7vd5hw9sk1.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-09T20:50:56Z","receivedAt":"2006-02-09T20:50:56Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 9 Feb 2006, Junio C Hamano wrote:\n> \n> Actually, I've known about the removals and have excuse in one\n> of the commits why it does not show them.\n> \n> It is an excuse (the internal data structure is not really\n> suited to show removal diff), but I think what the excuse gives\n> as the official reasoning behind it sort of make sense from\n> usability point of view as well.\n\nFair enough. It looks a bit strange in gitk, but maybe that could be \nrectified by just making the new/deleted file case say so explcitly \ninstead of having the \"mode\" line.\n\nSo instead of just \"mode\", how about saying \"deleted file mode\" or \n\"new file mode\" the way that the regular diffs do (but then not showing \nthe contents for the deleted case).\n\n\t\tLinus\n"},{"id":"15805","messageId":"7v4q389rwi.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7v8xsk9s3v.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T20:52:13Z","receivedAt":"2006-02-09T20:52:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> So obviously it would show the final paths and would not talk\n> about which different path from each parent contributed to the\n> result, but otherwise it should not be broken too much.  At\n> least that was the way I intended..\n\nSorry, I am wrong again.  That was the way how I planned to, but\nI think I forgot to pass the diff-options from the caller to\ndiff_tree_combined_merge(), so it does not do renames/copies.\n\nShouldn't be too hard to change it though...\n"},{"id":"15806","messageId":"7vzml08cfm.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091246010.2458@g5.osdl.org","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T21:11:41Z","receivedAt":"2006-02-09T21:11:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> So instead of just \"mode\", how about saying \"deleted file mode\" or \n> \"new file mode\" the way that the regular diffs do (but then not showing \n> the contents for the deleted case).\n\nSounds sensible.  Will do this evening after work.\n"},{"id":"15809","messageId":"7voe1g8air.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7v4q389rwi.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T21:53:00Z","receivedAt":"2006-02-09T21:53:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>\n>> So obviously it would show the final paths and would not talk\n>> about which different path from each parent contributed to the\n>> result, but otherwise it should not be broken too much.  At\n>> least that was the way I intended..\n>\n> Sorry, I am wrong again.  That was the way how I planned to, but\n> I think I forgot to pass the diff-options from the caller to\n> diff_tree_combined_merge(), so it does not do renames/copies.\n>\n> Shouldn't be too hard to change it though...\n\nOn top of your patch, it was quite easy ;-)\n\nAfter the \"Evil merge\" in your test script, I added these:\n\n        for i in a b c d e f g h i j k l m n; do echo $i; done >d\n        git-update-index --add d\n        git commit -m 'Add d'\n\n        git checkout other\n        git merge fast HEAD master\n\n        mv d e\n        echo o >>e\n        git-update-index --add --remove d e\n        git commit -m 'Move-edit d to e'\n\n        git checkout master\n        git merge -s recursive 'Merge' HEAD other\n\n        git diff-tree -M --cc HEAD\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 15f369e..2a0ec10 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -829,7 +829,7 @@ const char *diff_tree_combined_merge(con\n \tstruct combine_diff_path *p, *paths = NULL;\n \tint num_parent, i, num_paths;\n \n-\tdiff_setup(&diffopts);\n+\tdiffopts = *opt;\n \tdiffopts.output_format = DIFF_FORMAT_NO_OUTPUT;\n \tdiffopts.recursive = 1;\n \n"},{"id":"15810","messageId":"7vk6c48a69.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7voe1g8air.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T22:00:30Z","receivedAt":"2006-02-09T22:00:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> On top of your patch, it was quite easy ;-)\n>\n> After the \"Evil merge\" in your test script, I added these:\n>\n>...\n>\n>         git diff-tree -M --cc HEAD\n\nSorry for the noise.  The test was broken.\n"},{"id":"15811","messageId":"7v3bis88y9.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7vk6c48a69.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T22:26:54Z","receivedAt":"2006-02-09T22:26:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>\n>> On top of your patch, it was quite easy ;-)\n>>\n>> After the \"Evil merge\" in your test script, I added these:\n>>\n>>...\n>>\n>>         git diff-tree -M --cc HEAD\n>\n> Sorry for the noise.  The test was broken.\n\nSecond try.  Sorry again for the previous noise.\n\nThis time I made sure I am getting double-colon output;\nhere is what I added after your test script:\n\n        for i in a b c d e f g h i j k l m n; do echo $i; done >d\n        git-update-index --add d\n        git commit -m 'Add d'\n\n        git checkout other\n        git merge fast HEAD master\n\n        echo o >>d\n        git-update-index d\n        git commit -m 'Edit d'\n\n        git checkout master\n        echo 'Another' >>a\n        git-update-index a\n        git commit -m 'Modify a'\n        git merge --no-commit 'Merge' HEAD other\n        echo Extra >>a\n        mv d e\n        echo extra >>e\n        git update-index --add --remove a d e\n        git commit -m 'Evil again'\n\n        git diff-tree -M -c HEAD\n\nBut you are right.  Rename detection with combined diff has a\nfunny semantics:\n\n    diff-tree 9df5f2d... (from parents)\n    Merge: 1da47fa... 09eee61...\n    Author: Junio C Hamano <junkio@cox.net>\n    Date:   Thu Feb 9 14:11:13 2006 -0800\n\n        Evil again\n\n    ::100644 100644 100644 8c3beaf... aad9366... c54c990... M\ta\n    ::100644 100644 100644 4f7cbe7... f8c295c... 19d5d80... M\te\n\nThis is showing that what was \"d\" was somehow magically called\n\"e\" in the merge result with its own changes.  --cc output is\nmore interesting but the point is there is no sign of \"d\" in its\noutput, which does not feel right.\n\nIf we really care, we could show a status letter for each parent\n(both are renames in this case but it is plausible one parent is\nrename-edit and another is modify) and the original path in each\nparent.\n\nDoes it matter?  I presume that a Porcelain that cares would\nrather use the traditional \"diff-tree -m -r\" to look at diff\nwith each parent.  I dunno.\n\n---\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 15f369e..6d78305 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -829,7 +829,7 @@ const char *diff_tree_combined_merge(con\n \tstruct combine_diff_path *p, *paths = NULL;\n \tint num_parent, i, num_paths;\n \n-\tdiff_setup(&diffopts);\n+\tdiffopts = *opt;\n \tdiffopts.output_format = DIFF_FORMAT_NO_OUTPUT;\n \tdiffopts.recursive = 1;\n \n@@ -846,6 +846,7 @@ const char *diff_tree_combined_merge(con\n \t\tstruct commit *parent = parents->item;\n \t\tdiff_tree_sha1(parent->object.sha1, commit->object.sha1, \"\",\n \t\t\t       &diffopts);\n+\t\tdiffcore_std(&diffopts);\n \t\tpaths = intersect_paths(paths, i, num_parent);\n \t\tdiff_flush(&diffopts);\n \t}\n"},{"id":"15819","messageId":"7vbqxg6qkj.fsf_-_@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"Pine.LNX.4.64.0602091216460.2458@g5.osdl.org","subject":"[PATCH] combine-diff: move formatting logic to show_combined_diff()","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-09T23:49:16Z","receivedAt":"2006-02-09T23:49:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Thu, 9 Feb 2006, Junio C Hamano wrote:\n>>\n>> I was wondering if we could teach not diff_tree_combined_merge\n>> but show_combined_diff to do this, so that diff-files -c would\n>> benefit from the raw output as wel.\n>\n> I wanted to do it that way, but it seemed less intrusive this way.\n>\n> I agree that it is the correct thing to do, though.\n\nThis comes on top of the earlier \"use diffcore_std()\" patch.\n\n-- >8 --\nThis way, diff-files can make use of it.  Also implement the\nfull suite of what diff_flush_raw() supports just for\nconsistency.  With this, 'diff-tree -c -r --name-status' would\nshow what is expected.\n\nThere is no way to get the historical output (useful for\ndebugging and low-level Plumbing work) anymore, so tentatively\nit makes '-m' to mean \"do not combine and show individual diffs\nwith parents\".\n\ndiff-files matches diff-tree to produce raw output for -c.  For\ntextual combined diff, use -p -c.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n combine-diff.c |   85 ++++++++++++++++++++++++++++++++++++++------------------\n diff-files.c   |    6 ++--\n diff-tree.c    |    2 +\n diff.h         |    3 +-\n 4 files changed, 64 insertions(+), 32 deletions(-)\n\n0a798076b8d1a4a31bf2b24c564e2a99fd1c43a1\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 6d78305..9aa099b 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -618,8 +618,8 @@ static void reuse_combine_diff(struct sl\n \tsline->p_lno[i] = sline->p_lno[j];\n }\n \n-int show_combined_diff(struct combine_diff_path *elem, int num_parent,\n-\t\t       int dense, const char *header)\n+static int show_patch_diff(struct combine_diff_path *elem, int num_parent,\n+\t\t\t   int dense, const char *header)\n {\n \tunsigned long size, cnt, lno;\n \tchar *result, *cp, *ep;\n@@ -791,32 +791,69 @@ static void show_raw_diff(struct combine\n \n \tif (header)\n \t\tputs(header);\n-\toffset = strlen(COLONS) - num_parent;\n-\tif (offset < 0)\n-\t\toffset = 0;\n-\tprefix = COLONS + offset;\n \n-\t/* Show the modes */\n \tfor (i = 0; i < num_parent; i++) {\n-\t\tint mode = p->parent[i].mode;\n-\t\tif (mode)\n+\t\tif (p->parent[i].mode)\n \t\t\tmod_type = 'M';\n-\t\tprintf(\"%s%06o\", prefix, mode);\n-\t\tprefix = \" \";\n \t}\n-\tprintf(\"%s%06o\", prefix, p->mode);\n \tif (!p->mode)\n \t\tmod_type = 'D';\n \n-\t/* Show sha1's */\n-\tfor (i = 0; i < num_parent; i++) {\n-\t\tprintf(\"%s%s\", prefix, diff_unique_abbrev(p->parent[i].sha1, opt->abbrev));\n-\t\tprefix = \" \";\n+\tif (opt->output_format == DIFF_FORMAT_RAW) {\n+\t\toffset = strlen(COLONS) - num_parent;\n+\t\tif (offset < 0)\n+\t\t\toffset = 0;\n+\t\tprefix = COLONS + offset;\n+\n+\t\t/* Show the modes */\n+\t\tfor (i = 0; i < num_parent; i++) {\n+\t\t\tprintf(\"%s%06o\", prefix, p->parent[i].mode);\n+\t\t\tprefix = \" \";\n+\t\t}\n+\t\tprintf(\"%s%06o\", prefix, p->mode);\n+\n+\t\t/* Show sha1's */\n+\t\tfor (i = 0; i < num_parent; i++)\n+\t\t\tprintf(\" %s\", diff_unique_abbrev(p->parent[i].sha1,\n+\t\t\t\t\t\t\t opt->abbrev));\n+\t\tprintf(\" %s \", diff_unique_abbrev(p->sha1, opt->abbrev));\n+\t}\n+\n+\tif (opt->output_format == DIFF_FORMAT_RAW ||\n+\t    opt->output_format == DIFF_FORMAT_NAME_STATUS)\n+\t\tprintf(\"%c%c\", mod_type, inter_name_termination);\n+\n+\tif (line_termination) {\n+\t\tif (quote_c_style(p->path, NULL, NULL, 0))\n+\t\t\tquote_c_style(p->path, NULL, stdout, 0);\n+\t\telse\n+\t\t\tprintf(\"%s\", p->path);\n+\t\tputchar(line_termination);\n \t}\n-\tprintf(\"%s%s\", prefix, diff_unique_abbrev(p->sha1, opt->abbrev));\n+\telse {\n+\t\tprintf(\"%s%c\", p->path, line_termination);\n+\t}\n+}\n \n-\t/* Modification type, terminations, filename */\n-\tprintf(\" %c%c%s%c\", mod_type, inter_name_termination, p->path, line_termination);\n+int show_combined_diff(struct combine_diff_path *p,\n+\t\t       int num_parent,\n+\t\t       int dense,\n+\t\t       const char *header,\n+\t\t       struct diff_options *opt)\n+{\n+\tif (!p->len)\n+\t\treturn 0;\n+\tswitch (opt->output_format) {\n+\tcase DIFF_FORMAT_RAW:\n+\tcase DIFF_FORMAT_NAME_STATUS:\n+\tcase DIFF_FORMAT_NAME:\n+\t\tshow_raw_diff(p, num_parent, header, opt);\n+\t\treturn 1;\n+\n+\tdefault:\n+\tcase DIFF_FORMAT_PATCH:\n+\t\treturn show_patch_diff(p, num_parent, dense, header);\n+\t}\n }\n \n const char *diff_tree_combined_merge(const unsigned char *sha1,\n@@ -858,14 +895,8 @@ const char *diff_tree_combined_merge(con\n \t}\n \tif (num_paths) {\n \t\tfor (p = paths; p; p = p->next) {\n-\t\t\tif (!p->len)\n-\t\t\t\tcontinue;\n-\t\t\tif (opt->output_format == DIFF_FORMAT_RAW) {\n-\t\t\t\tshow_raw_diff(p, num_parent, header, opt);\n-\t\t\t\theader = NULL;\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\tif (show_combined_diff(p, num_parent, dense, header))\n+\t\t\tif (show_combined_diff(p, num_parent, dense,\n+\t\t\t\t\t       header, opt))\n \t\t\t\theader = NULL;\n \t\t}\n \t}\ndiff --git a/diff-files.c b/diff-files.c\nindex d24d11c..7db5ce6 100644\n--- a/diff-files.c\n+++ b/diff-files.c\n@@ -88,9 +88,8 @@ int main(int argc, const char **argv)\n \t\t}\n \t\targv++; argc--;\n \t}\n-\tif (combine_merges) {\n+\tif (dense_combined_merges)\n \t\tdiff_options.output_format = DIFF_FORMAT_PATCH;\n-\t}\n \n \t/* Find the directory, and set up the pathspec */\n \tpathspec = get_pathspec(prefix, argv + 1);\n@@ -166,7 +165,8 @@ int main(int argc, const char **argv)\n \t\t\tif (combine_merges && num_compare_stages == 2) {\n \t\t\t\tshow_combined_diff(&combine.p, 2,\n \t\t\t\t\t\t   dense_combined_merges,\n-\t\t\t\t\t\t   NULL);\n+\t\t\t\t\t\t   NULL,\n+\t\t\t\t\t\t   &diff_options);\n \t\t\t\tfree(combine.p.path);\n \t\t\t\tcontinue;\n \t\t\t}\ndiff --git a/diff-tree.c b/diff-tree.c\nindex df6fd97..b170b03 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -248,7 +248,7 @@ int main(int argc, const char **argv)\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"-m\")) {\n-\t\t\tignore_merges = 0;\n+\t\t\tcombine_merges = ignore_merges = 0;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"-c\")) {\ndiff --git a/diff.h b/diff.h\nindex 9088519..946a406 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -75,7 +75,8 @@ struct combine_diff_path {\n \t sizeof(struct combine_diff_parent) * (n) + (l) + 1)\n \n extern int show_combined_diff(struct combine_diff_path *elem, int num_parent,\n-\t\t\t      int dense, const char *header);\n+\t\t\t      int dense, const char *header,\n+\t\t\t      struct diff_options *);\n \n extern const char *diff_tree_combined_merge(const unsigned char *sha1, const char *, int, struct diff_options *opt);\n \n-- \n1.1.6.gce16\n"},{"id":"15847","messageId":"7vzmkzwk9u.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"7vzml08cfm.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] combine-diff: Record diff status a bit more faithfully","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-10T11:00:45Z","receivedAt":"2006-02-10T11:00:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This shows \"new file mode XXXX\" and \"deleted file mode XXXX\"\nlines like two-way diff-patch output does, by checking the\nstatus from each parent.\n\nThe diff-raw output for combined diff is made a bit uglier by\nshowing diff status letters with each parent.  While most of the\ncase you would see \"MM\" in the output, an Evil Merge that\ntouches a path that was added by inheriting from one parent is\npossible and it would be shown like these:\n\n    $ git-diff-tree --abbrev -c HEAD\n    2d7ca89675eb8888b0b88a91102f096d4471f09f\n    ::000000 000000 100644 0000000... 0000000... 31dd686... AA\tb\n    ::000000 100644 100644 0000000... 6c884ae... c6d4fa8... AM\td\n    ::100644 100644 100644 4f7cbe7... f8c295c... 19d5d80... RR\te\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * I also considered showing the rename detection scores but\n   felt it was too much information, so refrained from it.\n   Maybe MM might be too much, but knowing most of the merges\n   are only two parents' kind, one extra column would not be too\n   much noise.\n\n   By looking at -c -p or --cc output, you cannot tell any\n   renames, which makes me feel a bit uneasy.  I suspect this\n   is going into purely academic realm and would not be useful\n   in practice at all, so I'd say we should stop ;-).\n\n combine-diff.c |   32 +++++++++++++++++++++++++-------\n diff.h         |    1 +\n 2 files changed, 26 insertions(+), 7 deletions(-)\n\ndc33c79b0f69a1e9acee740a2f7ac5eacfdd49ce\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 8ba6949..a38f01b 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -39,6 +39,7 @@ static struct combine_diff_path *interse\n \t\t\tp->mode = q->queue[i]->two->mode;\n \t\t\tmemcpy(p->parent[n].sha1, q->queue[i]->one->sha1, 20);\n \t\t\tp->parent[n].mode = q->queue[i]->one->mode;\n+\t\t\tp->parent[n].status = q->queue[i]->status;\n \t\t\t*tail = p;\n \t\t\ttail = &p->next;\n \t\t}\n@@ -62,6 +63,7 @@ static struct combine_diff_path *interse\n \t\t\t\tmemcpy(p->parent[n].sha1,\n \t\t\t\t       q->queue[i]->one->sha1, 20);\n \t\t\t\tp->parent[n].mode = q->queue[i]->one->mode;\n+\t\t\t\tp->parent[n].status = q->queue[i]->status;\n \t\t\t\tbreak;\n \t\t\t}\n \t\t}\n@@ -739,12 +741,25 @@ static int show_patch_diff(struct combin\n \t\tprintf(\"..%s\\n\", abb);\n \n \t\tif (mode_differs) {\n-\t\t\tprintf(\"mode \");\n-\t\t\tfor (i = 0; i < num_parent; i++) {\n-\t\t\t\tprintf(\"%s%06o\", i ? \",\" : \"\",\n-\t\t\t\t       elem->parent[i].mode);\n+\t\t\tint added = !!elem->mode;\n+\t\t\tfor (i = 0; added && i < num_parent; i++)\n+\t\t\t\tif (elem->parent[i].status !=\n+\t\t\t\t    DIFF_STATUS_ADDED)\n+\t\t\t\t\tadded = 0;\n+\t\t\tif (added)\n+\t\t\t\tprintf(\"new file mode %06o\", elem->mode);\n+\t\t\telse {\n+\t\t\t\tif (!elem->mode)\n+\t\t\t\t\tprintf(\"deleted file \");\n+\t\t\t\tprintf(\"mode \");\n+\t\t\t\tfor (i = 0; i < num_parent; i++) {\n+\t\t\t\t\tprintf(\"%s%06o\", i ? \",\" : \"\",\n+\t\t\t\t\t       elem->parent[i].mode);\n+\t\t\t\t}\n+\t\t\t\tif (elem->mode)\n+\t\t\t\t\tprintf(\"..%06o\", elem->mode);\n \t\t\t}\n-\t\t\tprintf(\"..%06o\\n\", elem->mode);\n+\t\t\tputchar('\\n');\n \t\t}\n \t\tdump_sline(sline, cnt, num_parent);\n \t}\n@@ -811,8 +826,11 @@ static void show_raw_diff(struct combine\n \t}\n \n \tif (opt->output_format == DIFF_FORMAT_RAW ||\n-\t    opt->output_format == DIFF_FORMAT_NAME_STATUS)\n-\t\tprintf(\"%c%c\", mod_type, inter_name_termination);\n+\t    opt->output_format == DIFF_FORMAT_NAME_STATUS) {\n+\t\tfor (i = 0; i < num_parent; i++)\n+\t\t\tputchar(p->parent[i].status);\n+\t\tputchar(inter_name_termination);\n+\t}\n \n \tif (line_termination) {\n \t\tif (quote_c_style(p->path, NULL, NULL, 0))\ndiff --git a/diff.h b/diff.h\nindex 946a406..8fac465 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -66,6 +66,7 @@ struct combine_diff_path {\n \tunsigned int mode;\n \tunsigned char sha1[20];\n \tstruct combine_diff_parent {\n+\t\tchar status;\n \t\tunsigned int mode;\n \t\tunsigned char sha1[20];\n \t} parent[FLEX_ARRAY];\n-- \n1.1.6.g94c6\n"},{"id":"15911","messageId":"e5bfff550602110117i7b742351m14e908de10aac12c@mail.gmail.com","threadId":"3270","inReplyTo":"7v3bis88y9.fsf@assigned-by-dhcp.cox.net","subject":"Re: gitweb using \"--cc\"?","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-02-11T09:17:19Z","receivedAt":"2006-02-11T09:17:19Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 2/9/06, Junio C Hamano <junkio@cox.net> wrote:\n>\n> Does it matter?  I presume that a Porcelain that cares would\n> rather use the traditional \"diff-tree -m -r\" to look at diff\n> with each parent.  I dunno.\n>\n\nYes, please preserve this behaviour.\n\nI pulled today the diff-tree -c semantic change and now I see, in git archive:\n\n$ git-diff-tree -r ca182053c7710a286d72102f4576cf32e0dafcfb\nca182053c7710a286d72102f4576cf32e0dafcfb\n::100644 100644 100644 538d21d808b7ccc287e7bdd947f1583eadcda28b\n30479b4a19805132a16facf6342b1438427486b7\n59042d1bc9ee65063455b50a0968efb0b8182577 MM        Makefile\n\n$ git-diff-tree -r -m ca182053c7710a286d72102f4576cf32e0dafcfb\nca182053c7710a286d72102f4576cf32e0dafcfb\n:100644 100644 538d21d808b7ccc287e7bdd947f1583eadcda28b\n59042d1bc9ee65063455b50a0968efb0b8182577 M      Makefile\n:100644 100644 410b758aab7efc6d777f0344500f97b1cbc52946\n6c47c3a3e1acb8badaadad42dfe3d0bd7a06cac3 M      entry.c\nca182053c7710a286d72102f4576cf32e0dafcfb\n:100644 100644 30479b4a19805132a16facf6342b1438427486b7\n59042d1bc9ee65063455b50a0968efb0b8182577 M      Makefile\n\nPlease _do not_ change this behaviour to make -m a no-op as stated in\n\"diff-tree -c raw output\" patch message\n(ee63802422af14e43eccce3c6dc4150a27ceb1a3).\n\nqgit has the possibility to switch from \"see all merge files\" to \"see\ninteresting only\", so\nwe really need that difference between 'git-diff-tree -r' and\n'git-diff-tree -r -m'\n\nAnyhow I am very happy with this change because it broke qgit ;-) but when fixed\nit will have a lot of code removed and will be faster too.\n\nThanks\nMarco\n"},{"id":"15939","messageId":"7vhd75n13j.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"e5bfff550602110117i7b742351m14e908de10aac12c@mail.gmail.com","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-11T19:32:00Z","receivedAt":"2006-02-11T19:32:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n> On 2/9/06, Junio C Hamano <junkio@cox.net> wrote:\n>>\n>> Does it matter?  I presume that a Porcelain that cares would\n>> rather use the traditional \"diff-tree -m -r\" to look at diff\n>> with each parent.  I dunno.\n>\n> Yes, please preserve this behaviour.\n>...\n> Please _do not_ change this behaviour to make -m a no-op as stated in\n> \"diff-tree -c raw output\" patch message\n> (ee63802422af14e43eccce3c6dc4150a27ceb1a3).\n\nThe one you pulled already contains another one to fix that\nee6380 change done by gittus.  What \"diff-tree -r -m ca1820\"\nshows should be the same as traditional \"diff-tree -r -m ca1820\"\noutput.\n\nWhat is different is \"diff-tree ca1820\".  It used to show\n*nothing* only because it is a merge.  It now defaults to show\n\"diff-tree -c ca1820\".\n\nFor the sake of backward compatibility we could change it to not\noutput anything, but I sort of feel that is backwards.  If a\nPorcelain wants raw-diff for 1 (or more) parents, \"diff-tree -r\n-m\" has been the way to do so before the ee6380 change, and that\noutput has not changed (well ee6380 might have changed it but\nnow it is fixed).\n"},{"id":"15940","messageId":"7vslqplih3.fsf@assigned-by-dhcp.cox.net","threadId":"3270","inReplyTo":"e5bfff550602110117i7b742351m14e908de10aac12c@mail.gmail.com","subject":"Re: gitweb using \"--cc\"?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-11T20:59:36Z","receivedAt":"2006-02-11T20:59:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n> Please _do not_ change this behaviour to make -m a no-op as stated in\n> \"diff-tree -c raw output\" patch message\n> (ee63802422af14e43eccce3c6dc4150a27ceb1a3).\n>\n> qgit has the possibility to switch from \"see all merge files\"\n> to \"see interesting only\", so we really need that difference\n> between 'git-diff-tree -r' and 'git-diff-tree -r -m'\n\nLet me make sure I am not misreading you.  You are proposing to\nrevert making -m a no-op.  So '-r' and '-r -m' would do\ndifferent things, like illustrated in the log message below.\n\nAll of the above combinations of flags produces the same result\nfor non-merge commit, by the way.\n\nAck, or did I grossly misunderstand what you wanted?\n\n-- >8 --\n[PATCH] diff-tree: do not default to -c\n\nMarco says it breaks qgit.  This makes the flags a bit more\northogonal.\n\n  $ git-diff-tree -r --abbrev ca18\n\n    No output from this command because you asked to skip merge by\n    not having -m there.\n\n  $ git-diff-tree -r -m --abbrev ca18\n  ca182053c7710a286d72102f4576cf32e0dafcfb\n  :100644 100644 538d21d... 59042d1... M\tMakefile\n  :100644 100644 410b758... 6c47c3a... M\tentry.c\n  ca182053c7710a286d72102f4576cf32e0dafcfb\n  :100644 100644 30479b4... 59042d1... M\tMakefile\n\n    The same \"independent sets of diff\" as before without -c.\n\n  $ git-diff-tree -r -m -c --abbrev ca18\n  ca182053c7710a286d72102f4576cf32e0dafcfb\n  ::100644 100644 100644 538d21d... 30479b4... 59042d1... MM\tMakefile\n\n    Combined.\n\n  $ git-diff-tree -r -c --abbrev ca18\n  ca182053c7710a286d72102f4576cf32e0dafcfb\n  ::100644 100644 100644 538d21d... 30479b4... 59042d1... MM\tMakefile\n\n    Asking for combined without -m does not make sense, so -c\n    implies -m.\n\nWe need to supply -c as default to whatchanged, which is a\none-liner.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\ndiff --git a/diff-tree.c b/diff-tree.c\nindex b170b03..f55a35a 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -6,7 +6,7 @@ static int show_root_diff = 0;\n static int no_commit_id = 0;\n static int verbose_header = 0;\n static int ignore_merges = 1;\n-static int combine_merges = 1;\n+static int combine_merges = 0;\n static int dense_combined_merges = 0;\n static int read_stdin = 0;\n static int always_show_header = 0;\n@@ -248,7 +248,7 @@ int main(int argc, const char **argv)\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"-m\")) {\n-\t\t\tcombine_merges = ignore_merges = 0;\n+\t\t\tignore_merges = 0;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"-c\")) {\ndiff --git a/git-whatchanged.sh b/git-whatchanged.sh\nindex 574fc35..1fb9feb 100755\n--- a/git-whatchanged.sh\n+++ b/git-whatchanged.sh\n@@ -10,7 +10,7 @@ case \"$0\" in\n \tcount=\n \ttest -z \"$diff_tree_flags\" &&\n \t\tdiff_tree_flags=$(git-repo-config --get whatchanged.difftree)\n-\tdiff_tree_default_flags='-M --abbrev' ;;\n+\tdiff_tree_default_flags='-c -M --abbrev' ;;\n *show)\n \tcount=-n1\n \ttest -z \"$diff_tree_flags\" &&\n"}]}