Include roottree and file in the GitWebConfig.

Change-Id: Ia33da71d36346a13b0993fef87cd86de3ffdc560
This commit is contained in:
Colby Ranger
2013-12-16 14:19:18 -08:00
parent a3189303eb
commit 79d4ebec49
3 changed files with 32 additions and 2 deletions

View File

@@ -1462,6 +1462,25 @@ at a specific branch when `custom` is used above.
Valid replacements are `${project}` for the project name in Gerrit
and `${branch}` for the name of the branch.
[[gitweb.roottree]]gitweb.roottree::
+
Optional pattern to use for constructing the gitweb URL when pointing
at the contents of the root tree in a specific commit when `custom` is
used above.
+
Valid replacements are `${project}` for the project name in Gerrit
and `${commit}` for the SHA1 hash for the commit.
[[gitweb.file]]gitweb.file::
+
Optional pattern to use for constructing the gitweb URL when pointing
at the contents of a file in a specific commit when `custom` is used
above.
+
Valid replacements are `${project}` for the project name in Gerrit,
`${file}` for the file name and `${commit}` for the SHA1 hash for
the commit.
[[gitweb.filehistory]]gitweb.filehistory::
+
Optional pattern to use for constructing the gitweb URL when pointing

View File

@@ -245,6 +245,8 @@ $ git config -f $site_path/etc/gerrit.config gitweb.type custom
$ git config -f $site_path/etc/gerrit.config gitweb.project ?p=\${project}\;a=summary
$ git config -f $site_path/etc/gerrit.config gitweb.revision ?p=\${project}\;a=commit\;h=\${commit}
$ git config -f $site_path/etc/gerrit.config gitweb.branch ?p=\${project}\;a=shortlog\;h=\${branch}
$ git config -f $site_path/etc/gerrit.config gitweb.roottree ?p=\${project}\;a=tree\;hb=\${commit}
$ git config -f $site_path/etc/gerrit.config gitweb.file ?p=\${project}\;hb=\${commit}\;f=\${file}
$ git config -f $site_path/etc/gerrit.config gitweb.filehistory ?p=\${project}\;a=history\;hb=\${branch}\;f=\${file}
----
@@ -252,8 +254,9 @@ After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must
be restarted and clients must reload the host page to see the change.
Note that when using a custom gitweb configuration, values must be
specified for all of the `project`, `revision`, `branch` and `filehistory`
settings, otherwise the configuration will not be used.
specified for all of the `project`, `revision`, `branch`, `roottree`,
`file`, and `filehistory` settings, otherwise the configuration will
not be used.
Access Control
++++++++++++++

View File

@@ -54,6 +54,8 @@ public class GitWebConfig {
type.setBranch(cfg.getString("gitweb", null, "branch"));
type.setProject(cfg.getString("gitweb", null, "project"));
type.setRevision(cfg.getString("gitweb", null, "revision"));
type.setRootTree(cfg.getString("gitweb", null, "roottree"));
type.setFile(cfg.getString("gitweb", null, "file"));
type.setFileHistory(cfg.getString("gitweb", null, "filehistory"));
type.setLinkDrafts(cfg.getBoolean("gitweb", null, "linkdrafts", true));
type.setUrlEncode(cfg.getBoolean("gitweb", null, "urlencode", true));
@@ -80,6 +82,12 @@ public class GitWebConfig {
} else if (type.getRevision() == null) {
log.warn("No Pattern specified for gitweb.revision, disabling.");
type = null;
} else if (type.getRootTree() == null) {
log.warn("No Pattern specified for gitweb.roottree, disabling.");
type = null;
} else if (type.getFile() == null) {
log.warn("No Pattern specified for gitweb.file, disabling.");
type = null;
} else if (type.getFileHistory() == null) {
log.warn("No Pattern specified for gitweb.filehistory, disabling.");
type = null;