* [PATCH] gitweb: Fix showing of path in tree view
@ 2006-09-20 23:12 Petr Baudis
2006-09-20 23:32 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Petr Baudis @ 2006-09-20 23:12 UTC (permalink / raw)
To: git
This patch fixes two things - links to all path elements except the last
one were broken since gitweb does not like the trailing slash in them, and
the root tree was not reachable from the subdirectory view.
To compensate for the one more slash in the front, the trailing slash is
not there anymore. ;-) I don't care if it stays there though.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
gitweb/gitweb.perl | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 834a773..70f409e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1503,12 +1503,13 @@ sub git_print_page_path {
my $fullname = '';
print "<div class=\"page_path\">";
+ print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
+ -title => '/'}, '/');
foreach my $dir (@dirname) {
- $fullname .= $dir . '/';
+ $fullname .= ($fullname ? '/' : '') . $dir;
print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
hash_base=>$hb),
- -title => $fullname}, esc_html($dir));
- print "/";
+ -title => $fullname}, esc_html($dir . '/'));
}
if (defined $type && $type eq 'blob') {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
@@ -1518,7 +1519,6 @@ sub git_print_page_path {
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
hash_base=>$hb),
-title => $name}, esc_html($basename));
- print "/";
} else {
print esc_html($basename);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:12 [PATCH] gitweb: Fix showing of path in tree view Petr Baudis
@ 2006-09-20 23:32 ` Junio C Hamano
2006-09-20 23:40 ` Petr Baudis
2006-09-20 23:35 ` Jakub Narebski
2006-09-21 10:19 ` Jakub Narebski
2 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2006-09-20 23:32 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Jakub Narebski
Petr Baudis <pasky@suse.cz> writes:
> This patch fixes two things - links to all path elements except the last
> one were broken since gitweb does not like the trailing slash in them, and
> the root tree was not reachable from the subdirectory view.
>
> To compensate for the one more slash in the front, the trailing slash is
> not there anymore. ;-) I don't care if it stays there though.
Hmph. I see the breakage and behaviour-wise your patch is fine.
But I think the older one was visually nicer and more intuitive
in one very small detail that I think matters. Slashes between
path components were not part of the anchor elements, so it was
clear that there were two links in "gitweb / gitweb.perl" page
title, not just one link. Now it is not obvious that clicking
different parts of the path string in "/stgit/commands/mail.py"
would lead to different places. And as you are aware, losing
the leading "/" would be nicer as well ;-).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:32 ` Junio C Hamano
@ 2006-09-20 23:40 ` Petr Baudis
2006-09-20 23:51 ` Junio C Hamano
2006-09-21 8:50 ` Jakub Narebski
0 siblings, 2 replies; 10+ messages in thread
From: Petr Baudis @ 2006-09-20 23:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jakub Narebski
Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
>
> > This patch fixes two things - links to all path elements except the last
> > one were broken since gitweb does not like the trailing slash in them, and
> > the root tree was not reachable from the subdirectory view.
> >
> > To compensate for the one more slash in the front, the trailing slash is
> > not there anymore. ;-) I don't care if it stays there though.
>
> Hmph. I see the breakage and behaviour-wise your patch is fine.
>
> But I think the older one was visually nicer and more intuitive
> in one very small detail that I think matters. Slashes between
> path components were not part of the anchor elements, so it was
> clear that there were two links in "gitweb / gitweb.perl" page
> title, not just one link. Now it is not obvious that clicking
> different parts of the path string in "/stgit/commands/mail.py"
> would lead to different places. And as you are aware, losing
> the leading "/" would be nicer as well ;-).
Well, this was the best I could come up without introducing "[root] /"
or something in front of the path, which would be IMHO even uglier.
Alternative ideas welcomed. :-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:40 ` Petr Baudis
@ 2006-09-20 23:51 ` Junio C Hamano
2006-09-21 8:50 ` Jakub Narebski
1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2006-09-20 23:51 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Jakub Narebski
Petr Baudis <pasky@suse.cz> writes:
>> Hmph. I see the breakage and behaviour-wise your patch is fine.
>>
>> But I think the older one was visually nicer and more intuitive
>> in one very small detail that I think matters. Slashes between
>> path components were not part of the anchor elements, so it was
>> clear that there were two links in "gitweb / gitweb.perl" page
>> title, not just one link. Now it is not obvious that clicking
>> different parts of the path string in "/stgit/commands/mail.py"
>> would lead to different places. And as you are aware, losing
>> the leading "/" would be nicer as well ;-).
>
> Well, this was the best I could come up without introducing "[root] /"
> or something in front of the path, which would be IMHO even uglier.
> Alternative ideas welcomed. :-)
Ok, when I commented on it I did not realize that the leading
slash was clickable.
How about rendering it like this?
/ stgit/ commands/ mail.py
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:40 ` Petr Baudis
2006-09-20 23:51 ` Junio C Hamano
@ 2006-09-21 8:50 ` Jakub Narebski
2006-09-21 11:25 ` Petr Baudis
1 sibling, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2006-09-21 8:50 UTC (permalink / raw)
To: git
Petr Baudis wrote:
> Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
>> But I think the older one was visually nicer and more intuitive
>> in one very small detail that I think matters. Slashes between
>> path components were not part of the anchor elements, so it was
>> clear that there were two links in "gitweb / gitweb.perl" page
>> title, not just one link. Now it is not obvious that clicking
>> different parts of the path string in "/stgit/commands/mail.py"
>> would lead to different places. And as you are aware, losing
>> the leading "/" would be nicer as well ;-).
>
> Well, this was the best I could come up without introducing "[root] /"
> or something in front of the path, which would be IMHO even uglier.
> Alternative ideas welcomed. :-)
"[$project] /", or "~ /" instead of "[root] /".
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-21 8:50 ` Jakub Narebski
@ 2006-09-21 11:25 ` Petr Baudis
0 siblings, 0 replies; 10+ messages in thread
From: Petr Baudis @ 2006-09-21 11:25 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Dear diary, on Thu, Sep 21, 2006 at 10:50:46AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> Petr Baudis wrote:
>
> > Dear diary, on Thu, Sep 21, 2006 at 01:32:42AM CEST, I got a letter
> > where Junio C Hamano <junkio@cox.net> said that...
>
> >> But I think the older one was visually nicer and more intuitive
> >> in one very small detail that I think matters. Slashes between
> >> path components were not part of the anchor elements, so it was
> >> clear that there were two links in "gitweb / gitweb.perl" page
> >> title, not just one link. Now it is not obvious that clicking
> >> different parts of the path string in "/stgit/commands/mail.py"
> >> would lead to different places. And as you are aware, losing
> >> the leading "/" would be nicer as well ;-).
> >
> > Well, this was the best I could come up without introducing "[root] /"
> > or something in front of the path, which would be IMHO even uglier.
> > Alternative ideas welcomed. :-)
>
> "[$project] /", or "~ /" instead of "[root] /".
Yes, the former is what repo.or.cz uses now and in a patch I've sent
privately to Junio (since my StGIT configuration at repo.or.cz is messed
up and I had no time to fix it).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:12 [PATCH] gitweb: Fix showing of path in tree view Petr Baudis
2006-09-20 23:32 ` Junio C Hamano
@ 2006-09-20 23:35 ` Jakub Narebski
2006-09-20 23:38 ` Jakub Narebski
2006-09-21 10:19 ` Jakub Narebski
2 siblings, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2006-09-20 23:35 UTC (permalink / raw)
To: git
Petr Baudis wrote:
> This patch fixes two things - links to all path elements except the last
> one were broken since gitweb does not like the trailing slash in them, and
> the root tree was not reachable from the subdirectory view.
>
> To compensate for the one more slash in the front, the trailing slash is
> not there anymore. ;-) I don't care if it stays there though.
Originally '/' was used as separator between directories making the path.
I'd rather use ' / ' to separate parts of pathname more, and not incorporate
it in the link.
Trailing (final) slash is present (and I think should be present) only
for path in "tree" view. From the path alone you can see if it is "tree"
or "blob" view.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:35 ` Jakub Narebski
@ 2006-09-20 23:38 ` Jakub Narebski
2006-09-20 23:43 ` Petr Baudis
0 siblings, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2006-09-20 23:38 UTC (permalink / raw)
To: git
Jakub Narebski wrote:
> Petr Baudis wrote:
>
>> This patch fixes two things - links to all path elements except the last
>> one were broken since gitweb does not like the trailing slash in them, and
>> the root tree was not reachable from the subdirectory view.
>>
>> To compensate for the one more slash in the front, the trailing slash is
>> not there anymore. ;-) I don't care if it stays there though.
>
> Originally '/' was used as separator between directories making the path.
> I'd rather use ' / ' to separate parts of pathname more, and not incorporate
> it in the link.
>
> Trailing (final) slash is present (and I think should be present) only
> for path in "tree" view. From the path alone you can see if it is "tree"
> or "blob" view.
About link to root tree: we could change the commit title to link to root
tree instead of linking to commit view.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:38 ` Jakub Narebski
@ 2006-09-20 23:43 ` Petr Baudis
0 siblings, 0 replies; 10+ messages in thread
From: Petr Baudis @ 2006-09-20 23:43 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Dear diary, on Thu, Sep 21, 2006 at 01:38:49AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> Jakub Narebski wrote:
> > Trailing (final) slash is present (and I think should be present) only
> > for path in "tree" view. From the path alone you can see if it is "tree"
> > or "blob" view.
Which sounds like a nice property but the rest of the page looks totally
different anyway, so I don't know how practical that is.
> About link to root tree: we could change the commit title to link to root
> tree instead of linking to commit view.
I don't think that makes any sense. It's a _commit_ title! :-) And if I
want to get to root tree it wouldn't occur to me to click _there_
anyway.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gitweb: Fix showing of path in tree view
2006-09-20 23:12 [PATCH] gitweb: Fix showing of path in tree view Petr Baudis
2006-09-20 23:32 ` Junio C Hamano
2006-09-20 23:35 ` Jakub Narebski
@ 2006-09-21 10:19 ` Jakub Narebski
2 siblings, 0 replies; 10+ messages in thread
From: Jakub Narebski @ 2006-09-21 10:19 UTC (permalink / raw)
To: git
Petr Baudis wrote:
> This patch fixes two things - links to all path elements except the last
> one were broken since gitweb does not like the trailing slash in them, and
> the root tree was not reachable from the subdirectory view.
Wouldn't it be better to fix git_get_hash_by_path to have it strip trailing
slash? Gitweb don't like trailing slash in pathname (directory name)
because while
git ls-tree $base -- dirname
shows dirname entry
git ls-tree $base -- dirname/
shows directory _contents_.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-09-21 11:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-20 23:12 [PATCH] gitweb: Fix showing of path in tree view Petr Baudis
2006-09-20 23:32 ` Junio C Hamano
2006-09-20 23:40 ` Petr Baudis
2006-09-20 23:51 ` Junio C Hamano
2006-09-21 8:50 ` Jakub Narebski
2006-09-21 11:25 ` Petr Baudis
2006-09-20 23:35 ` Jakub Narebski
2006-09-20 23:38 ` Jakub Narebski
2006-09-20 23:43 ` Petr Baudis
2006-09-21 10:19 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).