summaryrefslogtreecommitdiffstats
path: root/vendor/gix-index/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/gix-index/src
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-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-index/src')
-rw-r--r--vendor/gix-index/src/access/mod.rs13
-rw-r--r--vendor/gix-index/src/decode/mod.rs9
-rw-r--r--vendor/gix-index/src/entry/stat.rs2
-rw-r--r--vendor/gix-index/src/extension/end_of_index_entry/decode.rs5
-rw-r--r--vendor/gix-index/src/extension/resolve_undo.rs2
-rw-r--r--vendor/gix-index/src/extension/tree/verify.rs2
-rw-r--r--vendor/gix-index/src/extension/untracked_cache.rs2
-rw-r--r--vendor/gix-index/src/verify.rs4
8 files changed, 22 insertions, 17 deletions
diff --git a/vendor/gix-index/src/access/mod.rs b/vendor/gix-index/src/access/mod.rs
index fa0215d9f..d07a55bf0 100644
--- a/vendor/gix-index/src/access/mod.rs
+++ b/vendor/gix-index/src/access/mod.rs
@@ -103,14 +103,14 @@ impl State {
/// Return the entry at `idx` or _panic_ if the index is out of bounds.
///
- /// The `idx` is typically returned by [entry_by_path_and_stage()][State::entry_by_path_and_stage()].
+ /// The `idx` is typically returned by [`entry_by_path_and_stage()`][State::entry_by_path_and_stage()].
pub fn entry(&self, idx: usize) -> &Entry {
&self.entries[idx]
}
/// Returns a boolean value indicating whether the index is sparse or not.
///
- /// An index is sparse if it contains at least one [Mode::DIR][entry::Mode::DIR] entry.
+ /// An index is sparse if it contains at least one [`Mode::DIR`][entry::Mode::DIR] entry.
pub fn is_sparse(&self) -> bool {
self.is_sparse
}
@@ -147,6 +147,13 @@ impl State {
})
}
+ /// Return all parts that relate to entries, which includes path storage.
+ ///
+ /// This can be useful for obtaining a standalone, boxable iterator
+ pub fn into_entries(self) -> (Vec<Entry>, PathStorage) {
+ (self.entries, self.path_backing)
+ }
+
/// Sometimes it's needed to remove the path backing to allow certain mutation to happen in the state while supporting reading the entry's
/// path.
pub fn take_path_backing(&mut self) -> PathStorage {
@@ -173,7 +180,7 @@ impl State {
/// [`entry_index_by_path_and_stage_bounded()`][State::entry_index_by_path_and_stage_bounded()] is used with
/// the `upper_bound` being the amount of entries before the first call to this method.
///
- /// Alternatively, make sure to call [sort_entries()][State::sort_entries()] before entry lookup by path to restore
+ /// Alternatively, make sure to call [`sort_entries()`][State::sort_entries()] before entry lookup by path to restore
/// the invariant.
pub fn dangerously_push_entry(
&mut self,
diff --git a/vendor/gix-index/src/decode/mod.rs b/vendor/gix-index/src/decode/mod.rs
index c94b03495..f51a5d5e9 100644
--- a/vendor/gix-index/src/decode/mod.rs
+++ b/vendor/gix-index/src/decode/mod.rs
@@ -10,7 +10,7 @@ mod error {
use crate::{decode, extension};
- /// The error returned by [State::from_bytes()][crate::State::from_bytes()].
+ /// The error returned by [`State::from_bytes()`][crate::State::from_bytes()].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
@@ -183,9 +183,10 @@ impl State {
version,
),
};
- let ext_res = extension_loading
- .map(|thread| thread.join().unwrap())
- .unwrap_or_else(|| extension::decode::all(extensions_data, object_hash));
+ let ext_res = extension_loading.map_or_else(
+ || extension::decode::all(extensions_data, object_hash),
+ |thread| thread.join().unwrap(),
+ );
(entries_res, ext_res)
});
let (ext, data) = ext_res?;
diff --git a/vendor/gix-index/src/entry/stat.rs b/vendor/gix-index/src/entry/stat.rs
index eb537cf58..65063dc16 100644
--- a/vendor/gix-index/src/entry/stat.rs
+++ b/vendor/gix-index/src/entry/stat.rs
@@ -75,7 +75,7 @@ impl Stat {
}
}
- /// Creates stat information from the result of symlink_metadata.
+ /// Creates stat information from the result of `symlink_metadata`.
pub fn from_fs(fstat: &std::fs::Metadata) -> Result<Stat, SystemTimeError> {
let mtime = fstat.modified().unwrap_or(std::time::UNIX_EPOCH);
let ctime = fstat.created().unwrap_or(std::time::UNIX_EPOCH);
diff --git a/vendor/gix-index/src/extension/end_of_index_entry/decode.rs b/vendor/gix-index/src/extension/end_of_index_entry/decode.rs
index f8002ab7c..4acc0be84 100644
--- a/vendor/gix-index/src/extension/end_of_index_entry/decode.rs
+++ b/vendor/gix-index/src/extension/end_of_index_entry/decode.rs
@@ -45,10 +45,7 @@ pub fn decode(data: &[u8], object_hash: gix_hash::Kind) -> Option<usize> {
return None;
}
// The last-to-this chunk ends where ours starts
- if last_chunk
- .map(|s| s.as_ptr_range().end != (&data[start_of_eoie]) as *const _)
- .unwrap_or(true)
- {
+ if last_chunk.map_or(true, |s| s.as_ptr_range().end != (&data[start_of_eoie]) as *const _) {
return None;
}
diff --git a/vendor/gix-index/src/extension/resolve_undo.rs b/vendor/gix-index/src/extension/resolve_undo.rs
index eb6db9ad7..3887e46b2 100644
--- a/vendor/gix-index/src/extension/resolve_undo.rs
+++ b/vendor/gix-index/src/extension/resolve_undo.rs
@@ -36,7 +36,7 @@ pub fn decode(mut data: &[u8], object_hash: gix_hash::Kind) -> Option<Paths> {
data = rest;
let mut modes = [0u32; 3];
- for mode in modes.iter_mut() {
+ for mode in &mut modes {
let (mode_ascii, rest) = split_at_byte_exclusive(data, 0)?;
data = rest;
*mode = u32::from_str_radix(std::str::from_utf8(mode_ascii).ok()?, 8).ok()?;
diff --git a/vendor/gix-index/src/extension/tree/verify.rs b/vendor/gix-index/src/extension/tree/verify.rs
index 82fd03c8c..6280cecf8 100644
--- a/vendor/gix-index/src/extension/tree/verify.rs
+++ b/vendor/gix-index/src/extension/tree/verify.rs
@@ -4,7 +4,7 @@ use bstr::{BString, ByteSlice};
use crate::extension::Tree;
-/// The error returned by [Tree::verify()][crate::extension::Tree::verify()].
+/// The error returned by [`Tree::verify()`][crate::extension::Tree::verify()].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
diff --git a/vendor/gix-index/src/extension/untracked_cache.rs b/vendor/gix-index/src/extension/untracked_cache.rs
index 9f72e0775..a9c95eb1f 100644
--- a/vendor/gix-index/src/extension/untracked_cache.rs
+++ b/vendor/gix-index/src/extension/untracked_cache.rs
@@ -42,7 +42,7 @@ pub const SIGNATURE: Signature = *b"UNTR";
// #[allow(unused)]
/// Decode an untracked cache extension from `data`, assuming object hashes are of type `object_hash`.
pub fn decode(data: &[u8], object_hash: gix_hash::Kind) -> Option<UntrackedCache> {
- if !data.last().map(|b| *b == 0).unwrap_or(false) {
+ if !data.last().map_or(false, |b| *b == 0) {
return None;
}
let (identifier_len, data) = var_int(data)?;
diff --git a/vendor/gix-index/src/verify.rs b/vendor/gix-index/src/verify.rs
index 31b48d1cb..ba7ec3872 100644
--- a/vendor/gix-index/src/verify.rs
+++ b/vendor/gix-index/src/verify.rs
@@ -6,7 +6,7 @@ use crate::State;
pub mod entries {
use bstr::BString;
- /// The error returned by [State::verify_entries()][crate::State::verify_entries()].
+ /// The error returned by [`State::verify_entries()`][crate::State::verify_entries()].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
@@ -30,7 +30,7 @@ pub mod extensions {
None
}
- /// The error returned by [State::verify_extensions()][crate::State::verify_extensions()].
+ /// The error returned by [`State::verify_extensions()`][crate::State::verify_extensions()].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {