Page MenuHomePhabricator

Download raw diff from Differential weirdness regarding diff including binary files additions/deletions
Open, Needs TriagePublic

Description

Download raw diff from Differential generates an incorrect diff if the diff includes binary file additions/deletions, generated by git diff --binary. If this is the intentional behavior, it would be better to document in the documentation for clarity. I understand arc works great and I like to use it, but some people prefer to upload the patch via Web UI for some reason.

Reproducing steps

  • Create a git repo
  • Add a binary file (e.g., on OS X, copy /usr/share/tokenizer/ja/char.bin to the repo) via git add
  • git diff --cached --binary | pbcopy
  • Create Diff via Differential Web UI
  • Paste from clipboard in Raw Diff
  • Create a review
  • Click "Download Raw Diff"

And what we get is something like this:

diff --git a/data.bin b/data.bin
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001

literal 0
Hc$@<O00001

Expected result is the exactly same result git diff --cached --binary generated something like

diff --git a/data.bin b/data.bin
new file mode 100644
index 0000000000000000000000000000000000000000..6cda9b61410c8c1dfd93e9d62921c5fc8a330a2e
GIT binary patch
literal 262496
zcmeI*zfRjg90%|V%3!G(GB9*tVCc}th)GkD5-18V@HRY}M;@zjD<cxc4z7da_&!Ld
z{IT(!zrWAf#zOL!5W<hy&-7{exPG_$=ixq`&UP>Q`|VA7_iItH{Nefb>i4pIg}bNQ
z*=jK@T_IiG&(qSSA<P%6^g6vOUF9ZyOxI(qSiT;A#UQR%v)N5W|I_EyV!15efk6n9
zeeEm^Cq>)0Zr$bic9Ss5{<n?8IQvMe+WuuY&)R5ZV`!uAypQev>(=VC*54jio1fdt
zUO(;3F*(bb0S0mdpLM>n-Tl{$GLjJk?HdSZ-!e@GWd^qAWEg(WG#N0^Zv)%&zWCg<
z?!|Vzwtuddxy%`0fB^;=V1NMz7+`<_1{h#~0R|XgfB^;=V1NMz7+`<_1{h#~0R|Xg
zfB^;=V1NMz7+`<_1{h#~0R|XgfB^;=V1NMz7+`<_1{h#~0R|XgfB^;=V1NMz7+`<_
z1{h#~0R|XgfB^;=V1NMz7+`<_1{h#~f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