Move git_base_path to gerrit.config
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index d0f84c4..d16218f 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -312,6 +312,15 @@
Section gerrit
~~~~~~~~~~~~~~
+gerrit.basePath::
++
+Local filesystem directory holding all Git repositories that
+Gerrit knows about and can process changes for. A project
+entity in Gerrit maps to a local Git repository by creating
+the path string `"$\{basePath}/$\{project_name}.git"`.
++
+If relative, the path is resolved relative to `'$site_path'`.
+
gerrit.canonicalWebUrl::
+
The default URL for Gerrit to be accessed through.
@@ -344,7 +353,7 @@
+
Optional URL of an affiliated gitweb service. Defines the
web location where a `gitweb.cgi` is installed to browse
-`'$git_base_path'` and the repositories it contains.
+gerrit.basePath and the repositories it contains.
+
Gerrit appends any necessary query arguments onto the end of this URL.
For example, "?p=$project.git;h=$commit".
@@ -481,13 +490,6 @@
* link:config-headerfooter.html[Site Header/Footer]
* link:config-replication.html[Git Replication/Mirroring]
-git_base_path::
-+
-Local filesystem directory holding all Git repositories that
-Gerrit knows about and can process changes for. A project
-entity in Gerrit maps to a local Git repository by creating
-the path string `"$\{git_pase_path}/$\{project_name}.git"`.
-
Not User Serviceable
~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/config-gitweb.txt b/Documentation/config-gitweb.txt
index 864a819..416c34c 100644
--- a/Documentation/config-gitweb.txt
+++ b/Documentation/config-gitweb.txt
@@ -7,9 +7,10 @@
To enable the gitweb integration, set gitweb.url with the URL of
your gitweb CGI.
-The CGI's `$projectroot` should be `'$git_base_path'`, or a fairly
-current replica. If a replica is being used, ensure it uses a full
-mirror, so the `refs/changes/*` namespace is available.
+The CGI's `$projectroot` should be the same directory as
+gerrit.basePath, or a fairly current replica. If a replica is
+being used, ensure it uses a full mirror, so the `refs/changes/*`
+namespace is available.
====
git config --file=$site_path/gerrit.config gitweb.url http://example.com/gitweb.cgi
diff --git a/Documentation/install.txt b/Documentation/install.txt
index ddcd122..fc87ecd 100644
--- a/Documentation/install.txt
+++ b/Documentation/install.txt
@@ -180,7 +180,7 @@
====
mkdir /srv/git
- UPDATE system_config SET git_base_path='/srv/git'
+ git config --file=$site_path/gerrit.config gerrit.basePath /srv/git
====
You may wish to consider also exporting this directory over the
diff --git a/Documentation/project-setup.txt b/Documentation/project-setup.txt
index cf72bc1..0c95781 100644
--- a/Documentation/project-setup.txt
+++ b/Documentation/project-setup.txt
@@ -1,17 +1,17 @@
Gerrit2 - Project Configuration
===============================
-All Git repositories under `'$git_base_path'` must be registered in
+All Git repositories under gerrit.basePath must be registered in
the Gerrit database in order to be accessed through SSH, or through
the web interface.
Create Git Repository
---------------------
-Create a Git repository under `'$git_base_path'`:
+Create a Git repository under gerrit.basePath:
====
- git --git-dir=$git_base_path/new/project.git init
+ git --git-dir=$base_path/new/project.git init
====
[TIP]
@@ -22,7 +22,7 @@
protocol, don't forget to create a `git-daemon-export-ok` file:
====
- touch $git_base_path/new/project.git/git-daemon-export-ok
+ touch $base_path/new/project.git/git-daemon-export-ok
====
Register Project
diff --git a/src/main/java/com/google/gerrit/client/reviewdb/SystemConfig.java b/src/main/java/com/google/gerrit/client/reviewdb/SystemConfig.java
index 2a42c66..4909396 100644
--- a/src/main/java/com/google/gerrit/client/reviewdb/SystemConfig.java
+++ b/src/main/java/com/google/gerrit/client/reviewdb/SystemConfig.java
@@ -83,10 +83,6 @@
@Column(notNull = false)
public transient String sitePath;
- /** Local filesystem location all projects reside within. */
- @Column(notNull = false)
- public transient String gitBasePath;
-
/** Identity of the administration group; those with full access. */
@Column
public AccountGroup.Id adminGroupId;
diff --git a/src/main/java/com/google/gerrit/pgm/ConvertSystemConfig.java b/src/main/java/com/google/gerrit/pgm/ConvertSystemConfig.java
index 140173a..64bac4c0 100644
--- a/src/main/java/com/google/gerrit/pgm/ConvertSystemConfig.java
+++ b/src/main/java/com/google/gerrit/pgm/ConvertSystemConfig.java
@@ -73,6 +73,7 @@
private static void gerrit(RepositoryConfig config, ResultSet rs)
throws SQLException {
+ copy(config, "gerrit", "basepath", rs, "git_base_path");
copy(config, "gerrit", "canonicalweburl", rs, "canonical_url");
copy(config, "gerrit", "canonicalgiturl", rs, "git_daemon_url");
}
diff --git a/src/main/java/com/google/gerrit/server/GerritServer.java b/src/main/java/com/google/gerrit/server/GerritServer.java
index 621fb12..6846c77 100644
--- a/src/main/java/com/google/gerrit/server/GerritServer.java
+++ b/src/main/java/com/google/gerrit/server/GerritServer.java
@@ -223,8 +223,14 @@
account = new SignedToken(accountCookieAge, sConfig.accountPrivateKey);
emailReg = new SignedToken(5 * 24 * 60 * 60, sConfig.accountPrivateKey);
- if (sConfig.gitBasePath != null) {
- repositories = new RepositoryCache(new File(sConfig.gitBasePath));
+ final String basePath =
+ getGerritConfig().getString("gerrit", null, "basepath");
+ if (basePath != null) {
+ File root = new File(basePath);
+ if (!root.isAbsolute()) {
+ root = new File(getSitePath(), basePath);
+ }
+ repositories = new RepositoryCache(root);
} else {
repositories = null;
}
diff --git a/src/main/java/com/google/gerrit/server/ssh/AbstractCommand.java b/src/main/java/com/google/gerrit/server/ssh/AbstractCommand.java
index e71cd49..e1bbb99 100644
--- a/src/main/java/com/google/gerrit/server/ssh/AbstractCommand.java
+++ b/src/main/java/com/google/gerrit/server/ssh/AbstractCommand.java
@@ -109,7 +109,7 @@
final RepositoryCache rc = getGerritServer().getRepositoryCache();
if (rc == null) {
throw new Failure(128, "fatal: Gerrit repositories are not available",
- new IllegalStateException("git_base_path not set in system_config"));
+ new IllegalStateException("gerrit.basePath not set"));
}
return rc;
}
diff --git a/src/main/webapp/WEB-INF/sql/upgrade011_012_part2.sql b/src/main/webapp/WEB-INF/sql/upgrade011_012_part2.sql
index b98e7f3..7083e35 100644
--- a/src/main/webapp/WEB-INF/sql/upgrade011_012_part2.sql
+++ b/src/main/webapp/WEB-INF/sql/upgrade011_012_part2.sql
@@ -7,6 +7,7 @@
ALTER TABLE system_config DROP COLUMN contact_store_appsec;
ALTER TABLE system_config DROP COLUMN gerrit_git_name;
ALTER TABLE system_config DROP COLUMN gerrit_git_email;
+ALTER TABLE system_config DROP COLUMN git_base_path;
ALTER TABLE system_config DROP COLUMN git_daemon_url;
ALTER TABLE system_config DROP COLUMN gitweb_url;
ALTER TABLE system_config DROP COLUMN email_format;