From: jcorbin@node1.wunjo.org (Joshua T. Corbin)
To: git@vger.kernel.org
Cc: Petr Baudis <pasky@ucw.cz>, Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Subject: [PATCH] cg-export user the new tar-tree
Date: Wed, 27 Apr 2005 16:14:34 -0400 (EDT) [thread overview]
Message-ID: <20050427201434.E21BE42F01@node1.wunjo.org> (raw)
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
reply other threads:[~2005-04-27 20:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050427201434.E21BE42F01@node1.wunjo.org \
--to=jcorbin@node1.wunjo.org \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
--cc=rene.scharfe@lsrfire.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).