X-Git-Url: https://ruderich.org/simon/gitweb/?p=safcm%2Fsafcm.git;a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Ffiles.go;h=3e88be2b6f2ff78ead5af113846fc6cc302c1f0f;hp=119a3534239f68e2e5d10aee08ec2559590ada87;hb=bacf1f2d844cd8b917ad0d38e0d3ba01d74dcae8;hpb=6d78cccd689fd81a08851b95a03fea608f497e16 diff --git a/cmd/safcm-remote/sync/files.go b/cmd/safcm-remote/sync/files.go index 119a353..3e88be2 100644 --- a/cmd/safcm-remote/sync/files.go +++ b/cmd/safcm-remote/sync/files.go @@ -452,13 +452,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