From 2957fa5cc8a268c9870fe962dff71b3e53732d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Tue, 9 Dec 2025 21:19:26 +0100 Subject: [PATCH 1/2] fix!: mark `Kind` as non-exhaustive This is a follow-up to #2218 (which is a rewritten version of #2213). It marks `gix_hash::Kind` as `non_exhaustive`. This is a breaking change now, but will prevent further breaking changes whenever we add a new hashing algorithm in the future. --- gix-hash/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/gix-hash/src/lib.rs b/gix-hash/src/lib.rs index a758fb10a5f..02e7bc2420c 100644 --- a/gix-hash/src/lib.rs +++ b/gix-hash/src/lib.rs @@ -52,6 +52,7 @@ const SIZE_OF_SHA1_DIGEST: usize = 20; /// Denotes the kind of function to produce a [`ObjectId`]. #[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[non_exhaustive] pub enum Kind { /// The Sha1 hash with 160 bits. #[default] From 9582b17ccfbc589df2824019c778a3345499e74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Tue, 9 Dec 2025 21:26:04 +0100 Subject: [PATCH 2/2] Adapt to change in `gix-hash` --- gix-worktree-stream/src/protocol.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/gix-worktree-stream/src/protocol.rs b/gix-worktree-stream/src/protocol.rs index 49074f22df0..7e8e1f8b44c 100644 --- a/gix-worktree-stream/src/protocol.rs +++ b/gix-worktree-stream/src/protocol.rs @@ -111,6 +111,7 @@ fn byte_to_mode(b: u8) -> gix_object::tree::EntryMode { fn hash_to_byte(h: gix_hash::Kind) -> u8 { match h { gix_hash::Kind::Sha1 => 0, + _ => unreachable!("BUG: not implemented for hash kind {h}"), } }