{"thread":{"id":"5698","subject":"[PATCH] gitweb: \"raw\" links to blobs at HEAD","startedAt":"2006-09-26T05:39:20Z","lastAt":"2006-09-26T20:20:13Z","messageCount":5,"participants":["Luben Tuikov","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27662","messageId":"20060926053920.47709.qmail@web31802.mail.mud.yahoo.com","threadId":"5698","inReplyTo":null,"subject":"[PATCH] gitweb: \"raw\" links to blobs at HEAD","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-26T05:39:20Z","receivedAt":"2006-09-26T05:39:20Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"Currently there is no HTML interface which references (or\ncan be externally referenced) to yield a _binary_ blob at\nHEAD.  There is one for non-binary blobs, but none for\nbinary ones.\n\nThe reason is that \"blob\"/entry itself for non-binary\nentries gives you the \"Blob page\" where you can click on\nlast link of the page path, but clicking on the binary\nentry/\"blob\" gives you the raw file.\n\nBinary blobs:\n  Since \"raw\" == the entry itself, we can eliminate this\nredundancy and set \"raw\" to the binary blob at HEAD. This\npatch implements that.  If the user wants the binary blob at\nhash/hash_base then they can click on the entry itself.\n\nNon-binary blobs:\n  With this patch \"raw\" yields the HEAD revision as per the\nabove comment for binary blobs.  If the raw output of the\nhash/hash_base blob is required the user can click on the entry\n(same as for binary only) and then click on \"raw\" (which\nused to be named \"plain\" not so long ago) or last entry of\n\"page\" path.\n\nCompare the \"raw\" link for non-binary blobs from tree view,\nto the alternative to getting it: click on entry->HEAD->last\nentry of \"page\" path.\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex c7ab3b6..959e3f9 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1625,9 +1625,9 @@ sub git_print_tree_entry {\n \t\t\t              \"history\");\n \t\t}\n \t\tprint \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"blob_plain\",\n-\t\t                             hash=>$t->{'hash'}, file_name=>\"$basedir$t->{'name'}\")},\n-\t\t              \"raw\");\n+\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>\"HEAD\",\n+\t\t\t\t\t       file_name=>\"$basedir$t->{'name'}\")},\n+\t\t\t\t\"raw\");\n \t\tprint \"</td>\\n\";\n \n \t} elsif ($t->{'type'} eq \"tree\") {\n-- \n1.4.2.1.gdbbb\n"},{"id":"27664","messageId":"7v8xk7rup3.fsf@assigned-by-dhcp.cox.net","threadId":"5698","inReplyTo":"20060926053920.47709.qmail@web31802.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: \"raw\" links to blobs at HEAD","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-26T06:46:48Z","receivedAt":"2006-09-26T06:46:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This does not feel right.  Go to summary view, pick the tree\nlink of a non-head commit from the shortlog list, and the raw\nlinks on the resulting page all say hb=HEAD.\n\nDoesn't this make clicking the entry itself (blob view) and\nclicking on the raw link (blob-plain view) inconsistent?  The\nformer goes to the blob from that revision while the latter\nalways goes to the HEAD.\n"},{"id":"27671","messageId":"efaq3h$e65$2@sea.gmane.org","threadId":"5698","inReplyTo":"20060926053920.47709.qmail@web31802.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: \"raw\" links to blobs at HEAD","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-26T08:58:28Z","receivedAt":"2006-09-26T08:58:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n\n> Currently there is no HTML interface which references (or\n> can be externally referenced) to yield a _binary_ blob at\n> HEAD.  There is one for non-binary blobs, but none for\n> binary ones.\n\nYou can in the same number of steps. First go to _tree_\nat head, then click on \"raw\" link.\n\nIt's true that decision that binary files are automatically\nredirected to \"plain\" (\"raw\") format, so they don't have \"html\"\noutput caused that there is no link for binary blob at head.\nBut I don't think that changing \"raw\" link to link to HEAD\nversion, while all other links are to current version is\na good idea...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27694","messageId":"20060926185326.10590.qmail@web31810.mail.mud.yahoo.com","threadId":"5698","inReplyTo":"7v8xk7rup3.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: \"raw\" links to blobs at HEAD","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-26T18:53:26Z","receivedAt":"2006-09-26T18:53:26Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Junio C Hamano <junkio@cox.net> wrote:\n> This does not feel right.  Go to summary view, pick the tree\n> link of a non-head commit from the shortlog list, and the raw\n> links on the resulting page all say hb=HEAD.\n\nI see your point.\n\n> Doesn't this make clicking the entry itself (blob view) and\n> clicking on the raw link (blob-plain view) inconsistent?\n\nIt this exactly this consistency which the patch used to de-couple\nit and use the \"raw\" to point to HEAD.\n\n> The former goes to the blob from that revision while the latter\n> always goes to the HEAD.\n\nYes, I completely understand the conundrum.\n\nIdeally, hb would equal HEAD from the _context_, but\n  1) hb and h != HEAD for any \"raw\" link,\n  2) one can set hb=HEAD in the context only when the \"blob page\"\n     can be loaded, which is impossible for binary blobs.\n\nSo the fix would be that, unless the user had selected a hb/h\nexplicitly, set \"raw\" to HEAD (i.e. by default), but leave the entry\nwith hb/h in SHA.  This way, one can take a reference to HEAD or\nSHA of the head depending on what is needed.  And if they had\nselected a hb/h explicitly then both the entry and the \"raw\"\nwould point to the SHA.\n\nSuch a patch can go on top of those two.\n\n    Luben\n"},{"id":"27700","messageId":"20060926202013.10579.qmail@web31811.mail.mud.yahoo.com","threadId":"5698","inReplyTo":"efaq3h$e65$2@sea.gmane.org","subject":"Re: [PATCH] gitweb: \"raw\" links to blobs at HEAD","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-26T20:20:13Z","receivedAt":"2006-09-26T20:20:13Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> Luben Tuikov wrote:\n> \n> > Currently there is no HTML interface which references (or\n> > can be externally referenced) to yield a _binary_ blob at\n> > HEAD.  There is one for non-binary blobs, but none for\n> > binary ones.\n> \n> You can in the same number of steps. First go to _tree_\n> at head, then click on \"raw\" link.\n\nJakub,\n\nFor binary only files, there is no HTML interface to refer\nto, such that, hb=HEAD for _binary_ only files.  Unless of course\none types that on the URL line manually.\n\nThat is, I'd like to externally reference binary only blobs\nat \"HEAD\", s.t. no matter _when_ the reference is used, it would\nrefer to the latest \"version\" of that file.\n\nE.g. a PDF spec file.\n\nMy recent patches on the subject enable this capability.\n\n    Luben\n\n> It's true that decision that binary files are automatically\n> redirected to \"plain\" (\"raw\") format, so they don't have \"html\"\n> output caused that there is no link for binary blob at head.\n> But I don't think that changing \"raw\" link to link to HEAD\n> version, while all other links are to current version is\n> a good idea...\n> -- \n> Jakub Narebski\n> Warsaw, Poland\n> ShadeHawk on #git\n> \n> \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"}]}