redirects: add support for plain h=<sha>

This patch adds support to handling if a sha is provided as a head
inside cgit.

Change-Id: I661e6061e86cb0ed68bbccaec4bc8950ea134c8a
This commit is contained in:
Mohammed Naser 2019-04-20 00:01:13 -04:00 committed by James E. Blair
parent 1ee61397a3
commit f6161798f5
1 changed files with 10 additions and 0 deletions

View File

@ -61,6 +61,11 @@ RewriteRule "^cgit/(.*?)/(.*?)/tree/?(.*)" "https://opendev.org/$1/$2/src/branch
RewriteCond %{QUERY_STRING} id=([\w]+)
RewriteRule "^cgit/(.*?)/(.*?)/plain/?$" "https://opendev.org/$1/$2/src/commit/%1/$3" [L,QSD]
# h=
# we have a commit pointed for a head
RewriteCond %{QUERY_STRING} h=([0-9a-f]{40})
RewriteRule "^cgit/(.*?)/(.*?)/plain/?$" "https://opendev.org/$1/$2/src/commit/%1/$3" [L,QSD]
# h=
# if there's no commit, but a branch:
RewriteCond %{QUERY_STRING} h=([\w/]+)
@ -78,6 +83,11 @@ RewriteRule "^cgit/(.*?)/(.*?)/plain/?$" "https://opendev.org/$1/$2/src/branch/m
RewriteCond %{QUERY_STRING} id=([\w]+)
RewriteRule "^cgit/(.*?)/(.*?)/plain/?(.*)" "https://opendev.org/$1/$2/raw/commit/%1/$3" [L,QSD]
# h=
# we have a commit pointed for a head
RewriteCond %{QUERY_STRING} h=([0-9a-f]{40})
RewriteRule "^cgit/(.*?)/(.*?)/plain/?(.*)$" "https://opendev.org/$1/$2/raw/commit/%1/$3" [L,QSD]
# h=
# if there's no commit, but a branch:
RewriteCond %{QUERY_STRING} h=([\w/]+)