diff options
author | Mathias Kinzler <mathias.kinzler@sap.com> | 2010-07-28 13:58:39 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-07-28 11:59:07 -0700 |
commit | 6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd (patch) | |
tree | 04f13524ccf898544ae3686cbb5f1807f1f517a0 /org.eclipse.jgit | |
parent | 08c0c5d938201f76592b9b623ccd4cbf260b8b82 (diff) | |
download | jgit-6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd.tar.gz jgit-6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd.zip |
Meaningful error message when trying to check-out submodules
Currently, a NullPointerException occurs in this case. We should
instead throw a more meaningful Exception with a proper message.
This is a very "stupid" implementation which simply checks for
the existence of a ".gitmodules" file.
Bug: 300731
Bug: 306765
Bug: 308452
Bug: 314853
Change-Id: I155aa340a85cbc5d7d60da31dba199fc30689b67
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
3 files changed, 6 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties index 1b2b81fce3..a9878f8d29 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties @@ -335,6 +335,7 @@ sourceRefNotSpecifiedForRefspec=Source ref not specified for refspec: {0} staleRevFlagsOn=Stale RevFlags on {0} startingReadStageWithoutWrittenRequestDataPendingIsNotSupported=Starting read stage without written request data pending is not supported statelessRPCRequiresOptionToBeEnabled=stateless RPC requires {0} to be enabled +submodulesNotSupported=Submodules are not supported symlinkCannotBeWrittenAsTheLinkTarget=Symlink "{0}" cannot be written as the link target cannot be read from within Java. tSizeMustBeGreaterOrEqual1=tSize must be >= 1 theFactoryMustNotBeNull=The factory must not be null diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java index 9d1e2cd808..461242cb27 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java @@ -394,6 +394,7 @@ public class JGitText extends TranslationBundle { /***/ public String staleRevFlagsOn; /***/ public String startingReadStageWithoutWrittenRequestDataPendingIsNotSupported; /***/ public String statelessRPCRequiresOptionToBeEnabled; + /***/ public String submodulesNotSupported; /***/ public String symlinkCannotBeWrittenAsTheLinkTarget; /***/ public String tSizeMustBeGreaterOrEqual1; /***/ public String theFactoryMustNotBeNull; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java index ef3d7840f7..beab61abe2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java @@ -165,6 +165,10 @@ public class WorkDirCheckout { private void checkoutOutIndexNoHead() throws IOException { new IndexTreeWalker(index, merge, root, new AbstractIndexTreeVisitor() { public void visitEntry(TreeEntry m, Entry i, File f) throws IOException { + // TODO remove this once we support submodules + if (f.getName().equals(".gitmodules")) + throw new UnsupportedOperationException( + JGitText.get().submodulesNotSupported); if (m == null) { index.remove(root, f); return; |