summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Frade <ifrade@google.com>2023-09-01 11:25:50 -0700
committerIvan Frade <ifrade@google.com>2023-09-01 11:39:40 -0700
commit13c8dacae55b8719d228b303570c369231f7c1c1 (patch)
treebb2f51ec7c1eeaefef8e54bfb8fec04723f99b9d
parent2be8bf2b37177256e5183f26b7ccd13e104daf5f (diff)
downloadjgit-13c8dacae55b8719d228b303570c369231f7c1c1.tar.gz
jgit-13c8dacae55b8719d228b303570c369231f7c1c1.zip
CommitGraphWriter: throw exception on unknown chunk
CommitGraphWriter first defines the chunks and then writes them. If at write time a chunk is unknown, it is ignored. This is brittle: if somebody adds a chunk to the header but not to the actual writing, the commit-graph is broken and there is no error reported anywhere. Throw exception if at write time a chunk is unknown. This can only happen by a coding error in the writer. Change-Id: Iade677bb6ce368b6941b75a21c622917afa3b751
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
index c5cfe95864..bab262231f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
@@ -222,6 +222,9 @@ public class CommitGraphWriter {
}
chunk.data.get().writeTo(out);
break;
+ default:
+ throw new IllegalStateException(
+ "Don't know how to write chunk " + chunkId); //$NON-NLS-1$
}
}
}