Skip to contentSkip to conversation

GIT: Create tar archives of tree on the fly, take two

PATCH In review Rene Scharfe 2 participants 3 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GIT: Create tar archives of tree on the fly, take two

Hi Linus,

here's an improved version of tar-tree, a streaming archive creator for GIT. The major added feature is blocking; all write(2) calls now have a size of 10240, just as GNU tar (and tape drives) likes them. The buffering overhead does not seem to degrade performance because most files in the repositories I tested this with are smaller than 10KB, so we need fewer system calls.

File names are still restricted to 500 bytes and the archive format currently only allows for files up to 8GB. Both restrictions can be lifted if need be with more pax extended headers.

The archive format used is the pax interchange format, i.e. POSIX tar format. It can be read by (and created with) GNU tar. If I read the specs correctly tar-tree should now be standards compliant (modulo bugs).

Because it streams the archive (think ls-tree merged with cat-file), tar-tree doesn't need to create any temporary files. That makes it quite fast.

It accepts tree IDs and commit IDs as first parameter. In the latter case tar-tree tries to get the commit date out of the committer line. Else all files in the archive are time-stamped with the current time.

An optional second parameter is used as a path prefix for all files in the archive. Example:

   $ tar-tree a2755a80f40e5794ddc20e00f781af9d6320fafb \
   linux-2.6.12-rc3 | bzip9 -9 > linux-2.6.12-rc3.tar.bz2

I think it fits nicely into the core toolset of git. What do you think?

Thanks,
Rene

Makefile (mode:100644 sha1:0b330dc3fd05253b8fd20ca4f9e98e411074868f) renamed from Makefile (mode:100644 sha1:378d5ee9a24a9fb7690bfdf79fd3fde2b9563fad) +1 -1
Index: Makefile
===================================================================
@@ -18,7 +18,7 @@
 	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 http-pull rpush rpull rev-list git-mktag \
-	diff-tree-helper
+	diff-tree-helper tar-tree
 
 all: $(PROG)
 
tar-tree.c (mode:100644 sha1:d078cb5a8d4ab5bc2c774b889b602d179bde39b1) renamed from dev/null (tree:a5d7e40207ee2bd713a15d5bc839168139055f5e) +363 -0

363 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Rene Scharfe

I think it fits nicely into the core toolset of git. What do you think?

Yes. Mind sending in a sign-off too, and I'll apply it.

Linus

#2 lore raw
Quoted 2 lines · Linus Torvalds

Yes. Mind sending in a sign-off too, and I'll apply it.

Sure thing. Hope it's the only thing I stupidly forgot. :)

Makefile (mode:100644 sha1:0b330dc3fd05253b8fd20ca4f9e98e411074868f) renamed from Makefile (mode:100644 sha1:378d5ee9a24a9fb7690bfdf79fd3fde2b9563fad) +1 -1
Index: Makefile
===================================================================
@@ -18,7 +18,7 @@
 	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 http-pull rpush rpull rev-list git-mktag \
-	diff-tree-helper
+	diff-tree-helper tar-tree
 
 all: $(PROG)
 
tar-tree.c (mode:100644 sha1:d078cb5a8d4ab5bc2c774b889b602d179bde39b1) renamed from dev/null (tree:a5d7e40207ee2bd713a15d5bc839168139055f5e) +363 -0

363 lines not on this page · raw message