Add archive-tree, a cpio archive creator
PATCH 1/1 Add archive-tree, a cpio archive creator
This patch adds archive-tree, a program to create a cpio archive of all files referenced by a given tree or commit object. Why cpio and not e.g., tar? The cpio format I chose (GNU cpio calls it "odc") is dead simple compared to any tar variant. I was simply being lazy. :-P
archive-tree optionally accepts a basedir, i.e. a prefix added to all names in the archive. Example usage:
$ ./archive-tree `tree-id` frob-1.1 | gzip -9 > frob-1.1.cpio.gz
Directory permissions are not handled properly, yet. All directories get a mode of (at least) 0755.
Makefile renamed from Makefile~ +1 -1
@@ -29,7 +29,7 @@ PROG= update-cache show-diff init-db write-tree read-tree commit-tree \ cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \ check-files ls-tree merge-base merge-cache unpack-file git-export \ - diff-cache convert-cache + diff-cache convert-cache archive-tree SCRIPT= parent-id tree-id git gitXnormid.sh gitadd.sh gitaddremote.sh \ gitcommit.sh gitdiff-do gitdiff.sh gitlog.sh gitls.sh gitlsobj.sh \
archive-tree.c new file +206 -0
206 lines not on this page · raw message
Quoted 4 lines · Rene Scharfe
This patch adds archive-tree, a program to create a cpio archive of all files referenced by a given tree or commit object. Why cpio and not e.g., tar? The cpio format I chose (GNU cpio calls it "odc") is dead simple compared to any tar variant. I was simply being lazy. :-P
Use the "newc" format. The "odc" will generate a lot of errors on a large filesystem (which I discovered this past weekend).
-Paul
Quoted 2 lines · Paul Dickson
Use the "newc" format. The "odc" will generate a lot of errors on a
large filesystem (which I discovered this past weekend).
How is that? I can only imagine problems with the size of individual files inside an archive because the size field in the header is limited to 33 bits.
In any case, I switched to the tar format. It's more complicated but it turned out that creating these things is still easy. Parsing them might be more of a challenge, but we already have tar for that. :-)
See my other mail for more on the tar creator. I also rebased it to core GIT because it's no helper script.
Rene