]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
viewvcs: fix b= generation in $REPO/tree/ listing
authorEric Wong <e@80x24.org>
Tue, 24 Sep 2024 18:35:48 +0000 (18:35 +0000)
committerEric Wong <e@80x24.org>
Wed, 25 Sep 2024 21:49:06 +0000 (21:49 +0000)
Queries such as `b=contrib/cssREADME' are incorrect despite
having the actual blob OID for the given file.  Add a trailing
slash for files in a project subdirectory in those cases as we
do for cases we don't have a known path name.

While we're in the area, avoid needless shadowing of the `$t'
var and add a comment to describe its contents.

lib/PublicInbox/ViewVCS.pm

index b69214bc8025468587764028015d09c4b4a0614e..14c2e4e3d5c7887a5709a19bb19c9a281049d4fd 100644 (file)
@@ -409,8 +409,9 @@ sub show_tree_result ($$) {
        my $upfx = $ctx->{-upfx} //= '../../';
        if (defined $pfx) {
                $pfx =~ s!/+\z!!s;
-               if (my $t = $ctx->{-obj}) {
-                       my $t = ascii_html($t);
+               if (my $t = $ctx->{-obj}) { # $t eq "$tip:$path"
+                       $t = ascii_html($t);
+                       $pfx .= '/' if $pfx ne '';
                        $$bref .= <<EOM
 \n\$ git ls-tree -l $t # shows similar output on the CLI
 EOM