本文整理了Java中org.eclipse.jgit.lib.Repository.create
方法的一些代码示例,展示了Repository.create
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.create
方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:create
[英]Create a new Git repository.
Repository with working tree is created using this method. This method is the same as create(false).
[中]创建一个新的Git存储库。
使用此方法创建具有工作树的存储库。此方法与create(false)相同。
代码示例来源:origin: gocd/gocd
public void initialize() throws IOException {
if (!gitRepo.getDirectory().exists()) {
gitRepo.create();
} else {
cleanAndResetToMaster();
}
}
代码示例来源:origin: spring-cloud/spring-cloud-config
public static Repository prepareBareRemote() throws IOException {
// Create a folder in the temp folder that will act as the remote repository
File remoteDir = File.createTempFile("remote", "");
remoteDir.delete();
remoteDir.mkdirs();
// Create a bare repository
FileKey fileKey = FileKey.exact(remoteDir, FS.DETECTED);
Repository remoteRepo = fileKey.open(false);
remoteRepo.create(true);
return remoteRepo;
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void init(boolean bare) throws IOException {
getWrappedObject().getRepository().create(bare);
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Create a new Git repository.
* <p>
* Repository with working tree is created using this method. This method is
* the same as {@code create(false)}.
*
* @throws java.io.IOException
* @see #create(boolean)
*/
public void create() throws IOException {
create(false);
}
代码示例来源:origin: apache/incubator-gobblin
fileKey.open(false).create(true);
代码示例来源:origin: apache/incubator-gobblin
this.remoteRepo.create(true);
代码示例来源:origin: apache/incubator-gobblin
remoteRepo.create(true);
代码示例来源:origin: centic9/jgit-cookbook
public static Repository createNewRepository() throws IOException {
// prepare a new folder
File localPath = File.createTempFile("TestGitRepository", "");
if(!localPath.delete()) {
throw new IOException("Could not delete temporary file " + localPath);
}
// create the directory
Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
repository.create();
return repository;
}
}
代码示例来源:origin: centic9/jgit-cookbook
public static Repository createNewRepository() throws IOException {
// prepare a new folder
File localPath = File.createTempFile("TestGitRepository", "");
if(!localPath.delete()) {
throw new IOException("Could not delete temporary file " + localPath);
}
// create the directory
Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
repository.create();
return repository;
}
}
代码示例来源:origin: apache/incubator-gobblin
@BeforeClass
public void setup() throws Exception {
cleanUpDir(TEST_DIR);
// Create a bare repository
RepositoryCache.FileKey fileKey = RepositoryCache.FileKey.exact(remoteDir, FS.DETECTED);
this.remoteRepo = fileKey.open(false);
this.remoteRepo.create(true);
this.gitForPush = Git.cloneRepository().setURI(this.remoteRepo.getDirectory().getAbsolutePath()).setDirectory(cloneDir).call();
// push an empty commit as a base for detecting changes
this.gitForPush.commit().setMessage("First commit").call();
this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call();
this.config = ConfigBuilder.create()
.addPrimitive(GitConfigMonitor.GIT_CONFIG_MONITOR_PREFIX + "." + ConfigurationKeys.GIT_MONITOR_REPO_URI,
this.remoteRepo.getDirectory().getAbsolutePath())
.addPrimitive(GitConfigMonitor.GIT_CONFIG_MONITOR_PREFIX + "." + ConfigurationKeys.GIT_MONITOR_REPO_DIR, TEST_DIR + "/jobConfig")
.addPrimitive(ConfigurationKeys.FLOWSPEC_STORE_DIR_KEY, TEST_DIR + "flowCatalog")
.addPrimitive(ConfigurationKeys.GIT_MONITOR_POLLING_INTERVAL, 5)
.build();
this.flowCatalog = new FlowCatalog(config);
this.flowCatalog.startAsync().awaitRunning();
this.gitConfigMonitor = new GitConfigMonitor(this.config, this.flowCatalog);
this.gitConfigMonitor.setActive(true);
}
代码示例来源:origin: berlam/github-bucket
/**
* Create a new Git repository.
* <p>
* Repository with working tree is created using this method. This method is
* the same as {@code create(false)}.
*
* @throws java.io.IOException
* @see #create(boolean)
*/
public void create() throws IOException {
create(false);
}
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
/**
* Create a new Git repository.
* <p>
* Repository with working tree is created using this method. This method is
* the same as {@code create(false)}.
*
* @throws IOException
* @see #create(boolean)
*/
public void create() throws IOException {
create(false);
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
repository.create(bare);
return new Git(repository, true);
} catch (IOException e) {
代码示例来源:origin: winstonli/writelatex-git-bridge
@Override
public void initRepo(RepoStore repoStore) throws IOException {
initRepositoryField(repoStore);
Preconditions.checkState(repository.isPresent());
Repository repo = this.repository.get();
// TODO: assert that this is a fresh repo. At the moment, we can't be
// sure whether the repo to be init'd doesn't exist or is just fresh
// and we crashed / aborted while committing
if (repo.getObjectDatabase().exists()) return;
repo.create();
}
代码示例来源:origin: com.beijunyi.parallelgit/parallelgit-utils
@Nonnull
public static Repository createRepository(@Nonnull File dir, boolean bare) throws IOException {
Repository repo = new RepositoryBuilder()
.readEnvironment()
.setGitDir(bare ? dir : new File(dir, Constants.DOT_GIT))
.build();
repo.create(bare);
return repo;
}
代码示例来源:origin: robinst/git-merge-repos
public RepoMerger(String outputRepositoryPath,
List<SubtreeConfig> subtreeConfigs) throws IOException {
this.subtreeConfigs = subtreeConfigs;
File file = new File(outputRepositoryPath);
repository = new RepositoryBuilder().setWorkTree(file).build();
if (!repository.getDirectory().exists()) {
repository.create();
}
}
代码示例来源:origin: com.beijunyi/parallelgit-utils
@Nonnull
public static Repository createRepository(File dir, boolean bare) throws IOException {
Repository repo = new RepositoryBuilder()
.readEnvironment()
.setGitDir(bare ? dir : new File(dir, DOT_GIT))
.build();
repo.create(bare);
return repo;
}
代码示例来源:origin: beijunyi/ParallelGit
@Nonnull
public static Repository createRepository(File dir, boolean bare) throws IOException {
Repository repo = new RepositoryBuilder()
.readEnvironment()
.setGitDir(bare ? dir : new File(dir, DOT_GIT))
.build();
repo.create(bare);
return repo;
}
代码示例来源:origin: bozaro/git-as-svn
public static Repository emptyRepository() throws IOException {
final Repository repository = new InMemoryRepository(new DfsRepositoryDescription(null));
repository.create();
return repository;
}
}
代码示例来源:origin: org.jboss.forge.addon/git-impl
@Override
public Git init(final DirectoryResource dir) throws IOException
{
FileResource<?> gitDir = dir.getChildDirectory(GIT_DIRECTORY).reify(FileResource.class);
gitDir.mkdirs();
RepositoryBuilder db = new RepositoryBuilder().setGitDir(gitDir.getUnderlyingResourceObject()).setup();
Git git = new Git(db.build());
git.getRepository().create();
return git;
}
内容来源于网络,如有侵权,请联系作者删除!