|
|
|
|
|
|
|
|
import org.eclipse.jgit.dircache.DirCacheCheckout; |
|
|
import org.eclipse.jgit.dircache.DirCacheCheckout; |
|
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException; |
|
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException; |
|
|
import org.eclipse.jgit.errors.MissingObjectException; |
|
|
import org.eclipse.jgit.errors.MissingObjectException; |
|
|
|
|
|
import org.eclipse.jgit.lib.ConfigConstants; |
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
import org.eclipse.jgit.lib.NullProgressMonitor; |
|
|
import org.eclipse.jgit.lib.NullProgressMonitor; |
|
|
import org.eclipse.jgit.lib.ProgressMonitor; |
|
|
import org.eclipse.jgit.lib.ProgressMonitor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Clone a repository into a new working directory |
|
|
* Clone a repository into a new working directory |
|
|
* |
|
|
|
|
|
|
|
|
* |
|
|
* @see <a href="http://www.kernel.org/pub/software/scm/git/docs/git-clone.html" |
|
|
* @see <a href="http://www.kernel.org/pub/software/scm/git/docs/git-clone.html" |
|
|
* >Git documentation about Clone</a> |
|
|
* >Git documentation about Clone</a> |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.addFetchRefSpec(refSpec); |
|
|
config.addFetchRefSpec(refSpec); |
|
|
config.update(repo.getConfig()); |
|
|
config.update(repo.getConfig()); |
|
|
|
|
|
|
|
|
|
|
|
repo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, |
|
|
|
|
|
branch, ConfigConstants.CONFIG_REMOTE_SECTION, remote); |
|
|
|
|
|
repo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, |
|
|
|
|
|
branch, ConfigConstants.CONFIG_KEY_MERGE, branch); //$NON-NLS-1$ //$NON-NLS-2$ |
|
|
|
|
|
|
|
|
repo.getConfig().save(); |
|
|
repo.getConfig().save(); |
|
|
|
|
|
|
|
|
// run the fetch command |
|
|
// run the fetch command |