Re: [PATCH/RFC] Allow writing loose objects that are corrupted in a pack file
From: R. Tyler Ballance <hidden>
Date: 2016-06-15 22:45:45
On Tue, 2008-12-09 at 09:36 +0100, Jan Krüger wrote:
For fixing a corrupted repository by using backup copies of individual files, allow write_sha1_file() to write loose files even if the object already exists in a pack file, but only if the existing entry is marked as corrupted. Signed-off-by: Jan Krüger <redacted> --- On IRC I talked to rtyler who had a corrupted pack file and plenty of object backups by way of cloned repositories. We decided to try extracting the corrupted objects from the other object database and injecting them into the broken repo as loose objects, but this failed because sha1_write_file() refuses to write loose objects that are already present in a pack file.
Figured I'd chime in here with some anecdotal evidence with the error
condition that I hit shortly after Jan sent the email.
xdev3 (master-release)% git pull --no-ff . master
From .
* branch master -> FETCH_HEAD
error: failed to read object
befd9bc4d184b4383569909e4d245f3337c1f8ed at offset 1415784644
from .git/objects/pack/pack-f7eb06e39f01b528c1d1a2c413ac51b31b8515aa.pack
fatal: object befd9bc4d184b4383569909e4d245f3337c1f8ed is
corrupted
Merge with strategy recursive failed.
xdev3 (master-release)%
I ran that command a couple of times to make sure it wasn't a fluke, I
repeated the error numerous times (without switching branches or pulling
from a remote). This pull was done with a slightly modified internal
version of v1.6.0.4
xdev3 (master-release)% git --version
git version 1.6.0.4-kb1
xdev3 (master-release)
After consulting with Jan, I tried running the same command with a
modified version of v1.6.0.5 with Jan's patch
xdev3 (master-release)% ~/basket/bin/git pull --no-ff . master
From .
* branch master -> FETCH_HEAD
Merge made by recursive.
** TOP SECRET MERGES! ;) **
13 files changed, 51 insertions(+), 21 deletions(-)
xdev3 (master-release)%
Purely anecdotal as I'm not entirely clear what the hell is actually going on here :)
Cheers
--
-R. Tyler Ballance
Slide, Inc. Attachments
- signature.asc [application/pgp-signature] 197 bytes