Skip to content

Commit 0b57b29

Browse files
fix!: make CommitAuthor email nullable (#799)
1 parent c316992 commit 0b57b29

4 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/api/repos.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ impl<'octo> RepoHandler<'octo> {
287287
/// .branch("master")
288288
/// .commiter(CommitAuthor {
289289
/// name: "Octocat".to_string(),
290-
/// email: "[email protected]".to_string(),
290+
/// email: Some("[email protected]".to_string()),
291291
/// date: None,
292292
/// })
293293
/// .author(CommitAuthor {
294294
/// name: "Ferris".to_string(),
295-
/// email: "[email protected]".to_string(),
295+
/// email: Some("[email protected]".to_string()),
296296
/// date: None,
297297
/// })
298298
/// .send()
@@ -344,12 +344,12 @@ impl<'octo> RepoHandler<'octo> {
344344
/// .branch("master")
345345
/// .commiter(CommitAuthor {
346346
/// name: "Octocat".to_string(),
347-
/// email: "[email protected]".to_string(),
347+
/// email: Some("[email protected]".to_string()),
348348
/// date: None,
349349
/// })
350350
/// .author(CommitAuthor {
351351
/// name: "Ferris".to_string(),
352-
/// email: "[email protected]".to_string(),
352+
/// email: Some("[email protected]".to_string()),
353353
/// date: None,
354354
/// })
355355
/// .send()
@@ -391,12 +391,12 @@ impl<'octo> RepoHandler<'octo> {
391391
/// .branch("master")
392392
/// .commiter(CommitAuthor {
393393
/// name: "Octocat".to_string(),
394-
/// email: "[email protected]".to_string(),
394+
/// email: Some("[email protected]".to_string()),
395395
/// date: None,
396396
/// })
397397
/// .author(CommitAuthor {
398398
/// name: "Ferris".to_string(),
399-
/// email: "[email protected]".to_string(),
399+
/// email: Some("[email protected]".to_string()),
400400
/// date: None,
401401
/// })
402402
/// .send()
@@ -775,7 +775,7 @@ impl<'octo> RepoHandler<'octo> {
775775
/// .signature("signature")
776776
/// .author(CommitAuthor{
777777
/// name: "name".to_owned(),
778-
/// email: "email".to_owned(),
778+
/// email: Some("email".to_owned()),
779779
/// date: None
780780
/// })
781781
/// .send()

src/api/repos/file.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ mod tests {
221221
.branch("not-master")
222222
.commiter(CommitAuthor {
223223
name: "Octocat".to_string(),
224-
email: "[email protected]".to_string(),
224+
email: Some("[email protected]".to_string()),
225225
date: None,
226226
})
227227
.author(CommitAuthor {
228228
name: "Ferris".to_string(),
229-
email: "[email protected]".to_string(),
229+
email: Some("[email protected]".to_string()),
230230
date: None,
231231
});
232232

@@ -260,12 +260,12 @@ mod tests {
260260
.branch("not-master")
261261
.commiter(CommitAuthor {
262262
name: "Octocat".to_string(),
263-
email: "[email protected]".to_string(),
263+
email: Some("[email protected]".to_string()),
264264
date: None,
265265
})
266266
.author(CommitAuthor {
267267
name: "Ferris".to_string(),
268-
email: "[email protected]".to_string(),
268+
email: Some("[email protected]".to_string()),
269269
date: None,
270270
});
271271

src/models/events/payload/push.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod test {
4545
commit.author,
4646
CommitAuthor {
4747
name: "readme-bot".to_string(),
48-
email: "[email protected]".to_string(),
48+
email: Some("[email protected]".to_string()),
4949
date: None,
5050
}
5151
);

src/models/repos.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ pub struct GitUserTime {
158158
#[serde(rename_all = "snake_case")]
159159
pub struct CommitAuthor {
160160
pub name: String,
161-
pub email: String,
161+
#[serde(skip_serializing_if = "Option::is_none")]
162+
pub email: Option<String>,
162163
#[serde(skip_serializing_if = "Option::is_none")]
163164
pub date: Option<DateTime<Utc>>,
164165
}

0 commit comments

Comments
 (0)