Skip to content

Commit afdf1a5

Browse files
committed
adapt to changes in gix-date and gix-actor
1 parent 57366d3 commit afdf1a5

File tree

37 files changed

+168
-211
lines changed

37 files changed

+168
-211
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ gitoxide-core-async-client = ["gitoxide-core/async-client", "futures-lite"]
152152
anyhow = "1.0.98"
153153

154154
gitoxide-core = { version = "^0.46.0", path = "gitoxide-core" }
155-
gix-date= { version = "^0.9.4", path = "gix-date" }
156155
gix-features = { version = "^0.42.0", path = "gix-features" }
157156
gix = { version = "^0.71.0", path = "gix", default-features = false }
158157

examples/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn run(args: Args) -> anyhow::Result<()> {
150150
commit_ref.author.actor().write_to(&mut buf)?;
151151
buf.into()
152152
},
153-
time: gix_date::Time::from_bytes(commit_ref.author.time)?.format(format::DEFAULT),
153+
time: commit_ref.author.time()?.format(format::DEFAULT),
154154
message: commit_ref.message.to_owned(),
155155
})
156156
}),

gitoxide-core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ serde = ["gix/serde", "dep:serde_json", "dep:serde", "bytesize/serde"]
5050
[dependencies]
5151
# deselect everything else (like "performance") as this should be controllable by the parent application.
5252
gix = { version = "^0.71.0", path = "../gix", default-features = false, features = ["merge", "blob-diff", "blame", "revision", "mailmap", "excludes", "attributes", "worktree-mutation", "credentials", "interrupt", "status", "dirwalk"] }
53-
gix-date = { version = "^0.9.4", path = "../gix-date" }
5453
gix-pack-for-configuration-only = { package = "gix-pack", version = "^0.58.0", path = "../gix-pack", default-features = false, features = ["pack-cache-lru-dynamic", "pack-cache-lru-static", "generate", "streaming-input"] }
5554
gix-transport-configuration-only = { package = "gix-transport", version = "^0.46.0", path = "../gix-transport", default-features = false }
5655
gix-archive-for-configuration-only = { package = "gix-archive", version = "^0.20.0", path = "../gix-archive", optional = true, features = ["tar", "tar_gz"] }

gitoxide-core/src/hours/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ pub struct Context<W> {
2929
pub struct SignatureRef<'a> {
3030
name: &'a BStr,
3131
email: &'a BStr,
32-
time: gix_date::Time,
32+
time: gix::date::Time,
3333
}
3434

3535
impl SignatureRef<'_> {
36-
fn seconds(&self) -> gix_date::SecondsSinceUnixEpoch {
36+
fn seconds(&self) -> gix::date::SecondsSinceUnixEpoch {
3737
self.time.seconds
3838
}
3939
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ impl query::Engine {
7676
usize,
7777
) = row?;
7878
let id = gix::ObjectId::from(hash);
79-
let commit_time = gix_date::Time::from_bytes(
80-
id.attach(&self.repo).object()?.into_commit().committer()?.time,
81-
)?;
79+
let commit_time = id.attach(&self.repo).object()?.into_commit().committer()?.time()?;
8280
let mode = FileMode::from_usize(mode).context("invalid file mode")?;
8381
info.push(trace_path::Info {
8482
id,

gix-actor/tests/signature/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ fn round_trip() -> Result<(), Box<dyn std::error::Error>> {
6565
];
6666

6767
for input in DEFAULTS {
68-
let signature: Signature = gix_actor::SignatureRef::from_bytes::<()>(input)
69-
.unwrap()
70-
.try_into()
71-
.unwrap();
68+
let signature: Signature = gix_actor::SignatureRef::from_bytes::<()>(input).unwrap().into();
7269
let mut output = Vec::new();
7370
signature.write_to(&mut output)?;
7471
assert_eq!(output.as_bstr(), input.as_bstr());
@@ -95,7 +92,7 @@ fn parse_timestamp_with_trailing_digits() {
9592
SignatureRef {
9693
name: "first last".into(),
9794
email: "name@example.com".into(),
98-
time: "1312735823 +051800".into(),
95+
time: "1312735823 +051800",
9996
}
10097
);
10198

@@ -106,7 +103,7 @@ fn parse_timestamp_with_trailing_digits() {
106103
SignatureRef {
107104
name: "first last".into(),
108105
email: "name@example.com".into(),
109-
time: "1312735823 +0518".into(),
106+
time: "1312735823 +0518",
110107
}
111108
);
112109
}
@@ -120,7 +117,7 @@ fn parse_missing_timestamp() {
120117
SignatureRef {
121118
name: "first last".into(),
122119
email: "name@example.com".into(),
123-
time: "".into(),
120+
time: ""
124121
}
125122
);
126123
}

gix-date/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl TimeBuf {
3636
}
3737

3838
/// Clear the previous content.
39-
pub fn clear(&mut self) {
39+
fn clear(&mut self) {
4040
self.buf.clear();
4141
}
4242
}

gix-mailmap/src/snapshot/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ impl Snapshot {
138138
///
139139
/// Note that this method will always allocate.
140140
pub fn resolve(&self, signature: gix_actor::SignatureRef<'_>) -> gix_actor::Signature {
141-
self.try_resolve(signature).unwrap_or_else(|| signature.to_owned())
141+
self.try_resolve(signature).unwrap_or_else(|| gix_actor::Signature {
142+
name: signature.name.to_owned(),
143+
email: signature.email.to_owned(),
144+
time: signature.time().unwrap_or_default(),
145+
})
142146
}
143147

144148
/// Like [`try_resolve()`][Snapshot::try_resolve()], but always returns a special copy-on-write signature, which contains
@@ -157,17 +161,17 @@ fn enriched_signature<'a>(
157161
(Some(new_email), Some(new_name)) => Signature {
158162
email: new_email.to_owned().into(),
159163
name: new_name.to_owned().into(),
160-
time: gix_date::Time::from_bytes(time).unwrap_or_default(),
164+
time: time.parse().unwrap_or_default(),
161165
},
162166
(Some(new_email), None) => Signature {
163167
email: new_email.to_owned().into(),
164168
name: name.into(),
165-
time: gix_date::Time::from_bytes(time).unwrap_or_default(),
169+
time: time.parse().unwrap_or_default(),
166170
},
167171
(None, Some(new_name)) => Signature {
168172
email: email.into(),
169173
name: new_name.to_owned().into(),
170-
time: gix_date::Time::from_bytes(time).unwrap_or_default(),
174+
time: time.parse().unwrap_or_default(),
171175
},
172176
(None, None) => unreachable!("BUG: ResolvedSignatures don't exist here when nothing is set"),
173177
}

gix-mailmap/src/snapshot/signature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<'a> From<gix_actor::SignatureRef<'a>> for Signature<'a> {
2929
Signature {
3030
name: s.name.into(),
3131
email: s.email.into(),
32-
time: gix_date::Time::from_bytes(s.time).unwrap_or_default(),
32+
time: s.time.parse().unwrap_or_default(),
3333
}
3434
}
3535
}

0 commit comments

Comments
 (0)