about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepoGitDiffCommon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-02-15 22:35:18 +0000
committerEric Wong <e@80x24.org>2017-02-16 04:27:50 +0000
commitf6244586ba4f5a5e7575e1254be8c9bbe303fce9 (patch)
treed1a8dd757b632f8cff66e3878f7cfc01e6e2f12d /lib/PublicInbox/RepoGitDiffCommon.pm
parent993dc7a772b10deda15733c8e750d98bf4d27bd0 (diff)
downloadpublic-inbox-f6244586ba4f5a5e7575e1254be8c9bbe303fce9.tar.gz
Query strings make endpoint caching more difficult since
they're order-independent.  They are also more likely lost
or truncated inadvertantly when copy+pasting, so try to
avoid them for default endpoints.

There's still some things which are broken and followup
commits will be needed to fix them.
Diffstat (limited to 'lib/PublicInbox/RepoGitDiffCommon.pm')
-rw-r--r--lib/PublicInbox/RepoGitDiffCommon.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/RepoGitDiffCommon.pm b/lib/PublicInbox/RepoGitDiffCommon.pm
index 0604f9dd..3e3ea4ee 100644
--- a/lib/PublicInbox/RepoGitDiffCommon.pm
+++ b/lib/PublicInbox/RepoGitDiffCommon.pm
@@ -68,17 +68,16 @@ sub git_diff_ab_hunk ($$$$) {
                 $na = defined $na ? "#n$na" : '';
                 my $p = $req->{p}->[0];
                 $rv .= qq(<a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$req->{path_a}?id=$p$na">);
+                $rv .= qq(\nhref="${rel}tree/$p/$req->{path_a}$na">);
                 $rv .= "$ca</a>";
         }
         $rv .= ' ';
         if (defined($nb) && $nb == 0) { # deleted file
                 $rv .= $cb;
         } else {
-                my $h = $req->{h};
                 $nb = defined $nb ? "#n$nb" : '';
                 $rv .= qq(<a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$req->{path_b}?id=$h$nb">);
+                $rv .= qq(\nhref="${rel}tree/$req->{-tip}/$req->{path_b}$nb">);
                 $rv .= "$cb</a>";
         }
         $rv . ' @@' . utf8_html($ctx);
@@ -129,7 +128,7 @@ sub git_diff_cc_hunk {
         } else {
                 my $h = $req->{h};
                 $rv .= qq( <a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$path?id=$h#n$n">$last</a>);
+                $rv .= qq(\nhref="${rel}tree/$h/$path#n$n">$last</a>);
         }
         $rv .= " $at" . utf8_html($ctx);
 }