Skip to content

Commit 5ed5ce7

Browse files
committed
adapt to changes in gix-diff
1 parent 655c9d7 commit 5ed5ce7

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
name: crates without feature toggles
206206
- run: set +x; for feature in progress fs-walkdir-parallel parallel io-pipe crc32 zlib zlib-rust-backend fast-sha1 rustsha1 cache-efficiency-debug; do (cd gix-features && cargo build --features $feature --target ${{ matrix.target }}); done
207207
name: features of gix-features
208-
- run: set +x; for name in gix-diff gix-pack; do (cd $name && cargo build --features wasm --target ${{ matrix.target }}); done
208+
- run: set +x; for name in gix-pack; do (cd $name && cargo build --features wasm --target ${{ matrix.target }}); done
209209
name: crates with 'wasm' feature
210210
- run: cd gix-pack && cargo build --all-features --target ${{ matrix.target }}
211211
name: gix-pack with all features (including wasm)

gix/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ revparse-regex = ["regex", "revision"]
9595

9696
## 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,
9797
## which relies on line-by-line diffs in some cases.
98-
blob-diff = ["gix-diff/blob"]
98+
blob-diff = ["gix-diff/blob", "attributes"]
9999

100100
## Make it possible to turn a tree into a stream of bytes, which can be decoded to entries and turned into various other formats.
101101
worktree-stream = ["gix-worktree-stream", "attributes"]

gix/src/object/tree/diff/for_each.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ pub enum Error {
1616
ConfigureDiffAlgorithm(#[from] crate::config::diff::algorithm::Error),
1717
#[error("Failure during rename tracking")]
1818
RenameTracking(#[from] tracker::emit::Error),
19+
#[error("Could not obtain worktree filter options")]
20+
PipelineOptions(#[from] crate::filter::pipeline::options::Error),
21+
#[error(transparent)]
22+
CommandContext(#[from] crate::config::command_context::Error),
1923
}
2024

2125
///
@@ -175,6 +179,10 @@ where
175179
),
176180
},
177181
&self.src_tree.repo.objects,
182+
&mut gix_filter::Pipeline::new(
183+
self.src_tree.repo.command_context()?,
184+
crate::filter::Pipeline::options(self.src_tree.repo)?,
185+
),
178186
|push| {
179187
self.src_tree
180188
.traverse()

gix/src/repository/worktree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl crate::Repository {
7979
let mut cache = self
8080
.attributes_only(&index, gix_worktree::stack::state::attributes::Source::IdMapping)?
8181
.detach();
82-
let pipeline = gix_filter::Pipeline::new(repo.command_context()?, crate::filter::Pipeline::options(self)?);
82+
let pipeline = gix_filter::Pipeline::new(self.command_context()?, crate::filter::Pipeline::options(self)?);
8383
let objects = self.objects.clone().into_arc().expect("TBD error handling");
8484
let stream = gix_worktree_stream::from_tree(
8585
id,

gix/tests/object/tree/diff.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ mod track_rewrites {
420420
insertions: 1,
421421
before: 11,
422422
after: 12,
423+
similarity: 0.8888889
423424
}),
424425
"by similarity there is a diff"
425426
);
@@ -529,6 +530,7 @@ mod track_rewrites {
529530
insertions: 3,
530531
before: 12,
531532
after: 15,
533+
similarity: 0.75
532534
}),
533535
"by similarity there is a diff"
534536
);
@@ -589,12 +591,12 @@ mod track_rewrites {
589591

590592
let out = out.rewrites.expect("tracking enabled");
591593
assert_eq!(stat, None, "similarity can't run");
592-
assert_eq!(out.num_similarity_checks, 3);
594+
assert_eq!(out.num_similarity_checks, 0);
593595
assert_eq!(
594596
out.num_similarity_checks_skipped_for_rename_tracking_due_to_limit, 0,
595597
"no limit configured"
596598
);
597-
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 57);
599+
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 19);
598600

599601
Ok(())
600602
}
@@ -645,7 +647,7 @@ mod track_rewrites {
645647
let out = out.rewrites.expect("tracking enabled");
646648
assert_eq!(out.num_similarity_checks, 0);
647649
assert_eq!(out.num_similarity_checks_skipped_for_rename_tracking_due_to_limit, 0);
648-
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 3);
650+
assert_eq!(out.num_similarity_checks_skipped_for_copy_tracking_due_to_limit, 2);
649651

650652
Ok(())
651653
}

0 commit comments

Comments
 (0)