aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-02-16 14:18:04 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2017-03-24 00:02:45 +0100
commit5f902f07ccae32b82a36c05e1eca23b21a27da99 (patch)
treef99b7432ae210ba155cb0c1cc0aa72263a06b92a /org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
parentfa2851ce78b37601f64f818d92e251634ac1bb39 (diff)
downloadjgit-5f902f07ccae32b82a36c05e1eca23b21a27da99.tar.gz
jgit-5f902f07ccae32b82a36c05e1eca23b21a27da99.zip
PullCommand: Add support for recursing into submodules
Add a new API method to set the recurse mode, and pass the mode into the fetch command. Extend the existing FetchCommandRecurseSubmodulesTest to also perform the same tests for fetch. Rename the test class accordingly. Change-Id: I12553af47774b4778f7011e1018bd575a7909bd0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index 49d1a824eb..ae822da568 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -69,6 +69,7 @@ import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryState;
+import org.eclipse.jgit.lib.SubmoduleConfig.FetchRecurseSubmodulesMode;
import org.eclipse.jgit.merge.MergeStrategy;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.TagOpt;
@@ -95,6 +96,8 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
private TagOpt tagOption;
+ private FetchRecurseSubmodulesMode submoduleRecurseMode = null;
+
/**
* @param repo
*/
@@ -277,7 +280,8 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
JGitText.get().pullTaskName));
FetchCommand fetch = new FetchCommand(repo).setRemote(remote)
- .setProgressMonitor(monitor).setTagOpt(tagOption);
+ .setProgressMonitor(monitor).setTagOpt(tagOption)
+ .setRecurseSubmodules(submoduleRecurseMode);
configure(fetch);
fetchRes = fetch.call();
@@ -428,6 +432,19 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
}
/**
+ * Set the mode to be used for recursing into submodules.
+ *
+ * @param recurse
+ * @return {@code this}
+ * @since 4.7
+ */
+ public PullCommand setRecurseSubmodules(
+ FetchRecurseSubmodulesMode recurse) {
+ this.submoduleRecurseMode = recurse;
+ return this;
+ }
+
+ /**
* Reads the rebase mode to use for a pull command from the repository
* configuration. This is the value defined for the configurations
* {@code branch.[branchName].rebase}, or,if not set, {@code pull.rebase}.