Skip to contentSkip to conversation

convert-packs: futureproofing.

PATCH New Junio C Hamano 1 participant 1 message Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 convert-packs: futureproofing.

Names of packfiles are informally expected to be of the form "pack-[0-9a-f]{40}.pack", with corresponding .idx file (the core-level only requires the files are named ".pack" and ".idx" respectively).

The hexadecimal part should be what git-pack-objects computed when the pack was created originally, and it is the SHA1 sum over sorted object names (i.e. 20-byte binary SHA1 checksum each). However, git-pack-objects before v0.99.9 computed a checksum over object names without sorting (i.e. the order git-rev-list fed the object names), just to make pack names unlikely to collide. The current git-pack-objects computes the checksum differently, so that two packfiles that contain the same set of objects are always given the same name. This was done so that we can use the filename as an additional way to verify the integrity of the pack.

Many packfiles in the wild were created with git before v0.99.9, and they will fail this verification. The new command git-convert-packs can be used to rename them to a name that would have been given by git-pack-objects post v0.99.9.

---
* Currently in "pu".

 .gitignore                          |    1 
 Documentation/git-convert-packs.txt |   41 +++++++++++++++++
 Makefile                            |    2 -
 convert-packs.c                     |   86 +++++++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/git-convert-packs.txt
 create mode 100644 convert-packs.c

004e17155fe0a739857851cffc5efd3407af389c

.gitignore +1 -0
index 1a9090b..0d50843 100644
@@ -19,6 +19,7 @@ git-clone-pack
 git-commit
 git-commit-tree
 git-convert-objects
+git-convert-packs
 git-count-objects
 git-cvsexportcommit
 git-cvsimport
Documentation/git-convert-packs.txt new file +41 -0

41 lines not on this page · raw message

Makefile +1 -1
index fa0cd83..6d5f293 100644
@@ -123,7 +123,7 @@ SIMPLE_PROGRAMS = \
 PROGRAMS = \
 	git-apply$X git-cat-file$X \
 	git-checkout-index$X git-clone-pack$X git-commit-tree$X \
-	git-convert-objects$X git-diff-files$X \
+	git-convert-objects$X git-convert-packs$X git-diff-files$X \
 	git-diff-index$X git-diff-stages$X \
 	git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
 	git-hash-object$X git-index-pack$X git-init-db$X \
convert-packs.c new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
1.1.1-g8ecb