{"thread":{"id":"5708","subject":"[PATCH] gitweb: tree view: hash_base and hash are now context sensitive","startedAt":"2006-09-26T19:47:05Z","lastAt":"2006-10-02T19:51:10Z","messageCount":12,"participants":["Luben Tuikov","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27697","messageId":"20060926194706.32255.qmail@web31804.mail.mud.yahoo.com","threadId":"5708","inReplyTo":null,"subject":"[PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-26T19:47:05Z","receivedAt":"2006-09-26T19:47:05Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"In tree view, by default, hash_base is HEAD and hash is the\nentry equivalent.  Else the user had selected a hash_base or\nhash, say by clicking on a revision or commit, in which case\nthose values are used.\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 8e9c827..56638f2 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1625,7 +1625,7 @@ sub git_print_tree_entry {\n \t\t\t              \"history\");\n \t\t}\n \t\tprint \" | \" .\n-\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>\"HEAD\",\n+\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>$hash_base,\n \t\t\t\t\t       file_name=>\"$basedir$t->{'name'}\")},\n \t\t\t\t\"raw\");\n \t\tprint \"</td>\\n\";\n@@ -2713,14 +2713,14 @@ sub git_tree {\n \tmy ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');\n \tmy $have_snapshot = (defined $ctype && defined $suffix);\n \n+\tif (!defined $hash_base) {\n+\t\t$hash_base = \"HEAD\";\n+\t}\n \tif (!defined $hash) {\n-\t\t$hash = git_get_head_hash($project);\n \t\tif (defined $file_name) {\n-\t\t\tmy $base = $hash_base || $hash;\n-\t\t\t$hash = git_get_hash_by_path($base, $file_name, \"tree\");\n-\t\t}\n-\t\tif (!defined $hash_base) {\n-\t\t\t$hash_base = $hash;\n+\t\t\t$hash = git_get_hash_by_path($hash_base, $file_name, \"tree\");\n+\t\t} else {\n+\t\t\t$hash = $hash_base;\n \t\t}\n \t}\n \t$/ = \"\\0\";\n-- \n1.4.2.1.g893b0\n"},{"id":"27705","messageId":"efc2t8$eti$3@sea.gmane.org","threadId":"5708","inReplyTo":"20060926194706.32255.qmail@web31804.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-26T20:34:55Z","receivedAt":"2006-09-26T20:34:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n\n> In tree view, by default, hash_base is HEAD and hash is the\n> entry equivalent.  Else the user had selected a hash_base or\n> hash, say by clicking on a revision or commit, in which case\n> those values are used.\n\nI think that this need some thinking over. For blob we have two\n\"base\" objects: tree which have specified blob, and commit which\nhave tree which have specified blob. We might want to specify\nthat all hash*base are to the commit-ish.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27706","messageId":"20060926211720.21355.qmail@web31808.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"efc2t8$eti$3@sea.gmane.org","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-26T21:17:20Z","receivedAt":"2006-09-26T21:17:20Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> I think that this need some thinking over. For blob we have two\n> \"base\" objects: tree which have specified blob, and commit which\n> have tree which have specified blob. We might want to specify\n> that all hash*base are to the commit-ish.\n\nAgreed, we should always refer to the commit-ish, for obvious\nreasons.\n\nThis patch doesn't make this decision though.  It simply\nsets hash_base to HEAD if not defined.\n\nNow, since \"git-ls-tree\" works on both commit-ish and\ntree-ish, we are ok.\n\n    Luben\n"},{"id":"27765","messageId":"7v1wpxhkj9.fsf@assigned-by-dhcp.cox.net","threadId":"5708","inReplyTo":"20060926211720.21355.qmail@web31808.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-27T06:48:42Z","receivedAt":"2006-09-27T06:48:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Luben Tuikov <ltuikov@yahoo.com> writes:\n\n> --- Jakub Narebski <jnareb@gmail.com> wrote:\n>> I think that this need some thinking over. For blob we have two\n>> \"base\" objects: tree which have specified blob, and commit which\n>> have tree which have specified blob. We might want to specify\n>> that all hash*base are to the commit-ish.\n>\n> Agreed, we should always refer to the commit-ish, for obvious\n> reasons.\n>\n> This patch doesn't make this decision though.  It simply\n> sets hash_base to HEAD if not defined.\n>\n> Now, since \"git-ls-tree\" works on both commit-ish and\n> tree-ish, we are ok.\n\nI think so, too.  Jakub?\n"},{"id":"27825","messageId":"20060927225342.7695.qmail@web31801.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"7v1wpxhkj9.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-27T22:53:42Z","receivedAt":"2006-09-27T22:53:42Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Junio C Hamano <junkio@cox.net> wrote:\n> Luben Tuikov <ltuikov@yahoo.com> writes:\n> \n> > --- Jakub Narebski <jnareb@gmail.com> wrote:\n> >> I think that this need some thinking over. For blob we have two\n> >> \"base\" objects: tree which have specified blob, and commit which\n> >> have tree which have specified blob. We might want to specify\n> >> that all hash*base are to the commit-ish.\n> >\n> > Agreed, we should always refer to the commit-ish, for obvious\n> > reasons.\n> >\n> > This patch doesn't make this decision though.  It simply\n> > sets hash_base to HEAD if not defined.\n> >\n> > Now, since \"git-ls-tree\" works on both commit-ish and\n> > tree-ish, we are ok.\n> \n> I think so, too.  Jakub?\n\nStatus?  I see Jakub hasn't objected, and it is really important\nfor us to be able to link to \"latest\" binary blob -- for example\na PDF spec file.\n\n   Luben\n"},{"id":"27918","messageId":"20060928185232.96094.qmail@web31802.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"20060927225342.7695.qmail@web31801.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-28T18:52:32Z","receivedAt":"2006-09-28T18:52:32Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Luben Tuikov <ltuikov@yahoo.com> wrote:\n> --- Junio C Hamano <junkio@cox.net> wrote:\n> > Luben Tuikov <ltuikov@yahoo.com> writes:\n> > \n> > > --- Jakub Narebski <jnareb@gmail.com> wrote:\n> > >> I think that this need some thinking over. For blob we have two\n> > >> \"base\" objects: tree which have specified blob, and commit which\n> > >> have tree which have specified blob. We might want to specify\n> > >> that all hash*base are to the commit-ish.\n> > >\n> > > Agreed, we should always refer to the commit-ish, for obvious\n> > > reasons.\n> > >\n> > > This patch doesn't make this decision though.  It simply\n> > > sets hash_base to HEAD if not defined.\n> > >\n> > > Now, since \"git-ls-tree\" works on both commit-ish and\n> > > tree-ish, we are ok.\n> > \n> > I think so, too.  Jakub?\n> \n> Status?  I see Jakub hasn't objected, and it is really important\n> for us to be able to link to \"latest\" binary blob -- for example\n> a PDF spec file.\n\nJunio,\n\nWhat are the objections to this patch?\n\nThanks,\n   Luben\n"},{"id":"27975","messageId":"7vmz8jp5p3.fsf@assigned-by-dhcp.cox.net","threadId":"5708","inReplyTo":"20060928185232.96094.qmail@web31802.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-29T06:06:32Z","receivedAt":"2006-09-29T06:06:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Luben Tuikov <ltuikov@yahoo.com> writes:\n\n>> > > Agreed, we should always refer to the commit-ish, for obvious\n>> > > reasons.\n>> > >\n>> > > This patch doesn't make this decision though.  It simply\n>> > > sets hash_base to HEAD if not defined.\n>> > >\n>> > > Now, since \"git-ls-tree\" works on both commit-ish and\n>> > > tree-ish, we are ok.\n>> > \n>> > I think so, too.  Jakub?\n>> \n>> Status?  I see Jakub hasn't objected, and it is really important\n>> for us to be able to link to \"latest\" binary blob -- for example\n>> a PDF spec file.\n>\n> Junio,\n>\n> What are the objections to this patch?\n\nNo objections from me --- rather lack of objections from Jakub ;-)\n\nBut the fragments do not appear to apply anymore.\n\n@@ -1625,7 +1625,7 @@ sub git_print_tree_entry {\n \t\t\t              \"history\");\n \t\t}\n \t\tprint \" | \" .\n-\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>\"HEAD\",\n+\t\t\t$cgi->a({-href => href(action=>\"blob_plain\", hash_base=>$hash_base,\n \t\t\t\t\t       file_name=>\"$basedir$t->{'name'}\")},\n \t\t\t\t\"raw\");\n \t\tprint \"</td>\\n\";\n\nThere is no call to create blob_plain link with hash_base\nhardcoded to \"HEAD\" in git-print-tree-entry.\n\nCare to re-spin?\n"},{"id":"27997","messageId":"20060929161619.24848.qmail@web31806.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"7vmz8jp5p3.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-29T16:16:19Z","receivedAt":"2006-09-29T16:16:19Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Junio C Hamano <junkio@cox.net> wrote:\n> > What are the objections to this patch?\n> \n> No objections from me --- rather lack of objections from Jakub ;-)\n\nWe haven't heard anything from him, and on our last correspondence\nin this thread it seemed we're in agreement.\n\n> But the fragments do not appear to apply anymore.\n[...]\n> There is no call to create blob_plain link with hash_base\n> hardcoded to \"HEAD\" in git-print-tree-entry.\n> \n> Care to re-spin?\n\nDoing it right now.\n\nThanks,\n   Luben\n"},{"id":"28011","messageId":"200609292235.27478.jnareb@gmail.com","threadId":"5708","inReplyTo":"20060929161619.24848.qmail@web31806.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-29T20:35:27Z","receivedAt":"2006-09-29T20:35:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n> --- Junio C Hamano <junkio@cox.net> wrote:\n> > > What are the objections to this patch?\n> > \n> > No objections from me --- rather lack of objections from Jakub ;-)\n> \n> We haven't heard anything from him, and on our last correspondence\n> in this thread it seemed we're in agreement.\n\nAs a interim solution it is a good idea, moreover with using $hash_base\ndefaulting to HEAD instead of using HEAD literaly.\n\nThe correct solution would be to make \"html\" page (i.e. \"blob\" not \n\"blob_plain\" view) also for binary files. <img> element for image/*\nmimetype, perhaps <embed> or <object>, or just plain link for other\nbinary (not text/* or some application/*) types\n\nI was AFK for few days.\n-- \nJakub Narebski\nPoland\n"},{"id":"28020","messageId":"20060929233037.42926.qmail@web31808.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"200609292235.27478.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-29T23:30:36Z","receivedAt":"2006-09-29T23:30:36Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> As a interim solution it is a good idea, moreover with using $hash_base\n> defaulting to HEAD instead of using HEAD literaly.\n> \n> The correct solution would be to make \"html\" page (i.e. \"blob\" not \n> \"blob_plain\" view) also for binary files. <img> element for image/*\n> mimetype, perhaps <embed> or <object>, or just plain link for other\n> binary (not text/* or some application/*) types\n\nWe already do have a hash_base context. It is what allows us to\n\"select\" a revision from shortlog and ask \"tree\", \"history\", etc\nfrom there on, having set \"h\" and/or \"hb\".\n\nWhat this patch does is simply set \"h\" and/or \"hb\" to\nthe string \"HEAD\" instead of the string \"<SHA1 of HEAD>\" when\nh/hb is not defined.\n\n    Luben\n\n\n> \n> I was AFK for few days.\n> -- \n> Jakub Narebski\n> Poland\n> \n"},{"id":"28092","messageId":"efpfc3$765$1@sea.gmane.org","threadId":"5708","inReplyTo":"20060929233037.42926.qmail@web31808.mail.mud.yahoo.com","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-01T22:27:36Z","receivedAt":"2006-10-01T22:27:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Luben Tuikov wrote:\n\n> What this patch does is simply set \"h\" and/or \"hb\" to\n> the string \"HEAD\" instead of the string \"<SHA1 of HEAD>\" when\n> h/hb is not defined.\n\nI guess there it is a good idea, but we should always think\nover if we want \"constant\" link, always showing the same thing,\nor a \"variable\" (or \"news\") link, showing current version.\n\nExplicit sha1 hash as 'h'/'hb' gives persistent, cacheable link,\nwhile e.g. \"HEAD\" gives \"variable\" link.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"28117","messageId":"20061002195110.33802.qmail@web31801.mail.mud.yahoo.com","threadId":"5708","inReplyTo":"efpfc3$765$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: tree view: hash_base and hash are now context sensitive","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-10-02T19:51:10Z","receivedAt":"2006-10-02T19:51:10Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Jakub Narebski <jnareb@gmail.com> wrote:\n> Luben Tuikov wrote:\n> \n> > What this patch does is simply set \"h\" and/or \"hb\" to\n> > the string \"HEAD\" instead of the string \"<SHA1 of HEAD>\" when\n> > h/hb is not defined.\n> \n> I guess there it is a good idea, but we should always think\n> over if we want \"constant\" link, always showing the same thing,\n> or a \"variable\" (or \"news\") link, showing current version.\n> \n> Explicit sha1 hash as 'h'/'hb' gives persistent, cacheable link,\n> while e.g. \"HEAD\" gives \"variable\" link.\n\nExactly what is wanted by people using git in a work environment.\n\n   Luben\nP.S. Please don't edit out the CC list leaving only git in. Click\n\"Reply-all\" please, just like everyone else does.\n"}]}