diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/gix-revision/src/spec | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-revision/src/spec')
-rw-r--r-- | vendor/gix-revision/src/spec/mod.rs | 51 | ||||
-rw-r--r-- | vendor/gix-revision/src/spec/parse/function.rs | 4 |
2 files changed, 53 insertions, 2 deletions
diff --git a/vendor/gix-revision/src/spec/mod.rs b/vendor/gix-revision/src/spec/mod.rs index c2df7bc1e..616ad3a26 100644 --- a/vendor/gix-revision/src/spec/mod.rs +++ b/vendor/gix-revision/src/spec/mod.rs @@ -53,6 +53,57 @@ mod _impls { } } +pub(crate) mod types { + /// A revision specification without any bindings to a repository, useful for serialization or movement over thread boundaries. + /// + /// 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 = "serde", derive(serde::Serialize, serde::Deserialize))] + pub enum Spec { + /// Include commits reachable from this revision, i.e. `a` and its ancestors. + /// + /// The equivalent to [crate::spec::Kind::IncludeReachable], but with data. + Include(gix_hash::ObjectId), + /// Exclude commits reachable from this revision, i.e. `a` and its ancestors. Example: `^a`. + /// + /// The equivalent to [crate::spec::Kind::ExcludeReachable], but with data. + Exclude(gix_hash::ObjectId), + /// Every commit that is reachable from `from` to `to`, but not any ancestors of `from`. Example: `from..to`. + /// + /// The equivalent to [crate::spec::Kind::RangeBetween], but with data. + Range { + /// The starting point of the range, which is included in the set. + from: gix_hash::ObjectId, + /// The end point of the range, which is included in the set. + to: gix_hash::ObjectId, + }, + /// Every commit reachable through either `theirs` or `ours`, but no commit that is reachable by both. Example: `theirs...ours`. + /// + /// The equivalent to [crate::spec::Kind::ReachableToMergeBase], but with data. + Merge { + /// Their side of the merge, which is included in the set. + theirs: gix_hash::ObjectId, + /// Our side of the merge, which is included in the set. + ours: gix_hash::ObjectId, + }, + /// Include every commit of all parents of `a`, but not `a` itself. Example: `a^@`. + /// + /// The equivalent to [crate::spec::Kind::IncludeReachableFromParents], but with data. + IncludeOnlyParents( + /// Include only the parents of this object, but not the object itself. + gix_hash::ObjectId, + ), + /// Exclude every commit of all parents of `a`, but not `a` itself. Example: `a^!`. + /// + /// The equivalent to [crate::spec::Kind::ExcludeReachableFromParents], but with data. + ExcludeParents( + /// Exclude the parents of this object, but not the object itself. + gix_hash::ObjectId, + ), + } +} + /// pub mod parse; pub use parse::function::parse; diff --git a/vendor/gix-revision/src/spec/parse/function.rs b/vendor/gix-revision/src/spec/parse/function.rs index 94fb4ee5d..8a89f8f68 100644 --- a/vendor/gix-revision/src/spec/parse/function.rs +++ b/vendor/gix-revision/src/spec/parse/function.rs @@ -213,7 +213,7 @@ fn long_describe_prefix(name: &BStr) -> Option<(&BStr, delegate::PrefixHint<'_>) .and_then(|generation| { iter.next().map(|token| { let last_token_len = token.len(); - let first_token_ptr = iter.last().map(|token| token.as_ptr()).unwrap_or(token.as_ptr()); + let first_token_ptr = iter.last().map_or(token.as_ptr(), |token| token.as_ptr()); // SAFETY: both pointers are definitely part of the same object #[allow(unsafe_code)] let prior_tokens_len: usize = unsafe { token.as_ptr().offset_from(first_token_ptr) } @@ -413,7 +413,7 @@ where input = { if let Some(b'@') = sep { - let past_sep = input[sep_pos.map(|pos| pos + 1).unwrap_or(input.len())..].as_bstr(); + let past_sep = input[sep_pos.map_or(input.len(), |pos| pos + 1)..].as_bstr(); let (nav, rest, _consumed) = parens(past_sep)?.ok_or_else(|| Error::AtNeedsCurlyBrackets { input: input[sep_pos.unwrap_or(input.len())..].into(), })?; |