git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cg-export user the new tar-tree
@ 2005-04-27 20:14 Joshua T. Corbin
  0 siblings, 0 replies; only message in thread
From: Joshua T. Corbin @ 2005-04-27 20:14 UTC (permalink / raw)
  To: git; +Cc: Petr Baudis, Rene Scharfe

If at first you don't succeed, try to fix it....failing that, dump kmail and cat | mail ;)

Okay, so this time around, there are REAL-LIVE tabs in this one...

And this time, there are no temporary files...

Signed-off-by: Joshua T. Corbin <jcorbin@wunjo.org>

--- 6ad600e20c89323c1d3049f75b8ca9b0a2d72167/cg-export  (mode:100755 sha1:d39eb8e723c8cb74c96b64d510f49d1bfcd7d5f8)
+++ 345e15e9173ca1d419a2ff2583696ff4166e5df3/cg-export  (mode:100755 sha1:ff9aa02ff3426e20b09901a291d568bc2ce2b72a)
@@ -8,15 +8,35 @@
 
 . cg-Xlib
 
-destdir=$1
+dest=$1
 id=$(tree-id $2)
 
-([ "$destdir" ] && [ "$id" ]) || die "usage: cg-export DESTDIR [TREE_ID]"
+([ "$dest" ] && [ "$id" ]) || die "usage: cg-export DESTDIR [TREE_ID]"
 
-[ -e "$destdir" ] && die "$destdir already exists."
+[ -e "$dest" ] && die "$dest already exists."
 
-mkdir -p $destdir || die "cannot create $destdir"
-export GIT_INDEX_FILE="$destdir/.git-index"
-read-tree $id
-checkout-cache "--prefix=$destdir/" -a
-rm $GIT_INDEX_FILE
+case $dest in
+	*.tar|*.tar.gz|*.tar.bz2|*.tgz)
+		base=${dest%.tar*};
+		base=${base%.tgz}
+		ext=${dest#$base}
+		case $ext in
+		.tar.gz|.tgz)
+			tar-tree $id "$base" | gzip -c9 $tar > $dest
+			;;
+		.tar.bz2)
+			tar-tree $id "$base" | bzip2 -c $tar > $dest
+			;;
+		.tar)
+			tar-tree $id "$base" > $dest
+			;;
+		esac
+		;;
+	*)
+		mkdir -p $dest || die "cannot create $dest"
+		export GIT_INDEX_FILE="$dest/.git-index"
+		read-tree $id
+		checkout-cache "--prefix=$dest/" -a
+		rm $GIT_INDEX_FILE
+	;;
+esac

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-27 20:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-27 20:14 [PATCH] cg-export user the new tar-tree Joshua T. Corbin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).