Skip to content

Commit 6c5861d

Browse files
committed
reproduce failure when parsing malformed commit (#1438)
Note that Git can parse it. It's notable that it parses the name as `Gregor Hartmann` and the email as `gh <Gregor Hartmann<[email protected]`, while the author/commiter lines are `Gregor Hartmann<gh <Gregor Hartmann<[email protected]>>`
1 parent 36f221b commit 6c5861d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

gix-object/tests/commit/from_bytes.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,32 @@ fn invalid_timestsamp() {
3535
);
3636
}
3737

38+
#[test]
39+
fn invalid_email_of_committer() {
40+
let actor = gix_actor::SignatureRef {
41+
name: b"Gregor Hartmann<gh".as_bstr(),
42+
email: b"Gregor Hartmann<[email protected]>".as_bstr(),
43+
time: Time {
44+
seconds: 1270814970,
45+
offset: 2 * 60 * 60,
46+
sign: Sign::Plus,
47+
},
48+
};
49+
assert_eq!(
50+
CommitRef::from_bytes(&fixture_name("commit", "invalid-actor.txt"))
51+
.expect("ignore strangely formed actor format"),
52+
CommitRef {
53+
tree: b"aee896327aa08c20f9ce80c9060aefe47edc65be".as_bstr(),
54+
parents: [b"d93091832789fc586916720da62a341a731fbd66".as_bstr()].into(),
55+
author: actor,
56+
committer: actor,
57+
encoding: None,
58+
message: b"add methods for tablecontrol".as_bstr(),
59+
extra_headers: vec![]
60+
}
61+
);
62+
}
63+
3864
#[test]
3965
fn unsigned() -> crate::Result {
4066
assert_eq!(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tree 220738fd4199e95a2b244465168366a73ebdf271
2+
parent 209fbe2d632761b30b7b17422914e11b93692833
3+
author Gregor Hartmann<gh <Gregor Hartmann<[email protected]>> 1282910542 +0200
4+
committer Gregor Hartmann<gh <Gregor Hartmann<[email protected]>> 1282910542 +0200
5+
6+
build breakers

0 commit comments

Comments
 (0)