rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.67k stars 384 forks source link

Loading a diff from a patch sent via mail #877

Open HerrMuellerluedenscheid opened 2 years ago

HerrMuellerluedenscheid commented 2 years ago

Hey,

I would like to load a patch that was sent via email. I saw that formatting an email is implemented but parsing an email is not, is it? Can I simply use the from_buffer method to load the actual patch into a diff?

Best regards and thanks in advance!!

HerrMuellerluedenscheid commented 2 years ago

I didn't know that I can just load the mbox formatted patch the same way as a non-mbox formatted patch. Lesson learned.

So what I'm trying to access is the header information to answer e.g. if the patch was signed off or not. Is there a way to access this already using git2-rs or libgit2? I didn't find a go-to solution in either of those. I would I have to use regex to parse the header?

Cheers