summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-08-01 17:03:11 +0200
committerAndrey Loskutov <loskutov@gmx.de>2015-08-03 07:58:52 -0400
commita28ae3995fc4655be1400cf694e4b0d97db5df45 (patch)
treebfeb340b8d478953f6dcd7b6f2d0dc64818cdb4a /org.eclipse.jgit
parent204da3969e51d0e36b59924d697787ae9578332e (diff)
downloadjgit-a28ae3995fc4655be1400cf694e4b0d97db5df45.tar.gz
jgit-a28ae3995fc4655be1400cf694e4b0d97db5df45.zip
containsGitModulesFile() should not crash on bare repository
Change-Id: Iba7e4674b3d33c730613a6ac703977f48b015853 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java
index 7d9bca0d1b..6263d4b74d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java
@@ -451,13 +451,14 @@ public class SubmoduleWalk implements AutoCloseable {
}
/**
- * Checks whether the working tree (or the index in case of a bare repo)
- * contains a .gitmodules file. That's a hint that the repo contains
- * submodules.
+ * Checks whether the working tree contains a .gitmodules file. That's a
+ * hint that the repo contains submodules.
*
* @param repository
* the repository to check
- * @return <code>true</code> if the repo contains a .gitmodules file
+ * @return <code>true</code> if the working tree contains a .gitmodules file,
+ * <code>false</code> otherwise. Always returns <code>false</code>
+ * for bare repositories.
* @throws IOException
* @throws CorruptObjectException
* @since 3.6
@@ -465,8 +466,7 @@ public class SubmoduleWalk implements AutoCloseable {
public static boolean containsGitModulesFile(Repository repository)
throws IOException {
if (repository.isBare()) {
- DirCache dc = repository.readDirCache();
- return (dc.findEntry(Constants.DOT_GIT_MODULES) >= 0);
+ return false;
}
File modulesFile = new File(repository.getWorkTree(),
Constants.DOT_GIT_MODULES);