{"thread":{"id":"7482","subject":"[PATCH (resend)] gitweb: Support comparing blobs (files) with different names","startedAt":"2007-03-30T21:41:26Z","lastAt":"2007-03-30T23:41:35Z","messageCount":3,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38384","messageId":"200703302341.27225.jnareb@gmail.com","threadId":"7482","inReplyTo":null,"subject":"[PATCH (resend)] gitweb: Support comparing blobs (files) with different names","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-03-30T21:41:26Z","receivedAt":"2007-03-30T21:41:26Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Fix the bug that caused \"blobdiff\" view called with new style URI\nfor a rename with change diff to be show as new (added) file diff.\n\nNew style URI for \"blobdiff\" for rename means with $hash_base ('hb') and\n$hash_parent_base ('hpb') paramaters denoting tree-ish (usually commit)\nof a blobs being compared, together with both $file_name ('f') and\n$file_parent ('fp') parameters.\n\nIt is done by adding $file_parent ('fp') to the path limiter, meaning\nthat diff command becomes:\n\n\tgit diff-tree [options] hpb hb -- fp f\n\nOther option would be finding hash of a blob using git_get_hash_by_path\nsubroutine and comparing blobs using git-diff, or using extended SHA-1\nsyntax and compare blobs using git-diff:\n\n\tgit diff [options] hpb:fp hp:f\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nJunio, could you apply this? It looks like it was lost in the noise.\n\nThis patch is least invasive, and it solves bug with \"blobdiff\" for\nrename with change. It is not a complete solution for comparing two\narbitrary blobs (which takes longer than expected, and it looks like\nit would be a while till it is ready), but it covers AFAICT all the\nURL (all the situations) for \"blobdiff\" currently _generated_ by gitweb.\n\n>From the lack of bugreports concerning this bug in \"blobdiff\" it looks\nlike \"blobdiff\" view is not often used. By the way: \"commitdiff\" view\nworks fine in the presence of renames, and renames with modification.\n\nThis version has slightly changed commit message.\n\nBug was noticed by Martin Koegler <mkoegler@auto.tuwien.ac.at>\n\n\n gitweb/gitweb.perl |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5214050..c79bfeb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3885,7 +3885,7 @@ sub git_blobdiff {\n \t\t\t# read raw output\n \t\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t\t$hash_parent_base, $hash_base,\n-\t\t\t\t\"--\", $file_name\n+\t\t\t\t\"--\", (defined $file_parent ? $file_parent : ()), $file_name\n \t\t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \t\t\t@difftree = map { chomp; $_ } <$fd>;\n \t\t\tclose $fd\n@@ -3935,7 +3935,7 @@ sub git_blobdiff {\n \t\t# open patch output\n \t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t'-p', $hash_parent_base, $hash_base,\n-\t\t\t\"--\", $file_name\n+\t\t\t\"--\", (defined $file_parent ? $file_parent : ()), $file_name\n \t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \t}\n \n-- \n1.5.0.5\n"},{"id":"38385","messageId":"7virciz6gm.fsf@assigned-by-dhcp.cox.net","threadId":"7482","inReplyTo":"200703302341.27225.jnareb@gmail.com","subject":"Re: [PATCH (resend)] gitweb: Support comparing blobs (files) with different names","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-30T22:56:09Z","receivedAt":"2007-03-30T22:56:09Z","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> Fix the bug that caused \"blobdiff\" view called with new style URI\n> for a rename with change diff to be show as new (added) file diff.\n>\n> New style URI for \"blobdiff\" for rename means with $hash_base ('hb') and\n> $hash_parent_base ('hpb') paramaters denoting tree-ish (usually commit)\n> of a blobs being compared, together with both $file_name ('f') and\n> $file_parent ('fp') parameters.\n>\n> It is done by adding $file_parent ('fp') to the path limiter, meaning\n> that diff command becomes:\n>\n> \tgit diff-tree [options] hpb hb -- fp f\n>\n> Other option would be finding hash of a blob using git_get_hash_by_path\n> subroutine and comparing blobs using git-diff, or using extended SHA-1\n> syntax and compare blobs using git-diff:\n>\n> \tgit diff [options] hpb:fp hp:f\n>\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> Junio, could you apply this? It looks like it was lost in the noise.\n\nI was waiting for dust to settle.  Ack's from people involved in\nthe discussion would be nice.\n"},{"id":"38388","messageId":"200703310141.36552.jnareb@gmail.com","threadId":"7482","inReplyTo":"7virciz6gm.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH (resend)] gitweb: Support comparing blobs (files) with different names","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-03-30T23:41:35Z","receivedAt":"2007-03-30T23:41:35Z","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>> Fix the bug that caused \"blobdiff\" view called with new style URI\n>> for a rename with change diff to be show as new (added) file diff.\n[...]\n>> ---\n>> Junio, could you apply this? It looks like it was lost in the noise.\n> \n> I was waiting for dust to settle.  Ack's from people involved in\n> the discussion would be nice.\n\nI can understand that.\n\nThis patch is _a_ solution: it fixes \"blobdiff\" view for all blobdiff \nURIs gitweb generates now. But it is not _the_ solution, as it doesn't \nwork with Martin work on adding \"(base | diff)\" links to allow to view \ndiff between arbitrary commits, trees or blobs; which includes \n\"blobdiff\" view of arbitrary blobs.\n\nSo if/when Martin finishes his series of patches, this part would be \nrewritten. But it is some time in the future...\n-- \nJakub Narebski\nPoland\n"}]}