@Override public T call() throws Exception { return doReadFile(git, getRootGitDirectory(), branch, pathOrEmpty, callback); } });
@Override public T call() throws Exception { return doWriteFile(git, getRootGitDirectory(), branch, pathOrEmpty, callback); } });
@Override public FileInfo call() throws Exception { File rootDir = getRootGitDirectory(); return doExists(git, rootDir, branch, pathOrEmpty, false); } });
@Override public String call() throws Exception { File rootDir = getRootGitDirectory(); return doReadJsonChildContent(git, rootDir, branch, path, fileNameWildcard, search); } });
public RevCommit call() throws Exception { File rootDir = getRootGitDirectory(); return doRename(git, rootDir, branch, oldPath, newPath, commitMessage, personIdent); } });
public RevCommit call() throws Exception { Git aGit = git; File rootDir = getRootGitDirectory(); return doRemove(aGit, rootDir, branch, path, commitMessage, personIdent); } });
@Override public FileContents call() throws Exception { return doRead(git, getRootGitDirectory(), branch, pathOrEmpty); } });
@Override public List<String> call() throws Exception { File rootDir = getRootGitDirectory(); return doCompletePath(git, rootDir, branch, completionText, directoriesOnly); } });
@Override public Void call() throws Exception { Git aGit = git; File rootDir = getRootGitDirectory(); return doRevert(aGit, rootDir, branch, objectId, blobPath, commitMessage, personIdent); } });
public CommitInfo call() throws Exception { checkoutBranch(git, branch); File rootDir = getRootGitDirectory(); return doCreateDirectory(git, rootDir, branch, path, personIdent, commitMessage); } });
public CommitInfo call() throws Exception { checkoutBranch(git, branch); File rootDir = getRootGitDirectory(); return doWrite(git, rootDir, branch, path, data, personIdent, commitMessage); } });
@Override public void init(final ServletConfig config) throws ServletException { gitFacade = GitFacade.getSingleton(); validateGitFacade(); String basePath = gitFacade.getRootGitDirectory().getAbsoluteFile().getParentFile().getAbsolutePath(); System.out.println("Exposing git base path at: " + basePath); final Hashtable<String,String> initParams = new Hashtable<>(); initParams.put("base-path", basePath); initParams.put("repository-root", basePath); initParams.put("export-all", "true"); ServletConfig gitConfig = new ServletConfig() { @Override public String getServletName() { return config.getServletName(); } @Override public ServletContext getServletContext() { return config.getServletContext(); } @Override public String getInitParameter(String paramName) { return initParams.get(paramName); } @Override public Enumeration<String> getInitParameterNames() { return initParams.keys(); } }; super.init(gitConfig); }
protected void doPull() { CredentialsProvider cp = getCredentials(); try { Repository repository = git.getRepository(); StoredConfig config = repository.getConfig(); String url = config.getString("remote", "origin", "url"); if (Strings.isBlank(url)) { logPull("No remote repository defined for the git repository at " + getRootGitDirectory().getCanonicalPath() + " so not doing a pull"); return; } String branch = repository.getBranch(); String mergeUrl = config.getString("branch", branch, "merge"); if (Strings.isBlank(mergeUrl)) { logPull("No merge spec for branch." + branch + ".merge in the git repository at " + getRootGitDirectory().getCanonicalPath() + " so not doing a pull"); return; } logPull("Performing a pull in git repository " + getRootGitDirectory().getCanonicalPath() + " on remote URL: " + url); git.pull().setCredentialsProvider(cp).setRebase(true).call(); } catch (Throwable e) { String credText = ""; if (cp instanceof UsernamePasswordCredentialsProvider) { } LOG.error("Failed to pull from the remote git repo with credentials " + cp + " due: " + e.getMessage() + ". This exception is ignored.", e); } finally { firstPull = false; } }
public void initialiseGitRepo() throws IOException, GitAPIException { File confDir = getRootGitDirectory(); FileRepositoryBuilder builder = new FileRepositoryBuilder(); File gitDir = new File(confDir, ".git");