X-Git-Url: https://ruderich.org/simon/gitweb/?p=safcm%2Fsafcm.git;a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Ffiles.go;h=e0a2221009deda9824aa38419fec6ffc1decc0f0;hp=119a3534239f68e2e5d10aee08ec2559590ada87;hb=6a40d84afc959f404f243b1c00ab95dc9dd9c721;hpb=5d6cc7f14a4bacc36bf3a23cd735a75ad4a90f1d diff --git a/cmd/safcm-remote/sync/files.go b/cmd/safcm-remote/sync/files.go index 119a353..e0a2221 100644 --- a/cmd/safcm-remote/sync/files.go +++ b/cmd/safcm-remote/sync/files.go @@ -15,6 +15,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// +build !windows + package sync import ( @@ -452,13 +454,16 @@ func diffData(oldData []byte, newData []byte) (string, error) { oldBin := !strings.HasPrefix(http.DetectContentType(oldData), "text/") newBin := !strings.HasPrefix(http.DetectContentType(newData), "text/") if oldBin && newBin { - return "Binary files differ, cannot show diff", nil + return fmt.Sprintf("Binary files differ (%d -> %d bytes), "+ + "cannot show diff", len(oldData), len(newData)), nil } if oldBin { - oldData = []byte("\n") + oldData = []byte(fmt.Sprintf("\n", + len(oldData))) } if newBin { - newData = []byte("\n") + newData = []byte(fmt.Sprintf("\n", + len(newData))) } // TODO: difflib shows empty context lines at the end of the file