Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2017-03-24 01:26:44 +0000
committerMatthias Sohn2017-06-11 10:24:12 +0000
commitb6f954ad426f91561b4aa09d7ba23652516e7b0a (patch)
tree2e17a47047fc0ef2b48aea04b6b1bbbeaa404569 /org.eclipse.jgit/src/org/eclipse/jgit/api
parent325b51dbd4ada37ab8890f38f2bbc046ee9bb92e (diff)
downloadjgit-b6f954ad426f91561b4aa09d7ba23652516e7b0a.tar.gz
jgit-b6f954ad426f91561b4aa09d7ba23652516e7b0a.tar.xz
jgit-b6f954ad426f91561b4aa09d7ba23652516e7b0a.zip
Fetch: Add --recurse-submodules and --no-recurse-submodules options
Add options to control recursion into submodules on fetch. Add a callback interface on FetchCommand, to allow Fetch to display an update "Fetching submodule XYZ" for each submodule. Change-Id: Id805044b57289ee0f384b434aba1dbd2fd317e5b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
index cc3302b486..785c20c8af 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
@@ -99,6 +99,24 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
private FetchRecurseSubmodulesMode submoduleRecurseMode = null;
+ private Callback callback;
+
+ /**
+ * Callback for status of fetch operation.
+ *
+ * @since 4.8
+ *
+ */
+ public interface Callback {
+ /**
+ * Notify fetching a submodule.
+ *
+ * @param name
+ * the submodule name.
+ */
+ void fetchingSubmodule(String name);
+ }
+
/**
* @param repo
*/
@@ -173,6 +191,9 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
.setThin(thin).setRefSpecs(refSpecs)
.setDryRun(dryRun)
.setRecurseSubmodules(recurseMode);
+ if (callback != null) {
+ callback.fetchingSubmodule(walk.getPath());
+ }
results.addSubmodule(walk.getPath(), f.call());
}
}
@@ -434,4 +455,17 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
this.tagOption = tagOpt;
return this;
}
+
+ /**
+ * Register a progress callback.
+ *
+ * @param callback
+ * the callback
+ * @return {@code this}
+ * @since 4.8
+ */
+ public FetchCommand setCallback(Callback callback) {
+ this.callback = callback;
+ return this;
+ }
}

Back to the top