summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorian Zschocke <florian.zschocke@cycos.com>2013-08-20 13:41:20 +0200
committerFlorian Zschocke <florian.zschocke@cycos.com>2013-08-26 12:39:57 +0200
commit3a067e5b667bb30b7ddd18f7860358d725f01219 (patch)
tree398fad90f8a4033a5e7622edf2a09ecf63447ec0 /src
parente85277e1de9f59ac45df5ffd84c5d9be0e4d20d2 (diff)
downloadgitblit-3a067e5b667bb30b7ddd18f7860358d725f01219.tar.gz
gitblit-3a067e5b667bb30b7ddd18f7860358d725f01219.zip
Add new property git.createRepositoriesShared.
Diffstat (limited to 'src')
-rw-r--r--src/main/distrib/data/gitblit.properties9
-rw-r--r--src/main/java/com/gitblit/GitBlit.java11
2 files changed, 18 insertions, 2 deletions
diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties
index 9be7f645..724bcb62 100644
--- a/src/main/distrib/data/gitblit.properties
+++ b/src/main/distrib/data/gitblit.properties
@@ -174,6 +174,15 @@ git.defaultAuthorizationControl = NAMED
# SINCE 1.3.0
git.defaultIncrementalPushTagPrefix = r
+# In an Unix environment where mixed access methods exist for shared repositories,
+# the repository should be created with 'git init --shared' to make sure that
+# it can be accessed e.g. via ssh (user git) and http (user www-data).
+# Valid values are the values available for the '--shared' option. The the manual
+# page for 'git init' for more information on shared repositories.
+#
+# SINCE 1.3.2
+git.createRepositoriesShared = false
+
# Enable JGit-based garbage collection. (!!EXPERIMENTAL!!)
#
# USE AT YOUR OWN RISK!
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java
index 6ea348d5..67833822 100644
--- a/src/main/java/com/gitblit/GitBlit.java
+++ b/src/main/java/com/gitblit/GitBlit.java
@@ -2426,7 +2426,8 @@ public class GitBlit implements ServletContextListener {
}
// create repository
logger.info("create repository " + repository.name);
- r = JGitUtils.createRepository(repositoriesFolder, repository.name);
+ String shared = getString(Keys.git.createRepositoriesShared, "FALSE");
+ r = JGitUtils.createRepository(repositoriesFolder, repository.name, shared);
} else {
// rename repository
if (!repositoryName.equalsIgnoreCase(repository.name)) {
@@ -2528,7 +2529,13 @@ public class GitBlit implements ServletContextListener {
// close the repository object
r.close();
}
-
+
+ // Adjust permissions in case we updated the config files
+ JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "config"),
+ getString(Keys.git.createRepositoriesShared, "FALSE"));
+ JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "HEAD"),
+ getString(Keys.git.createRepositoriesShared, "FALSE"));
+
// update repository cache
removeFromCachedRepositoryList(repositoryName);
// model will actually be replaced on next load because config is stale