Skip to content

Commit 3ea251d

Browse files
committed
chore!: upgrade gix to v0.67
1 parent 1ada2f1 commit 3ea251d

File tree

4 files changed

+34
-21
lines changed

4 files changed

+34
-21
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ http-reqwest = ["gix/blocking-http-transport-reqwest-rust-tls"]
3434

3535

3636
[dependencies]
37-
gix = { version = "0.63.0", default-features = false, features = ["blocking-network-client", "blob-diff", "revision"] }
37+
gix = { version = "0.67.0", default-features = false, features = ["blocking-network-client", "blob-diff", "revision"] }
3838
serde = { version = "1", features = ["std", "derive"] }
3939
hex = { version = "0.4.3", features = ["serde"] }
4040
smartstring = { version = "1.0.1", features = ["serde"] }

src/index/diff/delegate.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Delegate {
2020
change: gix::object::tree::diff::Change<'_, '_, '_>,
2121
) -> Result<gix::object::tree::diff::Action, Error> {
2222
use gix::bstr::ByteSlice;
23-
use gix::object::tree::diff::change::Event::*;
23+
use gix::object::tree::diff::Change::*;
2424
use gix::objs::tree::EntryKind::*;
2525
fn entry_data(
2626
entry: gix::objs::tree::EntryKind,
@@ -31,18 +31,23 @@ impl Delegate {
3131
.transpose()
3232
.map_err(Into::into)
3333
}
34-
if change.location.contains(&b'.') {
34+
if change.location().contains(&b'.') {
3535
return Ok(Default::default());
3636
}
3737

38-
match change.event {
38+
match change {
3939
Rewrite { .. } => {
4040
unreachable!("BUG: this is disabled so shouldn't happen")
4141
}
42-
Addition { entry_mode, id } => {
42+
Addition {
43+
entry_mode,
44+
id,
45+
location,
46+
..
47+
} => {
4348
if let Some(obj) = entry_data(entry_mode.kind(), id)? {
4449
for line in obj.data.lines() {
45-
let version = version_from_json_line(line, change.location)?;
50+
let version = version_from_json_line(line, location)?;
4651
let change = if version.yanked {
4752
Change::AddedAndYanked(version)
4853
} else {
@@ -52,15 +57,20 @@ impl Delegate {
5257
}
5358
}
5459
}
55-
Deletion { entry_mode, id, .. } => {
60+
Deletion {
61+
entry_mode,
62+
id,
63+
location,
64+
..
65+
} => {
5666
if entry_mode.is_no_tree() {
5767
let obj = id.object()?;
5868
let mut deleted = Vec::with_capacity(obj.data.lines().count());
5969
for line in obj.data.lines() {
60-
deleted.push(version_from_json_line(line, change.location)?);
70+
deleted.push(version_from_json_line(line, location)?);
6171
}
6272
self.changes.push(Change::CrateDeleted {
63-
name: change.location.to_string(),
73+
name: location.to_string(),
6474
versions: deleted,
6575
});
6676
}
@@ -69,13 +79,14 @@ impl Delegate {
6979
entry_mode,
7080
previous_id,
7181
id,
82+
location,
7283
..
7384
} => {
7485
if entry_mode.is_blob() {
7586
let old = previous_id.object()?.into_blob();
7687
let new = id.object()?.into_blob();
7788
let mut old_lines = AHashSet::with_capacity(1024);
78-
let location = change.location;
89+
let location = location;
7990
for (number, line) in old.data.lines().enumerate() {
8091
old_lines.insert(Line(number, line));
8192
}

src/index/diff/mod.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{Change, Index};
22
use bstr::ByteSlice;
33
use gix::prelude::ObjectIdExt;
4+
use gix::traverse::commit::simple::CommitTimeOrder;
45
use std::sync::atomic::AtomicBool;
56

67
mod delegate;
@@ -41,7 +42,7 @@ pub enum Error {
4142
#[error("Couldn't get the tree of a commit for diffing purposes")]
4243
PeelToTree(#[from] gix::object::peel::to_kind::Error),
4344
#[error("Failed to diff two trees to find changed crates")]
44-
Diff(#[from] gix::object::blob::diff::init::Error),
45+
Diff(#[from] gix::diff::options::init::Error),
4546
#[error(transparent)]
4647
DiffForEach(#[from] gix::object::tree::diff::for_each::Error),
4748
#[error("Failed to decode {line:?} in file {file_name:?} as crate version")]
@@ -62,7 +63,8 @@ pub enum Error {
6263
Fetch(#[from] gix::remote::fetch::Error),
6364
#[error(transparent)]
6465
InitAnonymousRemote(#[from] gix::remote::init::Error),
65-
#[error("Could not find local tracking branch for remote branch {name:?} in any of {} fetched refs", mappings.len())]
66+
#[error("Could not find local tracking branch for remote branch {name:?} in any of {} fetched refs", mappings.len()
67+
)]
6668
NoMatchingBranch {
6769
name: String,
6870
mappings: Vec<gix::remote::fetch::Mapping>,
@@ -253,8 +255,9 @@ impl Index {
253255
let to = into_tree(to.into())?;
254256
let mut delegate = Delegate::default();
255257
from.changes()?
256-
.track_filename()
257-
.track_rewrites(None)
258+
.options(|opts| {
259+
opts.track_rewrites(None).track_filename();
260+
})
258261
.for_each_to_obtain_tree(&to, |change| delegate.handle(change))?;
259262
delegate.into_result()
260263
}
@@ -321,11 +324,10 @@ impl Index {
321324
let mut commits = current_commit
322325
.attach(&self.repo)
323326
.ancestors()
324-
.sorting(
325-
gix::traverse::commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
326-
seconds,
327-
},
328-
)
327+
.sorting(gix::revision::walk::Sorting::ByCommitTimeCutoff {
328+
seconds,
329+
order: CommitTimeOrder::NewestFirst,
330+
})
329331
.first_parent_only()
330332
.all()
331333
.ok()?

tests/index/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ fn changes_since_last_fetch() {
119119
let mut config = index.repository_mut().config_snapshot_mut();
120120
// TODO: use `remote.save_as_to()` here, requires a way to get the mutable repo ref again.
121121
config
122-
.set_raw_value(
122+
.set_raw_value_by(
123123
"remote",
124124
Some(repo_name.into()),
125125
"url",
126126
git_dir.to_str().unwrap(),
127127
)
128128
.unwrap();
129129
config
130-
.set_raw_value(
130+
.set_raw_value_by(
131131
"remote",
132132
Some(repo_name.into()),
133133
"fetch",

0 commit comments

Comments
 (0)