diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2014-11-08 18:46:25 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-11-09 22:44:07 +0100 |
commit | 9597c41ea9db20d769f7b8c54eafa207824e5bd6 (patch) | |
tree | 27936da53fa9e54285ab363829e79f6131be0131 /org.eclipse.jgit.test | |
parent | 714f677ca54731a011b50a4559f869c9d207ce19 (diff) | |
download | jgit-9597c41ea9db20d769f7b8c54eafa207824e5bd6.tar.gz jgit-9597c41ea9db20d769f7b8c54eafa207824e5bd6.zip |
Fix possible NPE in IndexDiff when not all submodules are cloned
The latest changes to IndexDiff just assumed that all configured
submodules are allways cloned. If a configured submodule did not exist
an exception was thrown. This is fixed by this commit.
Bug: 450567
Change-Id: Iabe3b196d998c19483082e5720038ebddaeb1890
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java index 383ff5011c..251938fece 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java @@ -56,11 +56,15 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.Status; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheEditor; import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit; import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.errors.NoWorkTreeException; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.Config; @@ -98,7 +102,7 @@ public class SubmoduleWalkTest extends RepositoryTestCase { @Test public void repositoryWithRootLevelSubmodule() throws IOException, - ConfigInvalidException { + ConfigInvalidException, NoWorkTreeException, GitAPIException { final ObjectId id = ObjectId .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234"); final String path = "sub"; @@ -124,6 +128,8 @@ public class SubmoduleWalkTest extends RepositoryTestCase { assertNull(gen.getModulesUpdate()); assertNull(gen.getModulesUrl()); assertNull(gen.getRepository()); + Status status = Git.wrap(db).status().call(); + assertTrue(!status.isClean()); assertFalse(gen.next()); } |