本文整理了Java中org.eclipse.jgit.api.Git.submoduleInit()
方法的一些代码示例,展示了Git.submoduleInit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Git.submoduleInit()
方法的具体详情如下:
包路径:org.eclipse.jgit.api.Git
类名称:Git
方法名:submoduleInit
[英]Return a command object to execute a submodule init command
[中]返回命令对象以执行子模块init命令
代码示例来源:origin: jenkinsci/git-client-plugin
/**
* submoduleInit.
*
* @throws hudson.plugins.git.GitException if underlying git operation fails.
* @throws java.lang.InterruptedException if interrupted.
*/
@Deprecated
@Override
public void submoduleInit() throws GitException, InterruptedException {
try (Repository repo = getRepository()) {
git(repo).submoduleInit().call();
} catch (GitAPIException e) {
throw new GitException(e);
}
}
代码示例来源:origin: omegat-org/omegat
git.submoduleInit().call();
git.submoduleUpdate().call();
git.submoduleInit().call();
git.submoduleUpdate().call();
代码示例来源:origin: line/centraldogma
@Test
public void remoteToLocal_submodule() throws Exception {
pushMirrorSettings(null, null);
// Create a new repository for a submodule.
final File gitSubmoduleWorkTree =
new File(gitRepoDir.getRoot(), testName.getMethodName() + ".submodule").getAbsoluteFile();
final Repository gitSubmoduleRepo =
new FileRepositoryBuilder().setWorkTree(gitSubmoduleWorkTree).build();
gitSubmoduleRepo.create();
final Git gitSubmodule = Git.wrap(gitSubmoduleRepo);
final String gitSubmoduleUri = "file://" +
(gitSubmoduleWorkTree.getPath().startsWith(File.separator) ? "" : "/") +
gitSubmoduleWorkTree.getPath().replace(File.separatorChar, '/') +
"/.git";
// Prepare the master branch of the submodule repository.
addToGitIndex(gitSubmodule, gitSubmoduleWorkTree,
"in_submodule.txt", "This is a file in a submodule.");
gitSubmodule.commit().setMessage("Initial commit").call();
// Add the submodule.
git.submoduleInit().call();
git.submoduleAdd().setPath("submodule").setURI(gitSubmoduleUri).call();
git.commit().setMessage("Add a new submodule").call();
// Check the files under a submodule do not match nor trigger an 'unknown object' error.
mirroringService.mirror().join();
final Revision headRev = client.normalizeRevision(projName, REPO_FOO, Revision.HEAD).join();
final Entry<JsonNode> expectedMirrorState = expectedMirrorState(headRev, "/");
assertThat(client.getFiles(projName, REPO_FOO, Revision.HEAD, "/**").join().values())
.containsExactly(expectedMirrorState);
}
内容来源于网络,如有侵权,请联系作者删除!