]> source.dussan.org Git - jgit.git/commitdiff
Meaningful error message when trying to check-out submodules 83/1083/4
authorMathias Kinzler <mathias.kinzler@sap.com>
Wed, 28 Jul 2010 11:58:39 +0000 (13:58 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 28 Jul 2010 18:59:07 +0000 (11:59 -0700)
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>
org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java

index 1b2b81fce3ed7909ca811c989d49a5fd0fc77990..a9878f8d297c8d21d343e584bc78121c79e08d61 100644 (file)
@@ -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
index 9d1e2cd808c391701cfbbb2291b9d2acce04361b..461242cb271da2bdd35874ec7ff226fea6526f1e 100644 (file)
@@ -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;
index ef3d7840f747c26acc10b9e776639beff80e6ecd..beab61abe281161d38f7b251e4c9d7133d7ae1a4 100644 (file)
@@ -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;