aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java16
1 files changed, 16 insertions, 0 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 e2f356a08e..de1a3e9fd0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java
@@ -65,6 +65,7 @@ import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.merge.MergeStrategy;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.submodule.SubmoduleWalk;
@@ -84,6 +85,8 @@ public class SubmoduleUpdateCommand extends
private final Collection<String> paths;
+ private MergeStrategy strategy = MergeStrategy.RECURSIVE;
+
/**
* @param repo
*/
@@ -174,10 +177,12 @@ public class SubmoduleUpdateCommand extends
if (ConfigConstants.CONFIG_KEY_MERGE.equals(update)) {
MergeCommand merge = new MergeCommand(submoduleRepo);
merge.include(commit);
+ merge.setStrategy(strategy);
merge.call();
} else if (ConfigConstants.CONFIG_KEY_REBASE.equals(update)) {
RebaseCommand rebase = new RebaseCommand(submoduleRepo);
rebase.setUpstream(commit);
+ rebase.setStrategy(strategy);
rebase.call();
} else {
// Checkout commit referenced in parent repository's
@@ -204,4 +209,15 @@ public class SubmoduleUpdateCommand extends
throw new InvalidConfigurationException(e.getMessage(), e);
}
}
+
+ /**
+ * @param strategy
+ * The merge strategy to use during this update operation.
+ * @return {@code this}
+ * @since 3.4
+ */
+ public SubmoduleUpdateCommand setStrategy(MergeStrategy strategy) {
+ this.strategy = strategy;
+ return this;
+ }
}