summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-09-15 12:44:10 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2017-09-20 21:49:47 +0200
commite32aed6d7536ca569a3b8fbd7daef3d7c827ce8c (patch)
treef17ab3e47572a0ef5a0b5f51c02a2ea162ffdf9e
parent06835f3e4f0053bb4b39baa02ba4ec32abf3085e (diff)
downloadjgit-e32aed6d7536ca569a3b8fbd7daef3d7c827ce8c.tar.gz
jgit-e32aed6d7536ca569a3b8fbd7daef3d7c827ce8c.zip
SubmoduleUpdateCommand: Add fetch callback
When the submodule already exists, it is fetched instead of cloned. Use the fetch callback instead of clone callback in this case. Change-Id: I170c21ab92b4117f25fdf940fe6807f214b04d39 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
index c0aeb83d49..4faaac2dbc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
@@ -91,6 +91,8 @@ public class SubmoduleUpdateCommand extends
private CloneCommand.Callback callback;
+ private FetchCommand.Callback fetchCallback;
+
private boolean fetch = false;
/**
@@ -191,10 +193,8 @@ public class SubmoduleUpdateCommand extends
clone.setProgressMonitor(monitor);
submoduleRepo = clone.call().getRepository();
} else if (this.fetch) {
- if (callback != null) {
- // FIXME: Do we need a new callback to tell them we're
- // fetching?
- callback.cloningSubmodule(generator.getPath());
+ if (fetchCallback != null) {
+ fetchCallback.fetchingSubmodule(generator.getPath());
}
FetchCommand fetchCommand = Git.wrap(submoduleRepo).fetch();
if (monitor != null) {
@@ -274,4 +274,18 @@ public class SubmoduleUpdateCommand extends
this.callback = callback;
return this;
}
+
+ /**
+ * Set status callback for submodule fetch operation.
+ *
+ * @param callback
+ * the callback
+ * @return {@code this}
+ * @since 4.9
+ */
+ public SubmoduleUpdateCommand setFetchCallback(
+ FetchCommand.Callback callback) {
+ this.fetchCallback = callback;
+ return this;
+ }
}