Skip to content

Commit

Permalink
adapt to changes in gix-diff
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 23, 2023
1 parent ebd4428 commit d257099
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ revparse-regex = ["regex", "revision"]

## Make it possible to diff blobs line by line. Note that this feature is integral for implementing tree-diffs as well due to the handling of rename-tracking,
## which relies on line-by-line diffs in some cases.
blob-diff = ["gix-diff/blob"]
blob-diff = ["gix-diff/blob", "attributes"]

## Make it possible to turn a tree into a stream of bytes, which can be decoded to entries and turned into various other formats.
worktree-stream = ["gix-worktree-stream", "attributes"]
Expand Down
3 changes: 3 additions & 0 deletions gix/src/object/tree/diff/for_each.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub enum Error {
ConfigureDiffAlgorithm(#[from] crate::config::diff::algorithm::Error),
#[error("Failure during rename tracking")]
RenameTracking(#[from] tracker::emit::Error),
#[error("Could not obtain worktree filter options")]
PipelineOptions(#[from] crate::filter::pipeline::options::Error),
}

///
Expand Down Expand Up @@ -175,6 +177,7 @@ where
),
},
&self.src_tree.repo.objects,
&mut gix_filter::Pipeline::new(crate::filter::Pipeline::options(self.src_tree.repo)?),
|push| {
self.src_tree
.traverse()
Expand Down
8 changes: 5 additions & 3 deletions gix/tests/object/tree/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ mod track_rewrites {
insertions: 1,
before: 11,
after: 12,
similarity: 0.8888889
}),
"by similarity there is a diff"
);
Expand Down Expand Up @@ -529,6 +530,7 @@ mod track_rewrites {
insertions: 3,
before: 12,
after: 15,
similarity: 0.75
}),
"by similarity there is a diff"
);
Expand Down Expand Up @@ -589,12 +591,12 @@ mod track_rewrites {

let out = out.rewrites.expect("tracking enabled");
assert_eq!(stat, None, "similarity can't run");
assert_eq!(out.num_similarity_checks, 3);
assert_eq!(out.num_similarity_checks, 0);
assert_eq!(
out.num_similarity_checks_skipped_for_rename_tracking_due_to_limit, 0,
"no limit configured"
);
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 57);
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 19);

Ok(())
}
Expand Down Expand Up @@ -645,7 +647,7 @@ mod track_rewrites {
let out = out.rewrites.expect("tracking enabled");
assert_eq!(out.num_similarity_checks, 0);
assert_eq!(out.num_similarity_checks_skipped_for_rename_tracking_due_to_limit, 0);
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 3);
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 2);

Ok(())
}
Expand Down

0 comments on commit d257099

Please sign in to comment.