|
|
@ -149,21 +149,20 @@ public class SubmoduleWalk implements AutoCloseable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static SubmoduleWalk forPath(Repository repository, |
|
|
|
public static SubmoduleWalk forPath(Repository repository, |
|
|
|
AnyObjectId treeId, String path) throws IOException { |
|
|
|
AnyObjectId treeId, String path) throws IOException { |
|
|
|
SubmoduleWalk generator = new SubmoduleWalk(repository); |
|
|
|
try (SubmoduleWalk generator = new SubmoduleWalk(repository)) { |
|
|
|
try { |
|
|
|
|
|
|
|
generator.setTree(treeId); |
|
|
|
generator.setTree(treeId); |
|
|
|
PathFilter filter = PathFilter.create(path); |
|
|
|
PathFilter filter = PathFilter.create(path); |
|
|
|
generator.setFilter(filter); |
|
|
|
generator.setFilter(filter); |
|
|
|
generator.setRootTree(treeId); |
|
|
|
generator.setRootTree(treeId); |
|
|
|
while (generator.next()) |
|
|
|
while (generator.next()) { |
|
|
|
if (filter.isDone(generator.walk)) |
|
|
|
if (filter.isDone(generator.walk)) { |
|
|
|
return generator; |
|
|
|
return generator; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
generator.close(); |
|
|
|
|
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
generator.close(); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -182,21 +181,20 @@ public class SubmoduleWalk implements AutoCloseable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static SubmoduleWalk forPath(Repository repository, |
|
|
|
public static SubmoduleWalk forPath(Repository repository, |
|
|
|
AbstractTreeIterator iterator, String path) throws IOException { |
|
|
|
AbstractTreeIterator iterator, String path) throws IOException { |
|
|
|
SubmoduleWalk generator = new SubmoduleWalk(repository); |
|
|
|
try (SubmoduleWalk generator = new SubmoduleWalk(repository)) { |
|
|
|
try { |
|
|
|
|
|
|
|
generator.setTree(iterator); |
|
|
|
generator.setTree(iterator); |
|
|
|
PathFilter filter = PathFilter.create(path); |
|
|
|
PathFilter filter = PathFilter.create(path); |
|
|
|
generator.setFilter(filter); |
|
|
|
generator.setFilter(filter); |
|
|
|
generator.setRootTree(iterator); |
|
|
|
generator.setRootTree(iterator); |
|
|
|
while (generator.next()) |
|
|
|
while (generator.next()) { |
|
|
|
if (filter.isDone(generator.walk)) |
|
|
|
if (filter.isDone(generator.walk)) { |
|
|
|
return generator; |
|
|
|
return generator; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
generator.close(); |
|
|
|
|
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
generator.close(); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|