fork of go-gitdiff with jj support

Fix binary headers in formatted patches (#56)

Include file names in the header (now that we can actually parse them)
and fix a bad find-and-replace that changed "differ" to "fmer". Add a
new test to verify that binary files without data format correctly.

authored by Billy Keyes and committed by GitHub fffa3cca 14da3d30

Changed files
+9 -1
gitdiff
+5 -1
gitdiff/format.go
··· 169 169 170 170 if f.IsBinary { 171 171 if f.BinaryFragment == nil { 172 - fm.WriteString("Binary files fmer\n") 172 + fm.WriteString("Binary files ") 173 + fm.WriteQuotedName("a/" + aName) 174 + fm.WriteString(" and ") 175 + fm.WriteQuotedName("b/" + bName) 176 + fm.WriteString(" differ\n") 173 177 } else { 174 178 fm.WriteString("GIT binary patch\n") 175 179 fm.FormatBinaryFragment(f.BinaryFragment)
+1
gitdiff/format_roundtrip_test.go
··· 31 31 // data is slightly different when re-encoded by Go. 32 32 {File: "binary_modify.patch", SkipTextCompare: true}, 33 33 {File: "binary_new.patch", SkipTextCompare: true}, 34 + {File: "binary_modify_nodata.patch"}, 34 35 } 35 36 36 37 for _, patch := range patches {
+3
gitdiff/testdata/string/binary_modify_nodata.patch
··· 1 + diff --git a/file.bin b/file.bin 2 + index a7f4d5d..bdc9a70 100644 3 + Binary files a/file.bin and b/file.bin differ