Skip to content
Browse files

started a corruption notes file, seeded with Kolkata experience

  • Loading branch information...
1 parent 973faa0 commit cfbfa1cc0b0fb3f5d9aa32288a6c4b9d78d9454b @sitaramc committed Nov 23, 2009
Showing with 40 additions and 0 deletions.
  1. +40 −0 tips/corruption.notes
View
40 tips/corruption.notes
@@ -0,0 +1,40 @@
+# corruption in a git repository
+
+For now, this is just loosely formatted text, maybe like a series of case
+studies.
+
+IMPORTANT NOTE: `git fsck --full` is needed to reliably find repo corruption
+
+### case 1: Kolkata Korruption -- 2 missing tree objects
+
+what finally worked:
+
+ # on some good repo
+ TYPE=$(git cat-file -t $BADOBJSHA)
+ git cat-file $TYPE $BADOBJSHA > file
+
+ # copy file to bad repo
+ git hash-object -t $TYPE -w --stdin < file
+
+However, this may not always work; it is not certain that hash-object will
+*replace* a corrupted object (as opposed to creating a *missing* object). So
+try that, *as well as* this (generic object):
+
+ # on some good repo
+ echo $object | git pack-objects --revs pack
+ # will create two files named pack-*.{idx,pack}
+
+confirm:
+
+ git verify-pack -v pack-*.idx | grep $object
+ # should also contain all sub objects
+
+copy:
+
+ pack* to $bad_repo/[.git?]/objects/pack
+
+repack:
+
+ repack -a -d
+
+(you could also do "unpack-objects" I guess)

0 comments on commit cfbfa1c

Please sign in to comment.
Something went wrong with that request. Please try again.