@@ -3,7 +3,6 @@ use crate::{
33 fixture_name, linus_signature, signature,
44} ;
55use gix_actor:: SignatureRef ;
6- use gix_date:: { time:: Sign , Time } ;
76use gix_object:: { bstr:: ByteSlice , commit:: message:: body:: TrailerRef , CommitRef } ;
87use smallvec:: SmallVec ;
98
@@ -12,11 +11,7 @@ fn invalid_timestsamp() {
1211 let actor = gix_actor:: SignatureRef {
1312 name : b"Name" . as_bstr ( ) ,
1413 email : b"name@example.com" . as_bstr ( ) ,
15- time : Time {
16- seconds : 1312735823 ,
17- offset : 0 ,
18- sign : Sign :: Plus ,
19- } ,
14+ time : b"1312735823 +051800" . as_bstr ( ) ,
2015 } ;
2116 assert_eq ! (
2217 CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-timestamp.txt" ) )
@@ -39,11 +34,7 @@ fn invalid_email_of_committer() {
3934 let actor = gix_actor:: SignatureRef {
4035 name : b"Gregor Hartmann" . as_bstr ( ) ,
4136 email : b"gh <Gregor Hartmann<gh@openoffice.org" . as_bstr ( ) ,
42- time : Time {
43- seconds : 1282910542 ,
44- offset : 2 * 60 * 60 ,
45- sign : Sign :: Plus ,
46- } ,
37+ time : b"1282910542 +0200" . as_bstr ( ) ,
4738 } ;
4839 assert_eq ! (
4940 CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-actor.txt" ) )
@@ -67,8 +58,8 @@ fn unsigned() -> crate::Result {
6758 CommitRef {
6859 tree: b"1b2dfb4ac5e42080b682fc676e9738c94ce6d54d" . as_bstr( ) ,
6960 parents: SmallVec :: default ( ) ,
70- author: signature( 1592437401 ) ,
71- committer: signature( 1592437401 ) ,
61+ author: signature( b" 1592437401 +0800" ) ,
62+ committer: signature( b" 1592437401 +0800" ) ,
7263 encoding: None ,
7364 message: b"without sig" . as_bstr( ) ,
7465 extra_headers: vec![ ]
@@ -84,8 +75,8 @@ fn whitespace() -> crate::Result {
8475 CommitRef {
8576 tree: b"9bed6275068a0575243ba8409253e61af81ab2ff" . as_bstr( ) ,
8677 parents: SmallVec :: from( vec![ b"26b4df046d1776c123ac69d918f5aec247b58cc6" . as_bstr( ) ] ) ,
87- author: signature( 1592448450 ) ,
88- committer: signature( 1592448450 ) ,
78+ author: signature( b" 1592448450 +0800" ) ,
79+ committer: signature( b" 1592448450 +0800" ) ,
8980 encoding: None ,
9081 message: b" nl" . as_bstr( ) , // this one had a \n trailing it, but git seems to trim that
9182 extra_headers: vec![ ]
@@ -101,8 +92,8 @@ fn signed_singleline() -> crate::Result {
10192 CommitRef {
10293 tree: b"00fc39317701176e326974ce44f5bd545a32ec0b" . as_bstr( ) ,
10394 parents: SmallVec :: from( vec![ b"09d8d3a12e161a7f6afb522dbe8900a9c09bce06" . as_bstr( ) ] ) ,
104- author: signature( 1592391367 ) ,
105- committer: signature( 1592391367 ) ,
95+ author: signature( b" 1592391367 +0800" ) ,
96+ committer: signature( b" 1592391367 +0800" ) ,
10697 encoding: None ,
10798 message: b"update tasks\n " . as_bstr( ) ,
10899 extra_headers: vec![ ( b"gpgsig" . as_bstr( ) , b"magic:signature" . as_bstr( ) . into( ) ) ]
@@ -120,8 +111,8 @@ fn mergetag() -> crate::Result {
120111 b"44ebe016df3aad96e3be8f95ec52397728dd7701" . as_bstr( ) ,
121112 b"8d485da0ddee79d0e6713405694253d401e41b93" . as_bstr( ) ,
122113 ] ) ,
123- author : linus_signature ( 1591996221 ) ,
124- committer : linus_signature ( 1591996221 ) ,
114+ author : linus_signature ( b" 1591996221 -0700" ) ,
115+ committer : linus_signature ( b" 1591996221 -0700" ) ,
125116 encoding : None ,
126117 message : LONG_MESSAGE . as_bytes ( ) . as_bstr ( ) ,
127118 extra_headers : vec ! [ (
@@ -142,8 +133,8 @@ fn signed() -> crate::Result {
142133 CommitRef {
143134 tree: b"00fc39317701176e326974ce44f5bd545a32ec0b" . as_bstr( ) ,
144135 parents: SmallVec :: from( vec![ b"09d8d3a12e161a7f6afb522dbe8900a9c09bce06" . as_bstr( ) ] ) ,
145- author: signature( 1592391367 ) ,
146- committer: signature( 1592391367 ) ,
136+ author: signature( b" 1592391367 +0800" ) ,
137+ committer: signature( b" 1592391367 +0800" ) ,
147138 encoding: None ,
148139 message: b"update tasks\n " . as_bstr( ) ,
149140 extra_headers: vec![ ( b"gpgsig" . as_bstr( ) , b"-----BEGIN PGP SIGNATURE-----\n \n iQEzBAABCAAdFiEEdjYp/sh4j8NRKLX27gKdHl60AwAFAl7p9tgACgkQ7gKdHl60\n AwBpegf+KQciv9AOIN7+yPmowecGxBnSfpKWTDzFxnyGR8dq63SpWT8WEKG5mf3a\n G6iUqpsDWaMHlzihaMKRvgRpZxFRbjnNPFBj6F4RRqfE+5R7k6DRSLUV5PqnsdSH\n uccfIDWi1imhsm7AaP5trwl1t+83U2JhHqPcPVFLMODYwWeO6NLR/JCzGSTQRa8t\n RgaVMKI19O/fge5OT5Ua8D47VKEhsJX0LfmkP5RfZQ8JJvNd40TupqKRdlv0sAzP\n ya7NXkSHXCavHNR6kA+KpWxn900UoGK8/IDlwU6MeOkpPVawb3NFMqnc7KJDaC2p\n SMzpuEG8LTrCx2YSpHNLqHyzvQ1CZA==\n =5ITV\n -----END PGP SIGNATURE-----\n " . as_bstr( ) . into( ) ) ]
@@ -159,8 +150,8 @@ fn signed_with_encoding() -> crate::Result {
159150 CommitRef {
160151 tree: b"1973afa74d87b2bb73fa884aaaa8752aec43ea88" . as_bstr( ) ,
161152 parents: SmallVec :: from( vec![ b"79c51cc86923e2b8ca0ee5c4eb75e48027133f9a" . as_bstr( ) ] ) ,
162- author: signature( 1592448995 ) ,
163- committer: signature( 1592449083 ) ,
153+ author: signature( b" 1592448995 +0800" ) ,
154+ committer: signature( b" 1592449083 +0800" ) ,
164155 encoding: Some ( b"ISO-8859-1" . as_bstr( ) ) ,
165156 message: b"encoding & sig" . as_bstr( ) ,
166157 extra_headers: vec![ ( b"gpgsig" . as_bstr( ) , SIGNATURE . as_bstr( ) . into( ) ) ]
@@ -176,8 +167,8 @@ fn with_encoding() -> crate::Result {
176167 CommitRef {
177168 tree: b"4a1c03029e7407c0afe9fc0320b3258e188b115e" . as_bstr( ) ,
178169 parents: SmallVec :: from( vec![ b"7ca98aad461a5c302cb4c9e3acaaa6053cc67a62" . as_bstr( ) ] ) ,
179- author: signature( 1592438199 ) ,
180- committer: signature( 1592438199 ) ,
170+ author: signature( b" 1592438199 +0800" ) ,
171+ committer: signature( b" 1592438199 +0800" ) ,
181172 encoding: Some ( "ISO-8859-1" . into( ) ) ,
182173 message: b"commit with encoding" . as_bstr( ) ,
183174 extra_headers: vec![ ]
@@ -191,11 +182,7 @@ fn pre_epoch() -> crate::Result {
191182 let signature = || SignatureRef {
192183 name : "Législateur" . into ( ) ,
193184 email : "" . into ( ) ,
194- time : Time {
195- seconds : -5263834140 ,
196- offset : 540 ,
197- sign : Sign :: Plus ,
198- } ,
185+ time : b"-5263834140 +0009" . as_bstr ( ) ,
199186 } ;
200187 assert_eq ! (
201188 CommitRef :: from_bytes( & fixture_name( "commit" , "pre-epoch.txt" ) ) ?,
@@ -217,11 +204,7 @@ fn double_dash_special_time_offset() -> crate::Result {
217204 let signature = || SignatureRef {
218205 name : "name" . into ( ) ,
219206 email : "name@example.com" . into ( ) ,
220- time : Time {
221- seconds : 1288373970 ,
222- offset : -252000 ,
223- sign : Sign :: Minus ,
224- } ,
207+ time : "1288373970 --700" . into ( ) ,
225208 } ;
226209 assert_eq ! (
227210 CommitRef :: from_bytes( & fixture_name( "commit" , "double-dash-date-offset.txt" ) ) ?,
@@ -243,11 +226,7 @@ fn with_trailer() -> crate::Result {
243226 let kim = SignatureRef {
244227 name : "Kim Altintop" . into ( ) ,
245228 email : "kim@eagain.st" . into ( ) ,
246- time : Time {
247- seconds : 1631514803 ,
248- offset : 7200 ,
249- sign : Sign :: Plus ,
250- } ,
229+ time : "1631514803 +0200" . into ( ) ,
251230 } ;
252231 let backing = fixture_name ( "commit" , "message-with-footer.txt" ) ;
253232 let commit = CommitRef :: from_bytes ( & backing) ?;
@@ -336,8 +315,8 @@ fn merge() -> crate::Result {
336315 b"6a6054db4ce3c1e4e6a37f8c4d7acb63a4d6ad71" . as_bstr( ) ,
337316 b"c91d592913d47ac4e4a76daf16fd649b276e211e" . as_bstr( )
338317 ] ) ,
339- author: signature( 1592454703 ) ,
340- committer: signature( 1592454738 ) ,
318+ author: signature( b" 1592454703 +0800" ) ,
319+ committer: signature( b" 1592454738 +0800" ) ,
341320 encoding: Some ( "ISO-8859-1" . into( ) ) ,
342321 message: b"Merge branch 'branch'" . as_bstr( ) ,
343322 extra_headers: vec![ ]
0 commit comments