Skip to content

Commit b07f907

Browse files
Pierre ChevalierByron
authored andcommitted
fix: Adapt to changes in gix-actor
Use the committer date and author date that are now backed by bytes and interpret these bytes into a `gix_date::Time` on demand.
1 parent c97d1d4 commit b07f907

File tree

29 files changed

+75
-131
lines changed

29 files changed

+75
-131
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ 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" }
155156
gix-features = { version = "^0.42.0", path = "gix-features" }
156157
gix = { version = "^0.71.0", path = "gix", default-features = false }
157158

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: commit_ref.author.time.format(format::DEFAULT),
153+
time: gix_date::Time::from_bytes(commit_ref.author.time)?.format(format::DEFAULT),
154154
message: commit_ref.message.to_owned(),
155155
})
156156
}),

gitoxide-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ 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" }
5354
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"] }
5455
gix-transport-configuration-only = { package = "gix-transport", version = "^0.46.0", path = "../gix-transport", default-features = false }
5556
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/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn estimate_hours(
3131
let mut cur = commits.next().expect("at least one commit if we are here");
3232

3333
for next in commits {
34-
let change_in_minutes = (next.time.seconds.saturating_sub(cur.time.seconds)) as f32 / MINUTES_PER_HOUR;
34+
let change_in_minutes = (next.seconds().saturating_sub(cur.seconds())) as f32 / MINUTES_PER_HOUR;
3535
if change_in_minutes < MAX_COMMIT_DIFFERENCE_IN_MINUTES {
3636
hours += change_in_minutes / MINUTES_PER_HOUR;
3737
} else {

gitoxide-core/src/hours/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,16 @@ where
8282
};
8383
let name = string_ref(author.name.as_ref());
8484
let email = string_ref(author.email.as_ref());
85+
let time = string_ref(author.time.as_ref());
8586

86-
out.push((
87-
commit_idx,
88-
actor::SignatureRef {
89-
name,
90-
email,
91-
time: author.time,
92-
},
93-
));
87+
out.push((commit_idx, actor::SignatureRef { name, email, time }));
9488
}
9589
}
9690
out.shrink_to_fit();
9791
out.sort_by(|a, b| {
9892
a.1.email
9993
.cmp(b.1.email)
100-
.then(a.1.time.seconds.cmp(&b.1.time.seconds).reverse())
94+
.then(a.1.seconds().cmp(&b.1.seconds()).reverse())
10195
});
10296
Ok(out)
10397
});

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

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

gitoxide-core/src/repository/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn fetch_rev_info(
8484
Ok(match object.kind {
8585
gix::object::Kind::Commit => {
8686
let commit = object.into_commit();
87-
(Some(commit.committer()?.time.seconds), commit.tree_id()?.detach())
87+
(Some(commit.committer()?.seconds()), commit.tree_id()?.detach())
8888
}
8989
gix::object::Kind::Tree => (None, object.id),
9090
gix::object::Kind::Tag => fetch_rev_info(object.peel_to_kind(gix::object::Kind::Commit)?)?,

gix-blame/src/file/function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ type CommitTime = i64;
672672
fn commit_time(commit: gix_traverse::commit::Either<'_, '_>) -> Result<CommitTime, gix_object::decode::Error> {
673673
match commit {
674674
gix_traverse::commit::Either::CommitRefIter(commit_ref_iter) => {
675-
commit_ref_iter.committer().map(|c| c.time.seconds)
675+
commit_ref_iter.committer().map(|c| c.seconds())
676676
}
677677
gix_traverse::commit::Either::CachedCommit(commit) => Ok(commit.committer_timestamp() as i64),
678678
}
@@ -701,7 +701,7 @@ fn collect_parents(
701701
for id in commit_ref_iter.parent_ids() {
702702
let parent = odb.find_commit_iter(id.as_ref(), buf).ok();
703703
let parent_commit_time = parent
704-
.and_then(|parent| parent.committer().ok().map(|committer| committer.time.seconds))
704+
.and_then(|parent| parent.committer().ok().map(|committer| committer.seconds()))
705705
.unwrap_or_default();
706706
parent_ids.push((id, parent_commit_time));
707707
}

gix-mailmap/src/snapshot/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ fn enriched_signature<'a>(
157157
(Some(new_email), Some(new_name)) => Signature {
158158
email: new_email.to_owned().into(),
159159
name: new_name.to_owned().into(),
160-
time,
160+
time: time.into(),
161161
},
162162
(Some(new_email), None) => Signature {
163163
email: new_email.to_owned().into(),
164164
name: name.into(),
165-
time,
165+
time: time.into(),
166166
},
167167
(None, Some(new_name)) => Signature {
168168
email: email.into(),
169169
name: new_name.to_owned().into(),
170-
time,
170+
time: time.into(),
171171
},
172172
(None, None) => unreachable!("BUG: ResolvedSignatures don't exist here when nothing is set"),
173173
}

0 commit comments

Comments
 (0)