Hi everyone,
The application I'm currently developing needs to be able to create binary files from patches, and I was hoping to do it via JGit's ApplyCommand. It seems that binary patches (of type GIT_BINARY) are recognized successfully by the FileHeader, but are ignored by ApplyCommand#call(). I'd like to correct this, but since this might be a significant change, I'd appreciate some guidance. After some research[1], it seems that valid literal binary diffs look like this:
diff --git a/orange.png b/orange.png
new file mode 100644
index 0000000000000000000000000000000000000000..6177267d5d1e808706c2788af29937064dbc7b72
GIT binary patch
literal 747
zcmZuvF;Ck-6u!^}+(trbgivXvlRMkzI3!h0jw=!uNJS8eG9()&ae_tcvwVl*tlhe?
zQB_F%1Jt?d)E@vdV~0v*;|DPG&JKwa#nSoizWcuKy{GrS9v$vwr8g1)AY0$JntXpD
z*6IrX-+z|>@hwA}dsT3A`}Tof)`I;G1>ogtu`=NM)g}Ndf!k`ccH;ndiKp5<a^k3w
z7jQNJMuhp%bC?YyZ|GATRpgj~`B}h7hB1YmRpfT#2-ZmGz@oaXYO*Oo2#v7U$4zT@
zBImb?e9BmW5gLs~>ZqWSaDejVav5nl(shM16gu{q9VtG2pO`%RSPt!mZopjPL*Z+m
zkaJd%Wf5rlC3!NpKa1qkNm;x=BwkQn)zC5-FLs*WoGP+|L=;z*1T%yc?lc`rhUX$F
z^Mh{0{&V0gyF^eUUJyEz3PEwgPh*Sx_ObwJFeTvm<67w0jD#&hhUV^Y?D_-P;0WC5
zlF%2uG0-Ay!J$EVZhvgq%rSK>UsAN9qHni!9Ty6?s3r0gXQDQc=t-(a$pFMCp8!+h
z!slr+rLCX8{_p|I)vcY@>bvgK$GgkSt8XxOVf_H5-<iktjqAT+0_&d+t()rcm;aj>
B+b;kB
literal 0
HcmV?d00001
My questions:
* I understand the first "literal" block maps to FileHeader#getForwardBinaryHunk and the second to FileHeader#getReverseBinaryHunk. What is the purpose of the reverse binary hunk?
* What is the purpose of the number after the first "literal"? I believe it might be the size of the forward hunk, although the number doesn't seem to match.
* How is the binary hunk represented? How can I extract it?
* Was there an effort to implement this earlier? Or was it left out on purpose?
* Any other guidance would be much appreciated.
Thank you,
Nadav