From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Cc: Nicolas Pitre <nico@cam.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <junkio@cox.net>
Subject: [PATCH] Fix git-fast-export for zero-sized blobs
Date: Tue, 11 Dec 2007 23:01:28 +0100 [thread overview]
Message-ID: <20071211220128.GA19857@steel.home> (raw)
In-Reply-To: <alpine.LFD.0.99999.0712111509270.555@xanadu.home>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
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
next prev parent reply other threads:[~2007-12-11 22:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-11 20:27 'git fast-export' is crashing on the gcc repo Nicolas Pitre
2007-12-11 20:35 ` Marco Costalba
2007-12-11 22:01 ` Alex Riesen [this message]
2007-12-11 22:20 ` [PATCH] Fix git-fast-export for zero-sized blobs Nicolas Pitre
2007-12-11 22:06 ` 'git fast-export' is crashing on the gcc repo Nicolas Pitre
2007-12-12 1:38 ` Alex Riesen
2007-12-12 1:45 ` Nicolas Pitre
2007-12-12 8:32 ` Junio C Hamano
2007-12-12 8:46 ` David Kastrup
2007-12-12 8:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071211220128.GA19857@steel.home \
--to=raa.lkml@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=nico@cam.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).