@ -57,7 +57,6 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig ;
import org.eclipse.jgit.lib.StoredConfig ;
import org.eclipse.jgit.storage.file.FileBasedConfig ;
import org.eclipse.jgit.storage.file.FileBasedConfig ;
import org.eclipse.jgit.submodule.SubmoduleWalk ;
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.PathFilter ;
import org.eclipse.jgit.treewalk.filter.TreeFilter ;
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"
* href = "http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html"
* > Git documentation about submodules < / a >
* > Git documentation about submodules < / a >
* /
* /
public class SubmoduleAddCommand extends GitCommand < Repository > {
public class SubmoduleAddCommand extends
TransportCommand < SubmoduleAddCommand , Repository > {
private String path ;
private String path ;
@ -80,8 +80,6 @@ public class SubmoduleAddCommand extends GitCommand<Repository> {
private ProgressMonitor monitor ;
private ProgressMonitor monitor ;
private CredentialsProvider credentialsProvider ;
/ * *
/ * *
* @param repo
* @param repo
* /
* /
@ -124,17 +122,6 @@ public class SubmoduleAddCommand extends GitCommand<Repository> {
return this ;
return this ;
}
}
/ * *
* @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 ?
* Is the configured already a submodule in the index ?
*
*
@ -164,12 +151,11 @@ public class SubmoduleAddCommand extends GitCommand<Repository> {
// Clone submodule repository
// Clone submodule repository
File moduleDirectory = SubmoduleWalk . getSubmoduleDirectory ( repo , path ) ;
File moduleDirectory = SubmoduleWalk . getSubmoduleDirectory ( repo , path ) ;
CloneCommand clone = Git . cloneRepository ( ) ;
CloneCommand clone = Git . cloneRepository ( ) ;
configure ( clone ) ;
clone . setDirectory ( moduleDirectory ) ;
clone . setDirectory ( moduleDirectory ) ;
clone . setURI ( uri ) ;
clone . setURI ( uri ) ;
if ( monitor ! = null )
if ( monitor ! = null )
clone . setProgressMonitor ( monitor ) ;
clone . setProgressMonitor ( monitor ) ;
if ( credentialsProvider ! = null )
clone . setCredentialsProvider ( credentialsProvider ) ;
Repository subRepo = clone . call ( ) . getRepository ( ) ;
Repository subRepo = clone . call ( ) . getRepository ( ) ;
// Save submodule URL to parent repository's config
// Save submodule URL to parent repository's config