summaryrefslogtreecommitdiffstats
path: root/vendor/gix-index/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/gix-index/src/access/mod.rs8
-rw-r--r--vendor/gix-index/src/entry/mod.rs8
-rw-r--r--vendor/gix-index/src/entry/stat.rs31
-rw-r--r--vendor/gix-index/src/file/init.rs2
-rw-r--r--vendor/gix-index/src/file/verify.rs2
-rw-r--r--vendor/gix-index/src/file/write.rs2
-rw-r--r--vendor/gix-index/src/init.rs2
-rw-r--r--vendor/gix-index/src/lib.rs7
8 files changed, 35 insertions, 27 deletions
diff --git a/vendor/gix-index/src/access/mod.rs b/vendor/gix-index/src/access/mod.rs
index 08cb23020..2a3e85f11 100644
--- a/vendor/gix-index/src/access/mod.rs
+++ b/vendor/gix-index/src/access/mod.rs
@@ -4,7 +4,7 @@ use std::ops::Range;
use bstr::{BStr, ByteSlice, ByteVec};
use filetime::FileTime;
-use crate::{entry, extension, Entry, PathStorage, State, Version};
+use crate::{entry, extension, Entry, PathStorage, PathStorageRef, State, Version};
// TODO: integrate this somehow, somewhere, depending on later usage.
#[allow(dead_code)]
@@ -41,7 +41,7 @@ impl State {
&self.entries
}
/// Return our path backing, the place which keeps all paths one after another, with entries storing only the range to access them.
- pub fn path_backing(&self) -> &PathStorage {
+ pub fn path_backing(&self) -> &PathStorageRef {
&self.path_backing
}
@@ -58,7 +58,7 @@ impl State {
/// Return mutable entries along with their path, as obtained from `backing`.
pub fn entries_mut_with_paths_in<'state, 'backing>(
&'state mut self,
- backing: &'backing PathStorage,
+ backing: &'backing PathStorageRef,
) -> impl Iterator<Item = (&'state mut Entry, &'backing BStr)> {
self.entries.iter_mut().map(move |e| {
let path = backing[e.path.clone()].as_bstr();
@@ -279,7 +279,7 @@ impl State {
}
/// Return a writable slice to entries and read-access to their path storage at the same time.
- pub fn entries_mut_and_pathbacking(&mut self) -> (&mut [Entry], &PathStorage) {
+ pub fn entries_mut_and_pathbacking(&mut self) -> (&mut [Entry], &PathStorageRef) {
(&mut self.entries, &self.path_backing)
}
diff --git a/vendor/gix-index/src/entry/mod.rs b/vendor/gix-index/src/entry/mod.rs
index e680e08b0..2f257ef63 100644
--- a/vendor/gix-index/src/entry/mod.rs
+++ b/vendor/gix-index/src/entry/mod.rs
@@ -1,4 +1,8 @@
-/// The stage of an entry, one of 0 = base, 1 = ours, 2 = theirs
+/// The stage of an entry, one of…
+/// * 0 = no conflict,
+/// * 1 = base,
+/// * 2 = ours,
+/// * 3 = theirs
pub type Stage = u32;
///
@@ -71,7 +75,7 @@ mod access {
backing[self.path.clone()].as_bstr()
}
- /// Return an entry's stage.
+ /// Return an entry's stage. See [entry::Stage] for possible values.
pub fn stage(&self) -> entry::Stage {
self.flags.stage()
}
diff --git a/vendor/gix-index/src/entry/stat.rs b/vendor/gix-index/src/entry/stat.rs
index 7bde71763..5e60f8540 100644
--- a/vendor/gix-index/src/entry/stat.rs
+++ b/vendor/gix-index/src/entry/stat.rs
@@ -92,21 +92,22 @@ impl Stat {
size: fstat.len() as u32,
};
#[cfg(unix)]
- use std::os::unix::fs::MetadataExt;
- #[cfg(unix)]
- let res = Stat {
- mtime: mtime.try_into().unwrap_or_default(),
- ctime: ctime.try_into().unwrap_or_default(),
- // truncating to 32 bits is fine here because
- // that's what the linux syscalls returns
- // just rust upcasts to 64 bits for some reason?
- // numbers this large are impractical anyway (that's a lot of hard-drives).
- dev: fstat.dev() as u32,
- ino: fstat.ino() as u32,
- uid: fstat.uid(),
- gid: fstat.gid(),
- // truncation to 32 bits is on purpose (git does the same).
- size: fstat.len() as u32,
+ let res = {
+ use std::os::unix::fs::MetadataExt;
+ Stat {
+ mtime: mtime.try_into().unwrap_or_default(),
+ ctime: ctime.try_into().unwrap_or_default(),
+ // truncating to 32 bits is fine here because
+ // that's what the linux syscalls returns
+ // just rust upcasts to 64 bits for some reason?
+ // numbers this large are impractical anyway (that's a lot of hard-drives).
+ dev: fstat.dev() as u32,
+ ino: fstat.ino() as u32,
+ uid: fstat.uid(),
+ gid: fstat.gid(),
+ // truncation to 32 bits is on purpose (git does the same).
+ size: fstat.len() as u32,
+ }
};
Ok(res)
diff --git a/vendor/gix-index/src/file/init.rs b/vendor/gix-index/src/file/init.rs
index 99f4be258..ed13bed6e 100644
--- a/vendor/gix-index/src/file/init.rs
+++ b/vendor/gix-index/src/file/init.rs
@@ -78,7 +78,7 @@ impl File {
let num_bytes_to_hash = meta.len() - object_hash.len_in_bytes() as u64;
let actual_hash = gix_features::hash::bytes(
&mut file,
- num_bytes_to_hash as usize,
+ num_bytes_to_hash,
object_hash,
&mut gix_features::progress::Discard,
&Default::default(),
diff --git a/vendor/gix-index/src/file/verify.rs b/vendor/gix-index/src/file/verify.rs
index 3890acd95..1c0dc7539 100644
--- a/vendor/gix-index/src/file/verify.rs
+++ b/vendor/gix-index/src/file/verify.rs
@@ -27,7 +27,7 @@ impl File {
let should_interrupt = AtomicBool::new(false);
let actual = gix_features::hash::bytes_of_file(
&self.path,
- num_bytes_to_hash as usize,
+ num_bytes_to_hash,
checksum.kind(),
&mut gix_features::progress::Discard,
&should_interrupt,
diff --git a/vendor/gix-index/src/file/write.rs b/vendor/gix-index/src/file/write.rs
index 47a4cde96..0623f6c59 100644
--- a/vendor/gix-index/src/file/write.rs
+++ b/vendor/gix-index/src/file/write.rs
@@ -22,6 +22,7 @@ impl File {
mut out: impl std::io::Write,
options: write::Options,
) -> std::io::Result<(Version, gix_hash::ObjectId)> {
+ let _span = gix_features::trace::detail!("gix_index::File::write_to()", skip_hash = options.skip_hash);
let (version, hash) = if options.skip_hash {
let out: &mut dyn std::io::Write = &mut out;
let version = self.state.write_to(out, options)?;
@@ -40,6 +41,7 @@ impl File {
///
/// Note that the hash produced will be stored which is why we need to be mutable.
pub fn write(&mut self, options: write::Options) -> Result<(), Error> {
+ let _span = gix_features::trace::detail!("gix_index::File::write()", path = ?self.path);
let mut lock = std::io::BufWriter::with_capacity(
64 * 1024,
gix_lock::File::acquire_to_update_resource(&self.path, gix_lock::acquire::Fail::Immediately, None)?,
diff --git a/vendor/gix-index/src/init.rs b/vendor/gix-index/src/init.rs
index 9fe0b8e27..ec09af538 100644
--- a/vendor/gix-index/src/init.rs
+++ b/vendor/gix-index/src/init.rs
@@ -31,7 +31,7 @@ mod from_tree {
fs_monitor: None,
}
}
- /// Create an index [`State`][crate::State] by traversing `tree` recursively, accessing sub-trees
+ /// Create an index [`State`] by traversing `tree` recursively, accessing sub-trees
/// with `find`.
///
/// **No extension data is currently produced**.
diff --git a/vendor/gix-index/src/lib.rs b/vendor/gix-index/src/lib.rs
index 1fb1f6800..55b332a82 100644
--- a/vendor/gix-index/src/lib.rs
+++ b/vendor/gix-index/src/lib.rs
@@ -121,9 +121,10 @@ mod impls {
f,
"{} {}{:?} {} {}",
match entry.flags.stage() {
- 0 => "BASE ",
- 1 => "OURS ",
- 2 => "THEIRS ",
+ 0 => " ",
+ 1 => "BASE ",
+ 2 => "OURS ",
+ 3 => "THEIRS ",
_ => "UNKNOWN",
},
if entry.flags.is_empty() {