Skip to content

Commit 40c48c3

Browse files
committed
adapt to breaking changes in git-actor
1 parent 5c8b0a4 commit 40c48c3

File tree

12 files changed

+39
-31
lines changed

12 files changed

+39
-31
lines changed

cargo-smart-release/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ mod tests {
300300
}
301301

302302
pub fn time_to_offset_date_time(time: git::actor::Time) -> OffsetDateTime {
303-
time::OffsetDateTime::from_unix_timestamp(time.time as i64)
303+
time::OffsetDateTime::from_unix_timestamp(time.seconds_since_unix_epoch as i64)
304304
.expect("always valid unix time")
305-
.replace_offset(time::UtcOffset::from_whole_seconds(time.offset).expect("valid offset"))
305+
.replace_offset(time::UtcOffset::from_whole_seconds(time.offset_in_seconds).expect("valid offset"))
306306
}

git-object/src/commit/ref_iter.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ impl<'a> CommitRefIter<'a> {
5858
/// if not exactly two signatures were iterable.
5959
/// Errors are not the common case - if an error needs to be detectable, use this instance as iterator.
6060
pub fn signatures(&'a mut self) -> impl Iterator<Item = git_actor::SignatureRef<'_>> + 'a {
61-
self.filter_map(Result::ok)
62-
.skip_while(|t| !matches!(t, Token::Author { .. } | Token::Committer { .. }))
63-
.filter_map(|t| match t {
64-
Token::Author { signature } | Token::Committer { signature } => Some(signature),
65-
_ => None,
66-
})
61+
self.filter_map(|t| match t {
62+
Ok(Token::Author { signature }) | Ok(Token::Committer { signature }) => Some(signature),
63+
_ => None,
64+
})
6765
}
6866

6967
/// Returns the committer signature if there is no decoding error.

git-object/tests/immutable/commit/from_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ fn with_trailer() -> crate::Result {
139139
name: "Kim Altintop".into(),
140140
email: "kim@eagain.st".into(),
141141
time: Time {
142-
time: 1631514803,
143-
offset: 7200,
142+
seconds_since_unix_epoch: 1631514803,
143+
offset_in_seconds: 7200,
144144
sign: Sign::Plus,
145145
},
146146
};

git-object/tests/immutable/commit/message.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ mod summary {
236236
name: "name".into(),
237237
email: "email".into(),
238238
time: Time {
239-
time: 0,
240-
offset: 0,
239+
seconds_since_unix_epoch: 0,
240+
offset_in_seconds: 0,
241241
sign: Sign::Plus,
242242
},
243243
};

git-object/tests/immutable/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn signature(time: u32) -> git_actor::SignatureRef<'static> {
2929
name: b"Sebastian Thiel".as_bstr(),
3030
email: b"sebastian.thiel@icloud.com".as_bstr(),
3131
time: Time {
32-
time,
33-
offset: 28800,
32+
seconds_since_unix_epoch: time,
33+
offset_in_seconds: 28800,
3434
sign: Sign::Plus,
3535
},
3636
}
@@ -42,8 +42,8 @@ fn linus_signature(time: u32) -> git_actor::SignatureRef<'static> {
4242
name: b"Linus Torvalds".as_bstr(),
4343
email: b"torvalds@linux-foundation.org".as_bstr(),
4444
time: Time {
45-
time,
46-
offset: -25200,
45+
seconds_since_unix_epoch: time,
46+
offset_in_seconds: -25200,
4747
sign: Sign::Minus,
4848
},
4949
}

git-object/tests/immutable/tag.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ cjHJZXWmV4CcRfmLsXzU8s2cR9A0DBvOxhPD1TlKC2JhBFXigjuL9U4Rbq9tdegB
234234
name: b"Sebastian Thiel".as_bstr(),
235235
email: b"byronimo@gmail.com".as_bstr(),
236236
time: git_actor::Time {
237-
time: 1528473343,
238-
offset,
237+
seconds_since_unix_epoch: 1528473343,
238+
offset_in_seconds: offset,
239239
sign: git_actor::Sign::Plus,
240240
},
241241
}),

git-odb/tests/odb/store/loose.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ fn signature(time: u32) -> git_actor::SignatureRef<'static> {
288288
name: b"Sebastian Thiel".as_bstr(),
289289
email: b"byronimo@gmail.com".as_bstr(),
290290
time: Time {
291-
time,
292-
offset: 7200,
291+
seconds_since_unix_epoch: time,
292+
offset_in_seconds: 7200,
293293
sign: Sign::Plus,
294294
},
295295
}

git-ref/src/store/file/log/line.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ pub mod decode {
229229
name: b"name".as_bstr(),
230230
email: b"foo@example.com".as_bstr(),
231231
time: Time {
232-
time: 1234567890,
233-
offset: 0,
232+
seconds_since_unix_epoch: 1234567890,
233+
offset_in_seconds: 0,
234234
sign: Sign::Minus
235235
}
236236
},
@@ -255,8 +255,8 @@ pub mod decode {
255255
name: b"Sebastian Thiel".as_bstr(),
256256
email: b"foo@example.com".as_bstr(),
257257
time: Time {
258-
time: 1618030561,
259-
offset: 28800,
258+
seconds_since_unix_epoch: 1618030561,
259+
offset_in_seconds: 28800,
260260
sign: Sign::Plus,
261261
},
262262
},

git-ref/src/store/file/loose/reflog/create_or_update/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fn missing_reflog_creates_it_even_if_similarly_named_empty_dir_exists_and_append
7373
name: "committer".into(),
7474
email: "commiter@example.com".into(),
7575
time: Time {
76-
time: 1234,
77-
offset: 1800,
76+
seconds_since_unix_epoch: 1234,
77+
offset_in_seconds: 1800,
7878
sign: Sign::Plus,
7979
},
8080
};

git-ref/tests/file/transaction/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ mod prepare_and_commit {
2525
name: "committer".into(),
2626
email: "committer@example.com".into(),
2727
time: Time {
28-
time: 1234,
29-
offset: 1800,
28+
seconds_since_unix_epoch: 1234,
29+
offset_in_seconds: 1800,
3030
sign: Sign::Plus,
3131
},
3232
}

0 commit comments

Comments
 (0)