Support gitweb.type=disabled Change-Id: I7d2d37658b45a9f779314d365c4aa14066fc7a3a Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index 66c8863..fdac4a5 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt
@@ -1054,9 +1054,10 @@ [[gitweb.type]]gitweb.type:: + Optional type of affiliated gitweb service. This allows using -alternatives to gitweb, such as cgit. +alternatives to gitweb, such as cgit. If set to disabled there +is no gitweb hyperlinking support. + -Valid values are `gitweb`, `cgit` or `custom`. +Valid values are `gitweb`, `cgit`, `disabled` or `custom`. [[gitweb.type]]gitweb.revision:: +
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GitWebType.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GitWebType.java index 7eb6955..1cef884 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GitWebType.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GitWebType.java
@@ -40,6 +40,9 @@ } else if (name.equalsIgnoreCase("custom")) { type = new GitWebType(); + } else if (name.equalsIgnoreCase("disabled")) { + type = null; + } else { type = null; }
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitWebConfig.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitWebConfig.java index b37a152..ff55e2f 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitWebConfig.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitWebConfig.java
@@ -41,6 +41,15 @@ final String cfgCgi = cfg.getString("gitweb", null, "cgi"); type = GitWebType.fromName(cfg.getString("gitweb", null, "type")); + if (type == null) { + url = null; + gitweb_cgi = null; + gitweb_css = null; + gitweb_js = null; + git_logo_png = null; + return; + } + type.setBranch(cfg.getString("gitweb", null, "branch")); type.setProject(cfg.getString("gitweb", null, "project")); type.setRevision(cfg.getString("gitweb", null, "revision")); @@ -57,7 +66,7 @@ } if ((cfgUrl != null && cfgUrl.isEmpty()) - || (cfgCgi != null && cfgCgi.isEmpty()) || type == null) { + || (cfgCgi != null && cfgCgi.isEmpty())) { // Either setting was explicitly set to the empty string disabling // gitweb for this server. Disable the configuration. //