Re: git 1.5.1-rc1 doesn't like empty files
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 20, 2007, 05:29 UTC
- Message-ID
- <7vslc0bhz7.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <1174361424.3143.42.camel@dv>
Pavel Roskin <proski@gnu.org> writes:
Show 13 quoted lines
> Hello! > > I don't know where this problem appeared, but it present in the current > git (1.5.1-rc1). Empty files become invalid objects in the repository: > > $ touch file > $ git-init > Initialized empty Git repository in .git/ > $ git-add file > $ git-commit -m "first commit" > Created initial commit 16a476808d3cb0a4758997ba58193a9dcfad0fd8 > error: garbage at end of loose object > 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
If the error message above is linewrapped by e-mail, I think it is coming from here:
static void *unpack_sha1_rest(z_stream *stream, void *buffer,...
{
...
if (bytes < size) {
stream->next_out = buf + bytes;
stream->avail_out = size - bytes;
while (status == Z_OK)
status = inflate(stream, Z_FINISH);
}
buf[size] = 0;
if ((status == Z_OK || status == Z_STREAM_END) && !stream->avail_in) {
inflateEnd(stream);
return buf;
} if (status < 0)
error("corrupt loose object '%s'", sha1_to_hex(sha1));
else if (stream->avail_in)
error("garbage at end of loose object '%s'",
sha1_to_hex(sha1));
free(buf);
return NULL;
}Can you check what the value of the status is at that point?