From: Taylor Blau Date: Wed, 18 Jan 2023 21:38:40 GMT Subject: Re: [RFC/PATCH 0/6] hash-object: use fsck to check objects Message-ID: In-Reply-To: On Wed, Jan 18, 2023 at 12:59:24PM -0800, Junio C Hamano wrote: > The --literally option was invented initially primarily to allow a > bogus type of object (e.g. "hash-object -t xyzzy --literally") but I > am happy to see that we are finding different uses. I wonder if > these objects of known types but with syntactically bad contents can > be "repack"ed from loose into packed? > > > [5/6]: fsck: provide a function to fsck buffer without object struct It is indeed possible: --- >8 --- Initialized empty Git repository in /home/ttaylorr/src/git/t/trash directory.t9999-test/.git/ expecting success of 9999.1 'repacking corrupt loose object into packed': name=$(echo $ZERO_OID | sed -e "s/00/Q/g") && printf "100644 fooQ$name" | q_to_nul | git hash-object -w --stdin -t tree >in && git pack-objects .git/objects/pack/pack