Skip to content

Commit 70d835b

Browse files
committed
fix: add serde support for varous reference name types.
1 parent 8a27454 commit 70d835b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gix-ref/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ pub(crate) struct Store {
121121
inner: store::State,
122122
}
123123

124-
/// A validated complete and fully qualified referenced reference name, safe to use for all operations.
124+
/// A validated complete and fully qualified reference name, safe to use for all operations.
125125
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
126126
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
127127
pub struct FullName(pub(crate) BString);
128128

129-
/// A validated complete and fully qualified referenced reference name, safe to use for all operations.
129+
/// A validated complete and fully qualified reference name, safe to use for all operations.
130130
#[derive(Hash, Debug, PartialEq, Eq, Ord, PartialOrd)]
131131
#[repr(transparent)]
132132
pub struct FullNameRef(BStr);
@@ -138,10 +138,12 @@ pub struct PartialNameRef(BStr);
138138

139139
/// A validated and potentially partial reference name, safe to use for common operations.
140140
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
141+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
141142
pub struct PartialName(BString);
142143

143144
/// A _validated_ prefix for references to act as a namespace.
144145
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
146+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
145147
pub struct Namespace(BString);
146148

147149
/// Denotes the kind of reference.
@@ -160,6 +162,7 @@ pub enum Kind {
160162
///
161163
/// This translates into a prefix containing all references of a given category.
162164
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
165+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
163166
pub enum Category<'a> {
164167
/// A tag in `refs/tags`
165168
Tag,
@@ -179,6 +182,7 @@ pub enum Category<'a> {
179182
/// A `PseudoRef` in another _linked_ worktree, never in the main one, like `worktrees/<id>/HEAD`.
180183
LinkedPseudoRef {
181184
/// The name of the worktree.
185+
#[cfg_attr(feature = "serde", serde(borrow))]
182186
name: &'a BStr,
183187
},
184188
/// Any reference that is prefixed with `worktrees/<id>/refs/`.

0 commit comments

Comments
 (0)