summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMathias Kinzler2010-07-28 07:58:39 (EDT)
committer Shawn O. Pearce2010-07-28 14:59:07 (EDT)
commit6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd (patch)
tree04f13524ccf898544ae3686cbb5f1807f1f517a0
parent08c0c5d938201f76592b9b623ccd4cbf260b8b82 (diff)
downloadjgit-6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd.zip
jgit-6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd.tar.gz
jgit-6e59e6dab963f2ae796a1e331a716fc7f4f9bfdd.tar.bz2
Meaningful error message when trying to check-out submodulesrefs/changes/83/1083/4
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>
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java4
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 1b2b81f..a9878f8 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 9d1e2cd..461242c 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 ef3d784..beab61a 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;