summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2012-06-25 10:46:36 -0700
committerKevin Sawicki <kevin@github.com>2012-06-25 10:46:36 -0700
commit2444aa231a3a9618a413b7e42e8120b42258702d (patch)
tree20eeef09e87d9940c3ab9812408dada1d10b0d56 /org.eclipse.jgit/src
parent1bf5b9c7a8d2d6c254cdb022100e9172bae6cf56 (diff)
downloadjgit-2444aa231a3a9618a413b7e42e8120b42258702d.tar.gz
jgit-2444aa231a3a9618a413b7e42e8120b42258702d.zip
Use the working tree's .gitmodules in SubmoduleWalk.forIndex()
This was broken in fe1f1b8f8aba60fdd1ad6f0f72e9c9180978cc60, which preferred the index over the working tree when both were present. Change-Id: I97dcf9a088adcbd0187fa7eec9ef34445ce3a981 Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java28
1 files changed, 9 insertions, 19 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 323965f7cc..e8022b69de 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java
@@ -94,8 +94,6 @@ public class SubmoduleWalk {
try {
DirCache index = repository.readDirCache();
generator.setTree(new DirCacheIterator(index));
- generator.setRootTree(new DirCacheIterator(index));
- generator.useWorkingTree = true;
} catch (IOException e) {
generator.release();
throw e;
@@ -304,8 +302,6 @@ public class SubmoduleWalk {
private String path;
- private boolean useWorkingTree;
-
/**
* Create submodule generator
*
@@ -388,7 +384,14 @@ public class SubmoduleWalk {
* @throws ConfigInvalidException
*/
public SubmoduleWalk loadModulesConfig() throws IOException, ConfigInvalidException {
- if (rootTree != null) {
+ if (rootTree == null) {
+ File modulesFile = new File(repository.getWorkTree(),
+ Constants.DOT_GIT_MODULES);
+ FileBasedConfig config = new FileBasedConfig(modulesFile,
+ repository.getFS());
+ config.load();
+ modulesConfig = config;
+ } else {
TreeWalk configWalk = new TreeWalk(repository);
try {
configWalk.addTree(rootTree);
@@ -411,10 +414,7 @@ public class SubmoduleWalk {
return this;
}
}
- if (!useWorkingTree) {
- modulesConfig = new Config();
- return this;
- }
+ modulesConfig = new Config();
} finally {
if (idx > 0)
rootTree.next(idx);
@@ -423,16 +423,6 @@ public class SubmoduleWalk {
configWalk.release();
}
}
- if (repository.isBare()) {
- modulesConfig = new Config();
- } else {
- File modulesFile = new File(repository.getWorkTree(),
- Constants.DOT_GIT_MODULES);
- FileBasedConfig config = new FileBasedConfig(modulesFile,
- repository.getFS());
- config.load();
- modulesConfig = config;
- }
return this;
}