Skip to content

Commit 4d471cd

Browse files
committed
adapt to changes in gix related rename tracking
1 parent cb17738 commit 4d471cd

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

gitoxide-core/src/query/engine/update.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use anyhow::{anyhow, bail};
99
use gix::objs::find::Error;
1010
use gix::{
1111
bstr::{BStr, BString, ByteSlice},
12+
diff::rewrites::CopySource,
1213
features::progress,
13-
object::tree::diff::rewrites::CopySource,
1414
parallel::{InOrderIter, SequenceId},
1515
prelude::ObjectIdExt,
1616
Count, Progress,
@@ -139,11 +139,10 @@ pub fn update(
139139
});
140140

141141
let rewrites = {
142-
let mut r =
143-
gix::object::tree::diff::Rewrites::try_from_config(&repo.config_snapshot(), true)?.unwrap_or_default();
144-
r.copies = Some(gix::object::tree::diff::rewrites::Copies {
142+
let mut r = gix::diff::Rewrites::try_from_config(&repo.config_snapshot(), true)?.unwrap_or_default();
143+
r.copies = Some(gix::diff::rewrites::Copies {
145144
source: if find_copies_harder {
146-
CopySource::FromSetOfModifiedFilesAndSourceTree
145+
CopySource::FromSetOfModifiedFilesAndAllSources
147146
} else {
148147
CopySource::FromSetOfModifiedFiles
149148
},

gix/src/diff.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,15 @@ pub mod rewrites {
284284
/// `cb(destination, source)` is called for each item, either with `Some(source)` if it's
285285
/// the destination of a copy or rename, or with `None` for source if no relation to other
286286
/// items in the tracked set exist.
287-
/// `find_blob(oid, buf) -> Result<BlobRef, E>` is used to access blob data for similarity checks
288-
/// if required with data and is taken directly from the object database. Worktree filters and diff conversions
289-
/// will be applied afterwards automatically.
287+
/// `objects` is used to access blob data for similarity checks if required and is taken directly from the object database.
288+
/// Worktree filters and diff conversions will be applied afterwards automatically.
290289
/// `push_source_tree(push_fn: push(change, location))` is a function that is called when the entire tree of the source
291290
/// should be added as modifications by calling `push` repeatedly to use for perfect copy tracking. Note that
292291
/// `push` will panic if `change` is not a modification, and it's valid to not call `push` at all.
293292
pub fn emit<PushSourceTreeFn, E>(
294293
&mut self,
295294
mut cb: impl FnMut(visit::Destination<'_, T>, Option<visit::Source<'_>>) -> gix_diff::tree::visit::Action,
296-
objects: &dyn gix_object::Find,
295+
objects: impl gix_object::Find,
297296
mut push_source_tree: PushSourceTreeFn,
298297
) -> Result<Outcome, emit::Error>
299298
where
@@ -317,7 +316,7 @@ pub mod rewrites {
317316
&mut cb,
318317
self.rewrites.percentage,
319318
out,
320-
objects,
319+
&objects,
321320
)?;
322321

323322
if let Some(copies) = self.rewrites.copies {
@@ -326,7 +325,7 @@ pub mod rewrites {
326325
&mut cb,
327326
copies.percentage,
328327
out,
329-
objects,
328+
&objects,
330329
)?;
331330

332331
match copies.source {
@@ -348,7 +347,7 @@ pub mod rewrites {
348347
&mut cb,
349348
copies.percentage,
350349
out,
351-
objects,
350+
&objects,
352351
)?;
353352
}
354353
}
@@ -377,11 +376,11 @@ pub mod rewrites {
377376
cb: &mut impl FnMut(visit::Destination<'_, T>, Option<visit::Source<'_>>) -> gix_diff::tree::visit::Action,
378377
percentage: Option<f32>,
379378
mut out: Outcome,
380-
objects: &dyn gix_object::Find,
379+
objects: impl gix_object::Find,
381380
) -> Result<Outcome, emit::Error> {
382381
// we try to cheaply reduce the set of possibilities first, before possibly looking more exhaustively.
383382
let needs_second_pass = !needs_exact_match(percentage);
384-
if self.match_pairs(cb, None /* by identity */, kind, &mut out, objects)?
383+
if self.match_pairs(cb, None /* by identity */, kind, &mut out, &objects)?
385384
== gix_diff::tree::visit::Action::Cancel
386385
{
387386
return Ok(out);
@@ -403,7 +402,7 @@ pub mod rewrites {
403402
false
404403
};
405404
if !is_limited {
406-
self.match_pairs(cb, percentage, kind, &mut out, objects)?;
405+
self.match_pairs(cb, percentage, kind, &mut out, &objects)?;
407406
}
408407
}
409408
Ok(out)
@@ -415,7 +414,7 @@ pub mod rewrites {
415414
percentage: Option<f32>,
416415
kind: visit::Kind,
417416
stats: &mut Outcome,
418-
objects: &dyn gix_object::Find,
417+
objects: impl gix_object::Find,
419418
) -> Result<gix_diff::tree::visit::Action, emit::Error> {
420419
// TODO(perf): reuse object data and interner state and interned tokens, make these available to `find_match()`
421420
let mut dest_ofs = 0;
@@ -433,7 +432,7 @@ pub mod rewrites {
433432
percentage.map(|p| (p, self.diff_algo)),
434433
kind,
435434
stats,
436-
objects,
435+
&objects,
437436
&mut self.buf1,
438437
&mut self.buf2,
439438
)?

0 commit comments

Comments
 (0)