Skip to contentSkip to conversation

make cg-export use tar-tree

PATCH Rene Scharfe 1 participant 1 message Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Joshua T. Corbin

Here it is (this time with real tabs instead of two spaces ;) ), requires Rene's tar-tree patch. Works quite speedily too I might add.

Maybe it's just Thunderbird, but I see single spaces instead of tabs there.

Quoted 5 lines
(quoted diff) +5 -0
+  tar=$(mktemp -t cg-export.tar.XXXXXX)
+  tar-tree $id "$base" > $tar
+  case $ext in
+  .tar.gz|.tgz)
+   gzip -c9 $tar > $dest

Review

Quoted 10 lines
(quoted diff) +10 -0
+   rm -f $tar
+   ;;
+  .tar.bz2)
+   bzip2 -c $tar > $dest
+   rm -f $tar
+   ;;
+  .tar)
+   mv $tar $dest
+   ;;
+  esac

You don't need to create a temporary file using tar-tree. The above can be done like this:

case $ext in
.tar.gz|.tgz)

      tar-tree $id "$base" | gzip -9
      ;;

.tar.bz2)
tar-tree $id "$base" | bzip2
;;
.tar)
tar-tree $id "$base"
;;
esac > $dest

This is both shorter and (a bit) faster. More easily readable, too, IMO. Don't fear the pipe. ;-) And I don't think we need to avoid the triplication of tar-tree calls.

Thanks,
Rene