summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorStefan Lay <stefan.lay@sap.com>2010-09-17 09:32:28 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-09-17 09:32:28 -0400
commitfeeb3df0475f82ca82afb9e397bff8c1bf663efd (patch)
tree50cb0c187eb9a0539cb5383de73471c31e0e31a0 /org.eclipse.jgit
parent4b5d3d291bfc0a665373ee1c74cb88e3d88ce3ca (diff)
parent3fe527624dcecd96c16901d6621a2e37e7ef814a (diff)
downloadjgit-feeb3df0475f82ca82afb9e397bff8c1bf663efd.tar.gz
jgit-feeb3df0475f82ca82afb9e397bff8c1bf663efd.zip
Merge "Probe filesystem and set core.filemode correctly"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
index 66e7ebc015..36d160ce64 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
@@ -231,10 +231,26 @@ public class FileRepository extends Repository {
head.disableRefLog();
head.link(Constants.R_HEADS + Constants.MASTER);
+ final boolean fileMode;
+ if (getFS().supportsExecute()) {
+ File tmp = File.createTempFile("try", "execute", getDirectory());
+
+ getFS().setExecute(tmp, true);
+ final boolean on = getFS().canExecute(tmp);
+
+ getFS().setExecute(tmp, false);
+ final boolean off = getFS().canExecute(tmp);
+ tmp.delete();
+
+ fileMode = on && !off;
+ } else {
+ fileMode = false;
+ }
+
cfg.setInt(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 0);
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
- ConfigConstants.CONFIG_KEY_FILEMODE, true);
+ ConfigConstants.CONFIG_KEY_FILEMODE, fileMode);
if (bare)
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_BARE, true);