@@ -3,7 +3,6 @@ use crate::{
3
3
fixture_name, linus_signature, signature,
4
4
} ;
5
5
use gix_actor:: SignatureRef ;
6
- use gix_date:: { time:: Sign , Time } ;
7
6
use gix_object:: { bstr:: ByteSlice , commit:: message:: body:: TrailerRef , CommitRef } ;
8
7
use smallvec:: SmallVec ;
9
8
@@ -12,11 +11,7 @@ fn invalid_timestsamp() {
12
11
let actor = gix_actor:: SignatureRef {
13
12
name : b"Name" . as_bstr ( ) ,
14
13
email : b"[email protected] " . as_bstr ( ) ,
15
- time : Time {
16
- seconds : 1312735823 ,
17
- offset : 0 ,
18
- sign : Sign :: Plus ,
19
- } ,
14
+ time : b"1312735823 +051800" . as_bstr ( ) ,
20
15
} ;
21
16
assert_eq ! (
22
17
CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-timestamp.txt" ) )
@@ -39,11 +34,7 @@ fn invalid_email_of_committer() {
39
34
let actor = gix_actor:: SignatureRef {
40
35
name : b"Gregor Hartmann" . as_bstr ( ) ,
41
36
email : b"gh <Gregor Hartmann<[email protected] " . 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 ( ) ,
47
38
} ;
48
39
assert_eq ! (
49
40
CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-actor.txt" ) )
@@ -67,8 +58,8 @@ fn unsigned() -> crate::Result {
67
58
CommitRef {
68
59
tree: b"1b2dfb4ac5e42080b682fc676e9738c94ce6d54d" . as_bstr( ) ,
69
60
parents: SmallVec :: default ( ) ,
70
- author: signature( 1592437401 ) ,
71
- committer: signature( 1592437401 ) ,
61
+ author: signature( b" 1592437401 +0800" ) ,
62
+ committer: signature( b" 1592437401 +0800" ) ,
72
63
encoding: None ,
73
64
message: b"without sig" . as_bstr( ) ,
74
65
extra_headers: vec![ ]
@@ -84,8 +75,8 @@ fn whitespace() -> crate::Result {
84
75
CommitRef {
85
76
tree: b"9bed6275068a0575243ba8409253e61af81ab2ff" . as_bstr( ) ,
86
77
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" ) ,
89
80
encoding: None ,
90
81
message: b" nl" . as_bstr( ) , // this one had a \n trailing it, but git seems to trim that
91
82
extra_headers: vec![ ]
@@ -101,8 +92,8 @@ fn signed_singleline() -> crate::Result {
101
92
CommitRef {
102
93
tree: b"00fc39317701176e326974ce44f5bd545a32ec0b" . as_bstr( ) ,
103
94
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" ) ,
106
97
encoding: None ,
107
98
message: b"update tasks\n " . as_bstr( ) ,
108
99
extra_headers: vec![ ( b"gpgsig" . as_bstr( ) , b"magic:signature" . as_bstr( ) . into( ) ) ]
@@ -120,8 +111,8 @@ fn mergetag() -> crate::Result {
120
111
b"44ebe016df3aad96e3be8f95ec52397728dd7701" . as_bstr( ) ,
121
112
b"8d485da0ddee79d0e6713405694253d401e41b93" . as_bstr( ) ,
122
113
] ) ,
123
- author : linus_signature ( 1591996221 ) ,
124
- committer : linus_signature ( 1591996221 ) ,
114
+ author : linus_signature ( b" 1591996221 -0700" ) ,
115
+ committer : linus_signature ( b" 1591996221 -0700" ) ,
125
116
encoding : None ,
126
117
message : LONG_MESSAGE . as_bytes ( ) . as_bstr ( ) ,
127
118
extra_headers : vec ! [ (
@@ -142,8 +133,8 @@ fn signed() -> crate::Result {
142
133
CommitRef {
143
134
tree: b"00fc39317701176e326974ce44f5bd545a32ec0b" . as_bstr( ) ,
144
135
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" ) ,
147
138
encoding: None ,
148
139
message: b"update tasks\n " . as_bstr( ) ,
149
140
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 {
159
150
CommitRef {
160
151
tree: b"1973afa74d87b2bb73fa884aaaa8752aec43ea88" . as_bstr( ) ,
161
152
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" ) ,
164
155
encoding: Some ( b"ISO-8859-1" . as_bstr( ) ) ,
165
156
message: b"encoding & sig" . as_bstr( ) ,
166
157
extra_headers: vec![ ( b"gpgsig" . as_bstr( ) , SIGNATURE . as_bstr( ) . into( ) ) ]
@@ -176,8 +167,8 @@ fn with_encoding() -> crate::Result {
176
167
CommitRef {
177
168
tree: b"4a1c03029e7407c0afe9fc0320b3258e188b115e" . as_bstr( ) ,
178
169
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" ) ,
181
172
encoding: Some ( "ISO-8859-1" . into( ) ) ,
182
173
message: b"commit with encoding" . as_bstr( ) ,
183
174
extra_headers: vec![ ]
@@ -191,11 +182,7 @@ fn pre_epoch() -> crate::Result {
191
182
let signature = || SignatureRef {
192
183
name : "Législateur" . into ( ) ,
193
184
email : "" . into ( ) ,
194
- time : Time {
195
- seconds : -5263834140 ,
196
- offset : 540 ,
197
- sign : Sign :: Plus ,
198
- } ,
185
+ time : b"-5263834140 +0009" . as_bstr ( ) ,
199
186
} ;
200
187
assert_eq ! (
201
188
CommitRef :: from_bytes( & fixture_name( "commit" , "pre-epoch.txt" ) ) ?,
@@ -217,11 +204,7 @@ fn double_dash_special_time_offset() -> crate::Result {
217
204
let signature = || SignatureRef {
218
205
name : "name" . into ( ) ,
219
206
email : "[email protected] " . into ( ) ,
220
- time : Time {
221
- seconds : 1288373970 ,
222
- offset : -252000 ,
223
- sign : Sign :: Minus ,
224
- } ,
207
+ time : "1288373970 --700" . into ( ) ,
225
208
} ;
226
209
assert_eq ! (
227
210
CommitRef :: from_bytes( & fixture_name( "commit" , "double-dash-date-offset.txt" ) ) ?,
@@ -243,11 +226,7 @@ fn with_trailer() -> crate::Result {
243
226
let kim = SignatureRef {
244
227
name : "Kim Altintop" . into ( ) ,
245
228
email : "[email protected] " . into ( ) ,
246
- time : Time {
247
- seconds : 1631514803 ,
248
- offset : 7200 ,
249
- sign : Sign :: Plus ,
250
- } ,
229
+ time : "1631514803 +0200" . into ( ) ,
251
230
} ;
252
231
let backing = fixture_name ( "commit" , "message-with-footer.txt" ) ;
253
232
let commit = CommitRef :: from_bytes ( & backing) ?;
@@ -336,8 +315,8 @@ fn merge() -> crate::Result {
336
315
b"6a6054db4ce3c1e4e6a37f8c4d7acb63a4d6ad71" . as_bstr( ) ,
337
316
b"c91d592913d47ac4e4a76daf16fd649b276e211e" . as_bstr( )
338
317
] ) ,
339
- author: signature( 1592454703 ) ,
340
- committer: signature( 1592454738 ) ,
318
+ author: signature( b" 1592454703 +0800" ) ,
319
+ committer: signature( b" 1592454738 +0800" ) ,
341
320
encoding: Some ( "ISO-8859-1" . into( ) ) ,
342
321
message: b"Merge branch 'branch'" . as_bstr( ) ,
343
322
extra_headers: vec![ ]
0 commit comments