1
1
mirror of https://github.com/Byron/gitoxide synced 2025-10-06 01:52:40 +02:00

adapt to changes in gix-object

This commit is contained in:
Pierre Chevalier
2025-04-05 09:50:35 +08:00
committed by Sebastian Thiel
parent a168807b2d
commit 8969245a6b
5 changed files with 12 additions and 11 deletions

View File

@@ -54,8 +54,8 @@ fn run(args: Args) -> anyhow::Result<()> {
for entry in entries {
writeln!(
out,
"{:06o} {:4} {} {}",
*entry.mode,
"{:>6o} {:4} {} {}",
entry.mode,
entry.mode.as_str(),
entry.hash,
entry.path

View File

@@ -49,7 +49,7 @@ fn write_changes(
} => {
writeln!(out, "A: {}", typed_location(location, entry_mode))?;
writeln!(out, " {}", id.attach(repo).shorten_or_id())?;
writeln!(out, " -> {:o}", entry_mode.0)?;
writeln!(out, " -> {entry_mode:o}")?;
}
gix::diff::tree_with_rewrites::Change::Deletion {
location,
@@ -59,7 +59,7 @@ fn write_changes(
} => {
writeln!(out, "D: {}", typed_location(location, entry_mode))?;
writeln!(out, " {}", id.attach(repo).shorten_or_id())?;
writeln!(out, " {:o} ->", entry_mode.0)?;
writeln!(out, " {entry_mode:o} ->")?;
}
gix::diff::tree_with_rewrites::Change::Modification {
location,
@@ -76,7 +76,7 @@ fn write_changes(
id = id.attach(repo).shorten_or_id()
)?;
if previous_entry_mode != entry_mode {
writeln!(out, " {:o} -> {:o}", previous_entry_mode.0, entry_mode.0)?;
writeln!(out, " {previous_entry_mode:o} -> {entry_mode:o}")?;
}
}
gix::diff::tree_with_rewrites::Change::Rewrite {
@@ -101,7 +101,7 @@ fn write_changes(
id = id.attach(repo).shorten_or_id()
)?;
if source_entry_mode != entry_mode {
writeln!(out, " {:o} -> {:o}", source_entry_mode.0, entry_mode.0)?;
writeln!(out, " {source_entry_mode:o} -> {entry_mode:o}")?;
}
}
}

View File

@@ -71,7 +71,8 @@ impl Mode {
impl From<gix_object::tree::EntryMode> for Mode {
fn from(value: gix_object::tree::EntryMode) -> Self {
Self::from_bits_truncate(u32::from(value.0))
let value: u16 = value.value();
Self::from_bits_truncate(u32::from(value))
}
}

View File

@@ -262,7 +262,7 @@ fn parse_conflict_file_info(line: &str) -> Option<(Entry, Side)> {
Entry {
location: path.to_owned(),
id: gix_hash::ObjectId::from_hex(hex_id.as_bytes()).unwrap(),
mode: EntryMode(gix_utils::btoi::to_signed_with_radix::<usize>(oct_mode.as_bytes(), 8).unwrap() as u16),
mode: EntryMode::try_from(oct_mode.as_bytes()).unwrap(),
},
match stage {
"1" => Side::Ancestor,
@@ -339,7 +339,7 @@ pub fn visualize_tree(
mode = if mode.is_tree() {
"".into()
} else {
format!("{:o}:", mode.0)
format!("{mode:o}:")
}
)
}

View File

@@ -50,8 +50,8 @@ impl std::fmt::Display for EntryRef<'_, '_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{:06o} {:>6} {}\t{}",
*self.mode(),
"{:>6o} {:>6} {}\t{}",
self.mode(),
self.mode().as_str(),
self.id().shorten_or_id(),
self.filename()