diff options
author | Kevin Sawicki | 2012-01-02 17:40:53 +0000 |
---|---|---|
committer | Kevin Sawicki | 2012-01-02 17:40:53 +0000 |
commit | dea451157200a216b135551e203242f229aac082 (patch) | |
tree | f445bebb32867c474d62f4f2875535428aec9616 /org.eclipse.jgit/src | |
parent | 287d17f6015916844384397bb554c1d16f2ff135 (diff) | |
download | jgit-dea451157200a216b135551e203242f229aac082.tar.gz jgit-dea451157200a216b135551e203242f229aac082.tar.xz jgit-dea451157200a216b135551e203242f229aac082.zip |
Extend TransportCommand in submodule add/update commands
This allows all the settings of a TransportCommand to be
configured on the clone commands that are run by submodule
add/update
Change-Id: I93bfe5a91d430200de8c7f1e32a60cb990aa58ea
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java | 20 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java | 20 |
2 files changed, 6 insertions, 34 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java index 0b5200481b..ac81ccb457 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java @@ -57,7 +57,6 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.storage.file.FileBasedConfig; import org.eclipse.jgit.submodule.SubmoduleWalk; -import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.treewalk.filter.PathFilter; import org.eclipse.jgit.treewalk.filter.TreeFilter; @@ -72,7 +71,8 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; * href="http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html" * >Git documentation about submodules</a> */ -public class SubmoduleAddCommand extends GitCommand<Repository> { +public class SubmoduleAddCommand extends + TransportCommand<SubmoduleAddCommand, Repository> { private String path; @@ -80,8 +80,6 @@ public class SubmoduleAddCommand extends GitCommand<Repository> { private ProgressMonitor monitor; - private CredentialsProvider credentialsProvider; - /** * @param repo */ @@ -125,17 +123,6 @@ public class SubmoduleAddCommand extends GitCommand<Repository> { } /** - * @param credentialsProvider - * the {@link CredentialsProvider} to use - * @return this command - */ - public SubmoduleAddCommand setCredentialsProvider( - final CredentialsProvider credentialsProvider) { - this.credentialsProvider = credentialsProvider; - return this; - } - - /** * Is the configured already a submodule in the index? * * @return true if submodule exists in index, false otherwise @@ -164,12 +151,11 @@ public class SubmoduleAddCommand extends GitCommand<Repository> { // Clone submodule repository File moduleDirectory = SubmoduleWalk.getSubmoduleDirectory(repo, path); CloneCommand clone = Git.cloneRepository(); + configure(clone); clone.setDirectory(moduleDirectory); clone.setURI(uri); if (monitor != null) clone.setProgressMonitor(monitor); - if (credentialsProvider != null) - clone.setCredentialsProvider(credentialsProvider); Repository subRepo = clone.call().getRepository(); // Save submodule URL to parent repository's config 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 72daa489eb..f94b2099a0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java @@ -60,7 +60,6 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.submodule.SubmoduleWalk; -import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.treewalk.filter.PathFilterGroup; /** @@ -70,12 +69,11 @@ import org.eclipse.jgit.treewalk.filter.PathFilterGroup; * href="http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html" * >Git documentation about submodules</a> */ -public class SubmoduleUpdateCommand extends GitCommand<Collection<String>> { +public class SubmoduleUpdateCommand extends + TransportCommand<SubmoduleUpdateCommand, Collection<String>> { private ProgressMonitor monitor; - private CredentialsProvider credentialsProvider; - private final Collection<String> paths; /** @@ -101,17 +99,6 @@ public class SubmoduleUpdateCommand extends GitCommand<Collection<String>> { } /** - * @param credentialsProvider - * the {@link CredentialsProvider} to use - * @return this command - */ - public SubmoduleUpdateCommand setCredentialsProvider( - final CredentialsProvider credentialsProvider) { - this.credentialsProvider = credentialsProvider; - return this; - } - - /** * Add repository-relative submodule path to initialize * * @param path @@ -143,12 +130,11 @@ public class SubmoduleUpdateCommand extends GitCommand<Collection<String>> { // Clone repository is not present if (submoduleRepo == null) { CloneCommand clone = Git.cloneRepository(); + configure(clone); clone.setURI(url); clone.setDirectory(generator.getDirectory()); if (monitor != null) clone.setProgressMonitor(monitor); - if (credentialsProvider != null) - clone.setCredentialsProvider(credentialsProvider); submoduleRepo = clone.call().getRepository(); } |