caio.co/de/caca

Cleanup debug code

Id
af5cb4b069ba80a78906f88a207fb3db03a646ce
Author
Caio
Commit time
2024-08-18T08:43:33+02:00

Modified urso/src/lib.rs

@@ -803,11 +803,11
);

if let Some((new_path, new_id)) =
- rename::find_rename(self, &path, current.unwrap(), &commit_tree, &parent_tree)
+ rename::find_rename(self, current.unwrap(), &commit_tree, &parent_tree)
.map_err(|e| match e {
- RenameError::Repo(inner) => inner,
- RenameError::Wrapped(w) => Error::Wrapped(w),
- })?
+ RenameError::Repo(inner) => inner,
+ RenameError::Wrapped(w) => Error::Wrapped(w),
+ })?
{
tracing::debug!(
commit_id = tracing::field::debug(commit_id),

Modified urso/src/rename/mod.rs

@@ -1,10 +1,10
use gix::{
bstr::{BStr, ByteSlice},
object::tree::diff::{change::Event, Action},
ObjectId, Tree,
};

-use std::path::{Path, PathBuf};
+use std::path::PathBuf;

use crate::error::{wrap_err, WrappedError};

@@ -28,42 +28,15
// Yields back the path and object id of a blob in the
// parent tree that is most similar to the one pointed
// at by the input path
-pub(crate) fn find_rename<R, E, P>(
+pub(crate) fn find_rename<R, E>(
repo: R,
- _path: P,
- // the path at the current tree points at the blob id
id: ObjectId,
current: &Tree<'_>,
parent: &Tree<'_>,
) -> Result<Option<(PathBuf, ObjectId)>, RenameError<E>>
where
R: Repo<Error = E>,
- P: AsRef<Path>,
{
- #[cfg(debug)]
- {
- let mut buf = Vec::new();
- assert!(
- current
- .lookup_entry_by_path(&_path, &mut buf)
- .expect("entry lookup via path works")
- .is_some(),
- "precondition failure: given path {:?} does not exist in current tree {}",
- _path.as_ref(),
- current.id
- );
-
- assert!(
- parent
- .lookup_entry_by_path(&_path, &mut buf)
- .expect("entry lookup via path works")
- .is_none(),
- "precondition failure: given path {:?} exists in parent tree {}",
- _path.as_ref(),
- parent.id
- );
- }
-
let mut candidates = Vec::new();
let target_header = repo.get_header(id).map_err(RenameError::Repo)?;