Fix compatibility with recent releases of Gitweb.

Gitweb moved resources to "static" subdirectory, so Gerrit should
try to load resources from both: new and old locations.

While there, add $javascript to Gerrit's generated Gitweb config.

Change-Id: I129d5868c0ed9dff49472524aa44926c08b2dce6
Signed-off-by: Piotr Sikora <piotr.sikora@frickle.com>
This commit is contained in:
Piotr Sikora
2011-02-27 17:04:28 +00:00
parent d1a8369951
commit f0e01c1e35
2 changed files with 5 additions and 2 deletions

View File

@@ -81,7 +81,8 @@ public class GitWebConfig {
}
final File pkgCgi = new File("/usr/lib/cgi-bin/gitweb.cgi");
String[] resourcePaths = {"/usr/share/gitweb", "/var/www"};
String[] resourcePaths = {"/usr/share/gitweb/static", "/usr/share/gitweb",
"/var/www/static", "/var/www"};
File cgi;
if (cfgCgi != null) {
@@ -100,7 +101,8 @@ public class GitWebConfig {
// Assume the administrator pointed us to the distribution,
// which also has the corresponding CSS and logo file.
//
resourcePaths = new String[] {cgi.getParentFile().getAbsolutePath()};
String absPath = cgi.getParentFile().getAbsolutePath();
resourcePaths = new String[] {absPath + "/static", absPath};
}
} else if (pkgCgi.isFile() && pkgCgi.canExecute()) {

View File

@@ -158,6 +158,7 @@ class GitWebServlet extends HttpServlet {
p.print("$favicon = 'favicon.ico';\n");
p.print("$logo = 'gitweb-logo.png';\n");
p.print("$javascript = 'gitweb.js';\n");
p.print("@stylesheets = ('gitweb-default.css');\n");
final File css = site.site_css;
if (css.isFile()) {