[PATCH] gitweb: fix link to parent diff with pathinfo
- From
- Richard Braun <rbraun@sceen.net>
- Date
- May 7, 2016, 00:11 UTC
- Message-ID
- <1462579902-18907-1-git-send-email-rbraun@sceen.net>
- In-Reply-To
- <xmqqmvo225fg.fsf@gitster.mtv.corp.google.com>
Gitweb, when used with PATH_INFO, shows a link to parent diff like http://somedomain/somerepo.git/commitdiff/somehash?hp=parenthash. That link reports "400 - Invalid hash parameter".
As I understand it, it should instead directly point to the parent diff, i.e. turn it into http://somedomain/somerepo.git/commitdiff/parenthash, and delete 'hash_parent' element from the %params hash once we used it, otherwise the '?hp=parenthash' string is appended.
Signed-off-by: Richard Braun <rbraun@sceen.net> --- gitweb/gitweb.perl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 05d7910..f7f7936 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1423,7 +1423,12 @@ sub href { delete $params{'hash'}; delete $params{'hash_base'}; } elsif (defined $params{'hash'}) { - $href .= esc_path_info($params{'hash'}); + if (defined $params{'hash_parent'}) { + $href .= esc_path_info($params{'hash_parent'}); + delete $params{'hash_parent'}; + } else { + $href .= esc_path_info($params{'hash'}); + } delete $params{'hash'}; }
-- 2.1.4