Tabnine Logo
RepoCommand$DefaultRemoteReader
Code IndexAdd Tabnine to your IDE (free)

How to use
RepoCommand$DefaultRemoteReader
in
org.eclipse.jgit.gitrepo

Best Java code snippets using org.eclipse.jgit.gitrepo.RepoCommand$DefaultRemoteReader (Showing top 6 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

  author = new PersonIdent(repo);
if (callback == null)
  callback = new DefaultRemoteReader();
List<RepoProject> renamedProjects = renameProjects(filteredProjects);
origin: org.eclipse.jgit/org.eclipse.jgit

  @Override
  public RemoteFile readFileWithMode(String uri, String ref, String path)
      throws GitAPIException, IOException {
    File dir = FileUtils.createTempDir("jgit_", ".git", null); //$NON-NLS-1$ //$NON-NLS-2$
    try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir)
        .setURI(uri).call()) {
      Repository repo = git.getRepository();
      ObjectId refCommitId = sha1(uri, ref);
      if (refCommitId == null) {
        throw new InvalidRefNameException(MessageFormat
            .format(JGitText.get().refNotResolved, ref));
      }
      RevCommit commit = repo.parseCommit(refCommitId);
      TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree());
      // TODO(ifrade): Cope better with big files (e.g. using
      // InputStream instead of byte[])
      return new RemoteFile(
          tw.getObjectReader().open(tw.getObjectId(0))
              .getCachedBytes(Integer.MAX_VALUE),
          tw.getFileMode(0));
    } finally {
      FileUtils.delete(dir, FileUtils.RECURSIVE);
    }
  }
}
origin: berlam/github-bucket

  author = new PersonIdent(repo);
if (callback == null)
  callback = new DefaultRemoteReader();
List<RepoProject> renamedProjects = renameProjects(filteredProjects);
origin: sonia.jgit/org.eclipse.jgit

    author = new PersonIdent(repo);
  if (callback == null)
    callback = new DefaultRemoteReader();
} else
  git = new Git(repo);
origin: berlam/github-bucket

  @Override
  public RemoteFile readFileWithMode(String uri, String ref, String path)
      throws GitAPIException, IOException {
    File dir = FileUtils.createTempDir("jgit_", ".git", null); //$NON-NLS-1$ //$NON-NLS-2$
    try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir)
        .setURI(uri).call()) {
      Repository repo = git.getRepository();
      ObjectId refCommitId = sha1(uri, ref);
      if (refCommitId == null) {
        throw new InvalidRefNameException(MessageFormat
            .format(JGitText.get().refNotResolved, ref));
      }
      RevCommit commit = repo.parseCommit(refCommitId);
      TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree());
      // TODO(ifrade): Cope better with big files (e.g. using
      // InputStream instead of byte[])
      return new RemoteFile(
          tw.getObjectReader().open(tw.getObjectId(0))
              .getCachedBytes(Integer.MAX_VALUE),
          tw.getFileMode(0));
    } finally {
      FileUtils.delete(dir, FileUtils.RECURSIVE);
    }
  }
}
origin: sonia.jgit/org.eclipse.jgit

public byte[] readFile(String uri, String ref, String path)
    throws GitAPIException, IOException {
  File dir = FileUtils.createTempDir("jgit_", ".git", null); //$NON-NLS-1$ //$NON-NLS-2$
  Repository repo = Git
      .cloneRepository()
      .setBare(true)
      .setDirectory(dir)
      .setURI(uri)
      .call()
      .getRepository();
  try {
    return readFileFromRepo(repo, ref, path);
  } finally {
    repo.close();
    FileUtils.delete(dir, FileUtils.RECURSIVE);
  }
}
org.eclipse.jgit.gitrepoRepoCommand$DefaultRemoteReader

Javadoc

A default implementation of RemoteReader callback.

Most used methods

  • <init>
  • sha1
  • readFileFromRepo
    Read a file from the repository

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JOptionPane (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now