{"thread":{"id":"7523","subject":"[PATCH (resend)] gitweb: Fix bug in \"blobdiff\" view for split (e.g. file to symlink) patches","startedAt":"2007-04-05T11:45:41Z","lastAt":"2007-04-05T22:58:23Z","messageCount":3,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38696","messageId":"1175773541251-git-send-email-jnareb@gmail.com","threadId":"7523","inReplyTo":null,"subject":"[PATCH (resend)] gitweb: Fix bug in \"blobdiff\" view for split (e.g. file to symlink) patches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-04-05T11:45:41Z","receivedAt":"2007-04-05T11:45:41Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"git_patchset_body needs patch generated with --full-index option to\ndetect split patches, meaning two patches which corresponds to single\ndifftree (raw diff) entry.  An example of such situation is changing\ntype (mode) of a file, e.g. from plain file to symbolic link.\n\nAdd, in git_blobdiff, --full-index option to patch generating git diff\ninvocation, for the 'html' format output (\"blobdiff\" view).\n\n\"blobdiff_plain\" still uses shortened sha1 in the extended git diff\nheader \"index <hash>..<hash>[ <mode>]\" line.\n\nNoticed-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nOn Wed, Mar 28, 2007 at 23:03 +0200, Martin Koegler wrote:\n\n> Blobdiff (html output) in its current version can not handle symlinks:\n>\n>   diff --git a/x b/x\n>   deleted file mode 100644 (file)\n>   index 190a180..873fb8d\n>   --- a/x\n>   +++ /dev/null\n>   @@ -1 +0,0 @@\n>   -123\n>   diff --git a/ b/\n>   new file mode 120000 (symlink)\n>   index 190a180..873fb8d\n>   --- /dev/null\n>   +++ b/\n>   @@ -0,0 +1 @@\n>   +file3\n>   \\ No newline at end of file\n> \n> This was generated by \"diff to current\" in the history view of a file,\n> which was changed between symlink and normal file.\n\nThis patch fixes this bug in git_blobdiff (in \"blobdiff\" view).\n\nJunio, you probably have missed this patch in the noise...\n\n gitweb/gitweb.perl |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 4f34c29..d1f4aeb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3936,7 +3936,8 @@ sub git_blobdiff {\n \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'-p', ($format eq 'html' ? \"--full-index\" : ()),\n+\t\t\t$hash_parent_base, $hash_base,\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@@ -3971,7 +3972,8 @@ sub git_blobdiff {\n \t\t}\n \n \t\t# open patch output\n-\t\topen $fd, \"-|\", git_cmd(), \"diff\", '-p', @diff_opts,\n+\t\topen $fd, \"-|\", git_cmd(), \"diff\", @diff_opts,\n+\t\t\t'-p', ($format eq 'html' ? \"--full-index\" : ()),\n \t\t\t$hash_parent, $hash, \"--\"\n \t\t\tor die_error(undef, \"Open git-diff failed\");\n \t} else  {\n-- \n1.5.0.5\n"},{"id":"38731","messageId":"7v3b3epn0a.fsf@assigned-by-dhcp.cox.net","threadId":"7523","inReplyTo":"1175773541251-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH (resend)] gitweb: Fix bug in \"blobdiff\" view for split (e.g. file to symlink) patches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-05T20:47:01Z","receivedAt":"2007-04-05T20:47:01Z","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> git_patchset_body needs patch generated with --full-index option to\n> detect split patches,...\n> ...\n> This patch fixes this bug in git_blobdiff (in \"blobdiff\" view).\n>\n> Junio, you probably have missed this patch in the noise...\n\nProbably.  Although I do remember seeing the patch, it was\nunclear why --full-index is needed (and it still is unclear to\nme).  Do you have a parser that expects/depends on full\n40-hexdigit hash on the index line?\n\nNot a complaint but a question -- I do not mind (actually prefer,\nprobably) if gitweb worked on full 40-hexdigit internally to\navoid possible ambiguity issues, although the output may need to\nbe truncated to save people from having to see unneeded precision.\n"},{"id":"38756","messageId":"200704060058.24524.jnareb@gmail.com","threadId":"7523","inReplyTo":"7v3b3epn0a.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH (resend)] gitweb: Fix bug in \"blobdiff\" view for split (e.g. file to symlink) patches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-04-05T22:58:23Z","receivedAt":"2007-04-05T22:58:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"DJunio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> git_patchset_body needs patch generated with --full-index option to\n>> detect split patches,...\n>> ...\n>> This patch fixes this bug in git_blobdiff (in \"blobdiff\" view).\n>>\n>> Junio, you probably have missed this patch in the noise...\n> \n> Probably.  Although I do remember seeing the patch, it was\n> unclear why --full-index is needed (and it still is unclear to\n> me).  Do you have a parser that expects/depends on full\n> 40-hexdigit hash on the index line?\n> \n> Not a complaint but a question -- I do not mind (actually prefer,\n> probably) if gitweb worked on full 40-hexdigit internally to\n> avoid possible ambiguity issues, although the output may need to\n> be truncated to save people from having to see unneeded precision.\n\nYes, the parser (in git_patchset_body subroutine) checks for\npresence of fully expanded 40-hexdigit hash, and compares it with\nthe fully expanded 40-hexdigit hash it has in $difftree hashref\n(from the \"raw\" diff output, or \"raw\" part of diff output, or \nhand-crafted \"raw\" diff output). It is needed only for the 'html'\nformat case (for \"commitdiff\" / \"blobdiff\" view), for git_patchset_body\nto know what values use for hyperlinking and replacements.\n\nThe output is truncated (and hyperlinked) in 'html' format case.\n\n\nI could have relaxed the parser, and compare up to the precision\nof hash in the \"^index ...\" line of extended git diff header in\n\"patch\" diff output...\n\n-- \nJakub Narebski\nPoland\n"}]}