diff options
Diffstat (limited to 'vendor/gix-revision/src')
-rw-r--r-- | vendor/gix-revision/src/spec/mod.rs | 11 | ||||
-rw-r--r-- | vendor/gix-revision/src/spec/parse/function.rs | 15 | ||||
-rw-r--r-- | vendor/gix-revision/src/types.rs | 2 |
3 files changed, 17 insertions, 11 deletions
diff --git a/vendor/gix-revision/src/spec/mod.rs b/vendor/gix-revision/src/spec/mod.rs index ba24c75c0..c2df7bc1e 100644 --- a/vendor/gix-revision/src/spec/mod.rs +++ b/vendor/gix-revision/src/spec/mod.rs @@ -1,11 +1,12 @@ use crate::Spec; /// How to interpret a revision specification, or `revspec`. -#[derive(Debug, Copy, Clone, PartialOrd, PartialEq, Ord, Eq, Hash)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[derive(Default, Debug, Copy, Clone, PartialOrd, PartialEq, Ord, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Kind { /// Include commits reachable from this revision, the default when parsing revision `a` for example, i.e. `a` and its ancestors. /// Example: `a`. + #[default] IncludeReachable, /// Exclude commits reachable from this revision, i.e. `a` and its ancestors. Example: `^a`. ExcludeReachable, @@ -19,12 +20,6 @@ pub enum Kind { ExcludeReachableFromParents, } -impl Default for Kind { - fn default() -> Self { - Kind::IncludeReachable - } -} - impl Spec { /// Return the kind of this specification. pub fn kind(&self) -> Kind { diff --git a/vendor/gix-revision/src/spec/parse/function.rs b/vendor/gix-revision/src/spec/parse/function.rs index 4b12344c7..94fb4ee5d 100644 --- a/vendor/gix-revision/src/spec/parse/function.rs +++ b/vendor/gix-revision/src/spec/parse/function.rs @@ -344,8 +344,19 @@ where { let mut cursor = input; let mut ofs = 0; - while let Some((pos, b)) = cursor.iter().enumerate().find(|(_, b)| { - if b"@~^:.".contains(b) { + const SEPARATORS: &[u8] = b"~^:."; + while let Some((pos, b)) = cursor.iter().enumerate().find(|(pos, b)| { + if **b == b'@' { + if cursor.len() == 1 { + return true; + } + let next = cursor.get(pos + 1); + let next_next = cursor.get(pos + 2); + if *pos != 0 && (next, next_next) == (Some(&b'.'), Some(&b'.')) { + return false; + } + next == Some(&b'{') || next.map_or(false, |b| SEPARATORS.contains(b)) + } else if SEPARATORS.contains(b) { true } else { if let Some(num) = consecutive_hex_chars.as_mut() { diff --git a/vendor/gix-revision/src/types.rs b/vendor/gix-revision/src/types.rs index 43b0caf97..374d43e20 100644 --- a/vendor/gix-revision/src/types.rs +++ b/vendor/gix-revision/src/types.rs @@ -3,7 +3,7 @@ /// Note that all [object ids][gix_hash::ObjectId] should be a committish, but don't have to be. /// Unless the field name contains `_exclusive`, the respective objects are included in the set. #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Spec { /// Include commits reachable from this revision, i.e. `a` and its ancestors. /// |