let pack-objects do the writing of unreachable objects as loose objects
[gitweb.git] / builtin-merge-file.c
index adce6d4635a4153428368073677cd74a9bafc045..3605960c2d9692514a6df0f344f3c3269cf1de3c 100644 (file)
@@ -57,7 +57,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
 
                if (!f)
                        ret = error("Could not open %s for writing", filename);
-               else if (fwrite(result.ptr, result.size, 1, f) != 1)
+               else if (result.size &&
+                        fwrite(result.ptr, result.size, 1, f) != 1)
                        ret = error("Could not write to %s", filename);
                else if (fclose(f))
                        ret = error("Could not close %s", filename);