Browse Source

Merge "Refactor DefaultRemoteReader for easier code reuse"

stable-3.5
Dave Borowitz 11 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
e23768f779
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

10
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

@ -182,6 +182,15 @@ public class RepoCommand extends GitCommand<RevCommit> {
.setURI(uri)
.call()
.getRepository();
try {
return readFileFromRepo(repo, ref, path);
} finally {
FileUtils.delete(dir, FileUtils.RECURSIVE);
}
}
protected byte[] readFileFromRepo(Repository repo,
String ref, String path) throws GitAPIException, IOException {
ObjectReader reader = repo.newObjectReader();
byte[] result;
try {
@ -189,7 +198,6 @@ public class RepoCommand extends GitCommand<RevCommit> {
result = reader.open(oid).getBytes(Integer.MAX_VALUE);
} finally {
reader.release();
FileUtils.delete(dir, FileUtils.RECURSIVE);
}
return result;
}

Loading…
Cancel
Save