We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9ba7a0 commit d62bdfaCopy full SHA for d62bdfa
1 file changed
src/oid.rs
@@ -387,6 +387,18 @@ impl AsRef<[u8]> for Oid {
387
}
388
389
390
+// Sanity-check libgit2's OID size constants to keep the docs and the
391
+// public API surface honest. If any of these break, the doc comments on
392
+// `Oid::as_bytes` / `Oid::raw_bytes` need to be revisited.
393
+#[cfg(not(feature = "unstable-sha256"))]
394
+const _: () = assert!(raw::GIT_OID_MAX_SIZE == 20);
395
+#[cfg(feature = "unstable-sha256")]
396
+const _: () = {
397
+ assert!(raw::GIT_OID_SHA1_SIZE == 20);
398
+ assert!(raw::GIT_OID_SHA256_SIZE == 32);
399
+ assert!(raw::GIT_OID_MAX_SIZE == 32);
400
+};
401
+
402
#[cfg(test)]
403
mod tests {
404
use std::fs::File;
0 commit comments