public boolean hasGitRepo() throws GitException { return hasGitRepo(".git"); }
public boolean hasGitRepo() throws GitException { return hasGitRepo(Constants.DOT_GIT); }
private void verifyGitRepository() { if (!hasGitRepo() || null == jGitDelegate) { throw new GitException(Messages.GitAPI_Repository_InvalidStateMsg()); } }
public void init() throws GitException { if (hasGitRepo()) { throw new GitException(".git directory already exists! Has it already been initialised?"); } try { final Repository repo = new Repository(new File(workspace.child(".git").getRemote())); repo.create(); } catch (IOException ioe) { throw new GitException("Error initiating git repo.", ioe); } }
public GitAPI(String gitExe, FilePath workspace, TaskListener listener, EnvVars environment) { this.workspace = workspace; this.listener = listener; this.gitExe = gitExe; this.environment = environment; launcher = new LocalLauncher(GitSCM.VERBOSE ? listener : TaskListener.NULL); if (hasGitRepo()) {//Wrap file repository if exists in order to perform operations and initialize jGitDelegate try { File gitDir = RepositoryCache.FileKey.resolve(new File(workspace.getRemote()), FS.DETECTED); setDelegate(Git.wrap(new FileRepositoryBuilder().setGitDir(gitDir).build())); } catch (IOException e) { e.printStackTrace(listener.getLogger()); } } }
if (hasGitRepo(subGitDir) && !"".equals(getRemoteUrl("origin", subGitDir))) { setRemoteUrl("origin", sUrl, subGitDir);
if (hasGitRepo(subGitDir) && !"".equals(getRemoteUrl("origin", subGitDir))) { setRemoteUrl("origin", sUrl, subGitDir);
public void init() throws GitException { if (hasGitRepo()) { throw new GitException(Messages.GitAPI_Repository_FailedInitTwiceMsg()); } try { setDelegate(Git.init().setDirectory(new File(workspace.getRemote())).call()); } catch (GitAPIException ex) { throw new GitException(ex); } }