ObjectReader#getCommitGraph doesn't report errors loading the
commit graph. The caller should be aware of the situation and
ultimately decide what to do.
Add IOException to ObjectReader#getCommitGraph signature. RevWalk
defaults to an empty commit-graph on IO errors.
Signed-off-by: Xing Huang <xingkhuang@google.com>
Change-Id: I38eeacff76c7f926b6dfb192d1e5916e40770024
* (default is
* {@value org.eclipse.jgit.lib.CoreConfig#DEFAULT_COMMIT_GRAPH_ENABLE}).
*
+ * @throws IOException
+ * if it cannot open any of the underlying commit graph.
+ *
* @since 6.5
*/
- public Optional<CommitGraph> getCommitGraph() {
+ public Optional<CommitGraph> getCommitGraph() throws IOException {
return Optional.empty();
}
}
@Override
- public Optional<CommitGraph> getCommitGraph() {
+ public Optional<CommitGraph> getCommitGraph() throws IOException{
return delegate().getCommitGraph();
}
@NonNull
CommitGraph commitGraph() {
if (commitGraph == null) {
- commitGraph = reader != null ? reader.getCommitGraph().orElse(EMPTY)
- : EMPTY;
+ try {
+ commitGraph = reader != null
+ ? reader.getCommitGraph().orElse(EMPTY)
+ : EMPTY;
+ } catch (IOException e) {
+ commitGraph = EMPTY;
+ }
}
return commitGraph;
}