This commit is contained in:
Joey Hess 2013-10-19 11:54:08 -04:00
parent b289857962
commit c66caf7b5b

View file

@ -99,14 +99,14 @@ and inject them back into .git/objects to recover:
packs it can handle (which may include parts of corrupt packs) packs it can handle (which may include parts of corrupt packs)
back to loose objects. And delete all packs. back to loose objects. And delete all packs.
2. Delete all loose corrupt objects. 2. Delete all loose corrupt objects.
3. Make a new (bare) clone from the remote. Use `--reference` pointing 3. Make a new (bare) clone from the remote.
at the broken repository, to avoid re-downloading objects that (Note: git does not seem to provide a way to fetch specific missing
are present in it. (git does not seem to provide an easy way to just objects from the remote. Also, cannot use `--reference` against
fetch specific missing objects from a remote; `git fetch-pack` only a repository with missing refs. So this seems unavoidably
operates on refs... but this clone method should be pretty efficient) network-expensive.)
4. Unpack any packs in the clone, so we can operate on loose objects. 5. Use git-cat-file in raw mode on the clone to dump each missing object,
5. Copy each missing object from the new clone's .git/objects to the and feed it into git-hash-object in the corrupt repo. (This avoids
repository. needing to unpack packs in the clone.)
6. If each bad object was able to be repaired this way, we're done! 6. If each bad object was able to be repaired this way, we're done!
(If not, can reuse the clone for getting objects from the next remote.) (If not, can reuse the clone for getting objects from the next remote.)