@Override public Path relativePathFromScmRoot(Path path) { RepositoryBuilder builder = getVerifiedRepositoryBuilder(path); return builder.getGitDir().toPath().getParent().relativize(path); }
@Override public boolean supports(File baseDir) { RepositoryBuilder builder = new RepositoryBuilder().findGitDir(baseDir); return builder.getGitDir() != null; }
static RepositoryBuilder getVerifiedRepositoryBuilder(Path basedir) { RepositoryBuilder builder = new RepositoryBuilder() .findGitDir(basedir.toFile()) .setMustExist(true); if (builder.getGitDir() == null) { throw MessageException.of("Not inside a Git work tree: " + basedir); } return builder; } }
.findGitDir(dir); File gitDir = rb.getGitDir(); if (gitDir != null)
.findGitDir(dir); File gitDir = rb.getGitDir(); if (gitDir != null)
/** * Gets an existing git flow project and returns a JGitFlow instance * * @param projectDir * @return * @throws com.atlassian.jgitflow.core.exception.JGitFlowIOException */ public static JGitFlow get(File projectDir) throws JGitFlowIOException { try { RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(projectDir); File gitDir = rb.getGitDir(); Git gitRepo = Git.open(gitDir); GitFlowConfiguration gfConfig = new GitFlowConfiguration(gitRepo); return new JGitFlow(gitRepo, gfConfig); } catch (IOException e) { throw new JGitFlowIOException(e); } }
.findGitDir(dir); File gitDir = rb.getGitDir(); if (gitDir != null)
/** * Gets an existing git flow project and returns a JGitFlow instance * * @param projectDir * @return * @throws com.atlassian.jgitflow.core.exception.JGitFlowIOException */ public static JGitFlow get(File projectDir) throws JGitFlowIOException { try { RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(projectDir); File gitDir = rb.getGitDir(); Git gitRepo = Git.open(gitDir); GitFlowConfiguration gfConfig = new GitFlowConfiguration(gitRepo); return new JGitFlow(gitRepo, gfConfig); } catch (IOException e) { throw new JGitFlowIOException(e); } }
/** * Gets an existing git flow project and returns a JGitFlow instance * @param projectDir * @return * @throws JGitFlowIOException */ public static JGitFlow get(File projectDir) throws JGitFlowIOException { try { RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(projectDir); File gitDir = rb.getGitDir(); Git gitRepo = Git.open(gitDir); GitFlowConfiguration gfConfig = new GitFlowConfiguration(gitRepo); return new JGitFlow(gitRepo, gfConfig, new JGitFlowReporter()); } catch (IOException e) { throw new JGitFlowIOException(e); } }
private Git getOrInitGit(File folder) throws IOException, GitAPIException { reporter.debugMethod(SHORT_NAME, "getOrInitGit"); Git gitRepo; try { reporter.debugText(SHORT_NAME, "looking for git folder in " + folder.getAbsolutePath()); RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(folder); File gitDir = rb.getGitDir(); if (null != gitDir) { reporter.debugText(SHORT_NAME, "found existing git folder"); gitRepo = Git.open(gitDir); } else { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } } catch (RepositoryNotFoundException e) { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } reporter.endMethod(); return gitRepo; }
private Git getOrInitGit(File folder) throws IOException, GitAPIException { reporter.debugMethod(SHORT_NAME, "getOrInitGit"); Git gitRepo; try { reporter.debugText(SHORT_NAME, "looking for git folder in " + folder.getAbsolutePath()); RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(folder); File gitDir = rb.getGitDir(); if (null != gitDir) { reporter.debugText(SHORT_NAME, "found existing git folder"); gitRepo = Git.open(gitDir); } else { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } } catch (RepositoryNotFoundException e) { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } reporter.endMethod(); return gitRepo; }
private Git getOrInitGit(File folder) throws IOException, GitAPIException { reporter.debugMethod(SHORT_NAME, "getOrInitGit"); Git gitRepo; try { reporter.debugText(SHORT_NAME, "looking for git folder in " + folder.getAbsolutePath()); RepositoryBuilder rb = new RepositoryBuilder() .readEnvironment() .findGitDir(folder); File gitDir = rb.getGitDir(); if (null != gitDir) { reporter.debugText(SHORT_NAME, "found existing git folder"); gitRepo = Git.open(gitDir); } else { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } } catch (RepositoryNotFoundException e) { reporter.debugText(SHORT_NAME, "no git folder found, initializing"); gitRepo = Git.init().setDirectory(folder).call(); } reporter.endMethod(); return gitRepo; }