Refactor GitTreeReader
This commit is contained in:
parent
dc932d8b1d
commit
53e1fd394b
1 changed files with 3 additions and 2 deletions
|
@ -55,7 +55,8 @@ class GitTreeReader {
|
||||||
*/
|
*/
|
||||||
Stream<NamedRevBlob> stream(final Ref branchRef) throws IOException {
|
Stream<NamedRevBlob> stream(final Ref branchRef) throws IOException {
|
||||||
final TreeWalk treeWalk = new TreeWalk(repository);
|
final TreeWalk treeWalk = new TreeWalk(repository);
|
||||||
treeWalk.addTree(new RevWalk(repository).parseCommit(branchRef.getObjectId()).getTree());
|
final RevWalk revWalk = new RevWalk(repository);
|
||||||
|
treeWalk.addTree(revWalk.parseCommit(branchRef.getObjectId()).getTree());
|
||||||
treeWalk.setRecursive(false);
|
treeWalk.setRecursive(false);
|
||||||
Optional.ofNullable(treeFilter)
|
Optional.ofNullable(treeFilter)
|
||||||
.ifPresent(treeWalk::setFilter);
|
.ifPresent(treeWalk::setFilter);
|
||||||
|
@ -63,7 +64,7 @@ class GitTreeReader {
|
||||||
while (treeWalk.next()) {
|
while (treeWalk.next()) {
|
||||||
builder.add(new NamedRevBlob(
|
builder.add(new NamedRevBlob(
|
||||||
treeWalk.getNameString(),
|
treeWalk.getNameString(),
|
||||||
new RevWalk(repository).lookupBlob(treeWalk.getObjectId(0)),
|
revWalk.lookupBlob(treeWalk.getObjectId(0)),
|
||||||
repository));
|
repository));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
Loading…
Reference in a new issue