]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm-remote/sync/files.go
safcm: add experimental support to sync from Windows hosts
[safcm/safcm.git] / cmd / safcm-remote / sync / files.go
index 119a3534239f68e2e5d10aee08ec2559590ada87..e0a2221009deda9824aa38419fec6ffc1decc0f0 100644 (file)
@@ -15,6 +15,8 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+// +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("<binary content>\n")
+               oldData = []byte(fmt.Sprintf("<binary content, %d bytes>\n",
+                       len(oldData)))
        }
        if newBin {
-               newData = []byte("<binary content>\n")
+               newData = []byte(fmt.Sprintf("<binary content, %d bytes>\n",
+                       len(newData)))
        }
 
        // TODO: difflib shows empty context lines at the end of the file