Signed-off-by: Alex Riesen <redacted>
---
builtin-fast-export.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Nicolas Pitre, Tue, Dec 11, 2007 21:27:33 +0100:
Simply doing something like:
$ git fast-export --all > /dev/null
results in:
fatal: Could not write blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
I get this for my git repo:
$ git fast-export --all >/dev/null
fatal: Could not write blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
$ git cat-file blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 |wc -c
0
Writing a zero-size blob will surely returns 0.
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 2136aad..ef27eee 100755
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -103,7 +103,7 @@ static void handle_object(const unsigned char *sha1)
mark_object(object);
printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
- if (fwrite(buf, size, 1, stdout) != 1)
+ if (size && fwrite(buf, size, 1, stdout) != 1)
die ("Could not write blob %s", sha1_to_hex(sha1));
printf("\n");
--
1.5.3.7.1177.gb22b