{"thread":{"id":"5627","subject":"[PATCH] gitweb: Fix showing of path in tree view","startedAt":"2006-09-20T23:12:24Z","lastAt":"2006-09-21T11:25:36Z","messageCount":10,"participants":["Petr Baudis","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27311","messageId":"20060920231224.GN13132@pasky.or.cz","threadId":"5627","inReplyTo":null,"subject":"[PATCH] gitweb: Fix showing of path in tree view","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-20T23:12:24Z","receivedAt":"2006-09-20T23:12:24Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch fixes two things - links to all path elements except the last\none were broken since gitweb does not like the trailing slash in them, and\nthe root tree was not reachable from the subdirectory view.\n\nTo compensate for the one more slash in the front, the trailing slash is\nnot there anymore. ;-) I don't care if it stays there though.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n gitweb/gitweb.perl |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 834a773..70f409e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1503,12 +1503,13 @@ sub git_print_page_path {\n \t\tmy $fullname = '';\n \n \t\tprint \"<div class=\\\"page_path\\\">\";\n+\t\tprint $cgi->a({-href => href(action=>\"tree\", hash_base=>$hb),\n+\t\t\t      -title => '/'}, '/');\n \t\tforeach my $dir (@dirname) {\n-\t\t\t$fullname .= $dir . '/';\n+\t\t\t$fullname .= ($fullname ? '/' : '') . $dir;\n \t\t\tprint $cgi->a({-href => href(action=>\"tree\", file_name=>$fullname,\n \t\t\t                             hash_base=>$hb),\n-\t\t\t              -title => $fullname}, esc_html($dir));\n-\t\t\tprint \"/\";\n+\t\t\t              -title => $fullname}, esc_html($dir . '/'));\n \t\t}\n \t\tif (defined $type && $type eq 'blob') {\n \t\t\tprint $cgi->a({-href => href(action=>\"blob_plain\", file_name=>$file_name,\n@@ -1518,7 +1519,6 @@ sub git_print_page_path {\n \t\t\tprint $cgi->a({-href => href(action=>\"tree\", file_name=>$file_name,\n \t\t\t                             hash_base=>$hb),\n \t\t\t              -title => $name}, esc_html($basename));\n-\t\t\tprint \"/\";\n \t\t} else {\n \t\t\tprint esc_html($basename);\n \t\t}\n"},{"id":"27314","messageId":"7vpsdqdsh1.fsf@assigned-by-dhcp.cox.net","threadId":"5627","inReplyTo":"20060920231224.GN13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-20T23:32:42Z","receivedAt":"2006-09-20T23:32:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> This patch fixes two things - links to all path elements except the last\n> one were broken since gitweb does not like the trailing slash in them, and\n> the root tree was not reachable from the subdirectory view.\n>\n> To compensate for the one more slash in the front, the trailing slash is\n> not there anymore. ;-) I don't care if it stays there though.\n\nHmph.  I see the breakage and behaviour-wise your patch is fine.\n\nBut I think the older one was visually nicer and more intuitive\nin one very small detail that I think matters.  Slashes between\npath components were not part of the anchor elements, so it was\nclear that there were two links in \"gitweb / gitweb.perl\" page\ntitle, not just one link.  Now it is not obvious that clicking\ndifferent parts of the path string in \"/stgit/commands/mail.py\"\nwould lead to different places.  And as you are aware, losing\nthe leading \"/\" would be nicer as well ;-).\n"},{"id":"27315","messageId":"eesj84$qku$1@sea.gmane.org","threadId":"5627","inReplyTo":"20060920231224.GN13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-20T23:35:36Z","receivedAt":"2006-09-20T23:35:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> This patch fixes two things - links to all path elements except the last\n> one were broken since gitweb does not like the trailing slash in them, and\n> the root tree was not reachable from the subdirectory view.\n> \n> To compensate for the one more slash in the front, the trailing slash is\n> not there anymore. ;-) I don't care if it stays there though.\n\nOriginally '/' was used as separator between directories making the path.\nI'd rather use ' / ' to separate parts of pathname more, and not incorporate\nit in the link.\n\nTrailing (final) slash is present (and I think should be present) only\nfor path in \"tree\" view. From the path alone you can see if it is \"tree\"\nor \"blob\" view.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27317","messageId":"eesje4$qku$2@sea.gmane.org","threadId":"5627","inReplyTo":"eesj84$qku$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-20T23:38:49Z","receivedAt":"2006-09-20T23:38:49Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n\n> Petr Baudis wrote:\n> \n>> This patch fixes two things - links to all path elements except the last\n>> one were broken since gitweb does not like the trailing slash in them, and\n>> the root tree was not reachable from the subdirectory view.\n>> \n>> To compensate for the one more slash in the front, the trailing slash is\n>> not there anymore. ;-) I don't care if it stays there though.\n> \n> Originally '/' was used as separator between directories making the path.\n> I'd rather use ' / ' to separate parts of pathname more, and not incorporate\n> it in the link.\n> \n> Trailing (final) slash is present (and I think should be present) only\n> for path in \"tree\" view. From the path alone you can see if it is \"tree\"\n> or \"blob\" view.\n\nAbout link to root tree: we could change the commit title to link to root\ntree instead of linking to commit view.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27318","messageId":"20060920234052.GO13132@pasky.or.cz","threadId":"5627","inReplyTo":"7vpsdqdsh1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-20T23:40:52Z","receivedAt":"2006-09-20T23:40:52Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > This patch fixes two things - links to all path elements except the last\n> > one were broken since gitweb does not like the trailing slash in them, and\n> > the root tree was not reachable from the subdirectory view.\n> >\n> > To compensate for the one more slash in the front, the trailing slash is\n> > not there anymore. ;-) I don't care if it stays there though.\n> \n> Hmph.  I see the breakage and behaviour-wise your patch is fine.\n> \n> But I think the older one was visually nicer and more intuitive\n> in one very small detail that I think matters.  Slashes between\n> path components were not part of the anchor elements, so it was\n> clear that there were two links in \"gitweb / gitweb.perl\" page\n> title, not just one link.  Now it is not obvious that clicking\n> different parts of the path string in \"/stgit/commands/mail.py\"\n> would lead to different places.  And as you are aware, losing\n> the leading \"/\" would be nicer as well ;-).\n\n  Well, this was the best I could come up without introducing \"[root] /\"\nor something in front of the path, which would be IMHO even uglier.\nAlternative ideas welcomed. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"27319","messageId":"20060920234309.GU8259@pasky.or.cz","threadId":"5627","inReplyTo":"eesje4$qku$2@sea.gmane.org","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-20T23:43:09Z","receivedAt":"2006-09-20T23:43:09Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Sep 21, 2006 at 01:38:49AM CEST, I got a letter\nwhere Jakub Narebski <jnareb@gmail.com> said that...\n> Jakub Narebski wrote:\n> > Trailing (final) slash is present (and I think should be present) only\n> > for path in \"tree\" view. From the path alone you can see if it is \"tree\"\n> > or \"blob\" view.\n\nWhich sounds like a nice property but the rest of the page looks totally\ndifferent anyway, so I don't know how practical that is.\n\n> About link to root tree: we could change the commit title to link to root\n> tree instead of linking to commit view.\n\nI don't think that makes any sense. It's a _commit_ title! :-) And if I\nwant to get to root tree it wouldn't occur to me to click _there_\nanyway.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"27321","messageId":"7vhcz2drle.fsf@assigned-by-dhcp.cox.net","threadId":"5627","inReplyTo":"20060920234052.GO13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-20T23:51:41Z","receivedAt":"2006-09-20T23:51:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>> Hmph.  I see the breakage and behaviour-wise your patch is fine.\n>> \n>> But I think the older one was visually nicer and more intuitive\n>> in one very small detail that I think matters.  Slashes between\n>> path components were not part of the anchor elements, so it was\n>> clear that there were two links in \"gitweb / gitweb.perl\" page\n>> title, not just one link.  Now it is not obvious that clicking\n>> different parts of the path string in \"/stgit/commands/mail.py\"\n>> would lead to different places.  And as you are aware, losing\n>> the leading \"/\" would be nicer as well ;-).\n>\n>   Well, this was the best I could come up without introducing \"[root] /\"\n> or something in front of the path, which would be IMHO even uglier.\n> Alternative ideas welcomed. :-)\n\nOk, when I commented on it I did not realize that the leading\nslash was clickable.\n\nHow about rendering it like this?\n\n\t/ stgit/ commands/ mail.py\n"},{"id":"27349","messageId":"eetjp0$22n$1@sea.gmane.org","threadId":"5627","inReplyTo":"20060920234052.GO13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-21T08:50:46Z","receivedAt":"2006-09-21T08:50:46Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter\n> where Junio C Hamano <junkio@cox.net> said that...\n\n>> But I think the older one was visually nicer and more intuitive\n>> in one very small detail that I think matters.  Slashes between\n>> path components were not part of the anchor elements, so it was\n>> clear that there were two links in \"gitweb / gitweb.perl\" page\n>> title, not just one link.  Now it is not obvious that clicking\n>> different parts of the path string in \"/stgit/commands/mail.py\"\n>> would lead to different places.  And as you are aware, losing\n>> the leading \"/\" would be nicer as well ;-).\n> \n>   Well, this was the best I could come up without introducing \"[root] /\"\n> or something in front of the path, which would be IMHO even uglier.\n> Alternative ideas welcomed. :-)\n\n\"[$project] /\", or \"~ /\" instead of \"[root] /\".\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27357","messageId":"eetova$k32$1@sea.gmane.org","threadId":"5627","inReplyTo":"20060920231224.GN13132@pasky.or.cz","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-21T10:19:29Z","receivedAt":"2006-09-21T10:19:29Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> This patch fixes two things - links to all path elements except the last\n> one were broken since gitweb does not like the trailing slash in them, and\n> the root tree was not reachable from the subdirectory view.\n\nWouldn't it be better to fix git_get_hash_by_path to have it strip trailing\nslash? Gitweb don't like trailing slash in pathname (directory name)\nbecause while\n\n        git ls-tree $base -- dirname\n\nshows dirname entry\n\n        git ls-tree $base -- dirname/\n\nshows directory _contents_.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"27358","messageId":"20060921112536.GV8259@pasky.or.cz","threadId":"5627","inReplyTo":"eetjp0$22n$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: Fix showing of path in tree view","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-21T11:25:36Z","receivedAt":"2006-09-21T11:25:36Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Sep 21, 2006 at 10:50:46AM CEST, I got a letter\nwhere Jakub Narebski <jnareb@gmail.com> said that...\n> Petr Baudis wrote:\n> \n> > Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter\n> > where Junio C Hamano <junkio@cox.net> said that...\n> \n> >> But I think the older one was visually nicer and more intuitive\n> >> in one very small detail that I think matters.  Slashes between\n> >> path components were not part of the anchor elements, so it was\n> >> clear that there were two links in \"gitweb / gitweb.perl\" page\n> >> title, not just one link.  Now it is not obvious that clicking\n> >> different parts of the path string in \"/stgit/commands/mail.py\"\n> >> would lead to different places.  And as you are aware, losing\n> >> the leading \"/\" would be nicer as well ;-).\n> > \n> >   Well, this was the best I could come up without introducing \"[root] /\"\n> > or something in front of the path, which would be IMHO even uglier.\n> > Alternative ideas welcomed. :-)\n> \n> \"[$project] /\", or \"~ /\" instead of \"[root] /\".\n\nYes, the former is what repo.or.cz uses now and in a patch I've sent\nprivately to Junio (since my StGIT configuration at repo.or.cz is messed\nup and I had no time to fix it).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"}]}