{"thread":{"id":"43414","subject":"Re: [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff","startedAt":"2006-10-26T08:50:20Z","lastAt":"2006-10-26T09:37:11Z","messageCount":3,"participants":["Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295252","messageId":"200610261050.21214.jnareb@gmail.com","threadId":"43414","inReplyTo":null,"subject":"[PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-26T08:50:20Z","receivedAt":"2006-10-26T08:50:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Use --no-commit-id option to git-diff-tree command in git_commit and\ngit_commitdiff to filter out commit ID output that git-diff-tree adds\nwhen called with only one <tree-ish> (not only for --stdin). Remove\nfiltering commit IDs from git-diff-tree output.\n\nThis option is in git since at least v1.0.0, so make use of it.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   11 ++++-------\n 1 files changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d7034b4..35a9afb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3133,14 +3133,12 @@ sub git_commit {\n \tif (!defined $parent) {\n \t\t$parent = \"--root\";\n \t}\n-\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts, $parent, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', \"--no-commit-id\",\n+\t\t@diff_opts, $parent, $hash\n \t\tor die_error(undef, \"Open git-diff-tree failed\");\n \tmy @difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n \n-\t# filter out commit ID output\n-\t@difftree = grep(!/^[0-9a-fA-F]{40}$/, @difftree);\n-\n \t# non-textual hash id's can be cached\n \tmy $expires;\n \tif ($hash =~ m/^[0-9a-fA-F]{40}$/) {\n@@ -3453,15 +3451,14 @@ sub git_commitdiff {\n \tmy @difftree;\n \tif ($format eq 'html') {\n \t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n+\t\t\t\"--no-commit-id\",\n \t\t\t\"--patch-with-raw\", \"--full-index\", $hash_parent, $hash\n \t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \n \t\twhile (chomp(my $line = <$fd>)) {\n \t\t\t# empty line ends raw part of diff-tree output\n \t\t\tlast unless $line;\n-\t\t\t# filter out commit ID output\n-\t\t\tpush @difftree, $line\n-\t\t\t\tunless $line =~ m/^[0-9a-fA-F]{40}$/;\n+\t\t\tpush @difftree, $line;\n \t\t}\n \n \t} elsif ($format eq 'plain') {\n-- \n1.4.3.3\n"},{"id":"294659","messageId":"7vejsvpi4d.fsf@assigned-by-dhcp.cox.net","threadId":"43414","inReplyTo":"200610261050.21214.jnareb@gmail.com","subject":"Re: [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-26T08:59:46Z","receivedAt":"2006-10-26T08:59:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Use --no-commit-id option to git-diff-tree command in git_commit and\n> git_commitdiff to filter out commit ID output that git-diff-tree adds\n> when called with only one <tree-ish> (not only for --stdin). Remove\n> filtering commit IDs from git-diff-tree output.\n>\n> This option is in git since at least v1.0.0, so make use of it.\n\n*BLUSH*\n\nI think we would need something like this, if only for\ncompleteness.\n\n-- >8 --\n[PATCH] combine-diff: honour --no-commit-id\n\nSomehow we forgot to look at no_commit_id flag in these\ncodepaths.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n combine-diff.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 01a8437..8ff46e8 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -737,7 +737,7 @@ static void show_patch_diff(struct combi\n \t\tint added = 0;\n \t\tint deleted = 0;\n \n-\t\tif (rev->loginfo)\n+\t\tif (rev->loginfo && !rev->no_commit_id)\n \t\t\tshow_log(rev, opt->msg_sep);\n \t\tdump_quoted_path(dense ? \"diff --cc \" : \"diff --combined \",\n \t\t\t\t elem->path, c_meta, c_reset);\n@@ -815,7 +815,7 @@ static void show_raw_diff(struct combine\n \tif (!line_termination)\n \t\tinter_name_termination = 0;\n \n-\tif (rev->loginfo)\n+\tif (rev->loginfo && !rev->no_commit_id)\n \t\tshow_log(rev, opt->msg_sep);\n \n \tif (opt->output_format & DIFF_FORMAT_RAW) {\n@@ -887,7 +887,7 @@ void diff_tree_combined(const unsigned c\n \tdiffopts.output_format = DIFF_FORMAT_NO_OUTPUT;\n \tdiffopts.recursive = 1;\n \n-\tshow_log_first = !!rev->loginfo;\n+\tshow_log_first = !!rev->loginfo && !rev->no_commit_id;\n \tneedsep = 0;\n \t/* find set of paths that everybody touches */\n \tfor (i = 0; i < num_parent; i++) {\n"},{"id":"298521","messageId":"200610261137.12211.jnareb@gmail.com","threadId":"43414","inReplyTo":"7vejsvpi4d.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH (resend)] gitweb: Use --no-commit-id in git_commit and git_commitdiff","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-26T09:37:11Z","receivedAt":"2006-10-26T09:37:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > Use --no-commit-id option to git-diff-tree command in git_commit and\n> > git_commitdiff to filter out commit ID output that git-diff-tree adds\n> > when called with only one <tree-ish> (not only for --stdin). Remove\n> > filtering commit IDs from git-diff-tree output.\n> >\n> > This option is in git since at least v1.0.0, so make use of it.\n> \n> *BLUSH*\n> \n> I think we would need something like this, if only for\n> completeness.\n> \n> -- >8 --\n> [PATCH] combine-diff: honour --no-commit-id\n> \n> Somehow we forgot to look at no_commit_id flag in these\n> codepaths.\n\nIt's good that I haven't started coding support for combined commitdiff\nin gitweb, as I would probably wonder why the code doesn't work ;-)\n-- \nJakub Narebski\n"}]}