git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joshua T. Corbin" <jcorbin@wunjo.org>
To: git@vger.kernel.org
Subject: [PATCH] cg-export to tarball
Date: Tue, 26 Apr 2005 03:12:46 -0400	[thread overview]
Message-ID: <200504260312.46320.jcorbin@wunjo.org> (raw)

The following patch to cg-export will simlpy create a tarball if the argument 
ends in .tar.gz, .tar.bz2, or .tar.

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

Index: cg-export
===================================================================
--- c7eec90959408a71c465b36e728113a2754f99df/cg-export  (mode:100755 
sha1:94d419de48a12f1ea1059451ac4cd489f7008916)
+++ b839b802f91e79ea7b0bb7dcf3e228659bf96a87/cg-export  (mode:100755 
sha1:29834b2749b0a8d7c71a4c67325e4f5ece9d28a0)
@@ -24,8 +24,33 @@
 
 [ -e "$destdir" ] && die "$destdir already exists."
 
+case $destdir in
+  *.tar*)
+    tarfile=$destdir
+    destdir=${destdir%.tar*}
+    ;;
+esac
+
 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
+
+[ -z "$tarfile" ] && exit 0
+
+case $tarfile in
+  *.tar.gz)
+    tar -cvzf $tarfile $destdir || die "Failed to create $tarfile"
+    ;;
+  *.tar.bz2)
+    tar -cvjf $tarfile $destdir || die "Failed to create $tarfile"
+    ;;
+  *.tar)
+    tar -cvf $tarfile $destdir || die "Failed to create $tarfile"
+    ;;
+  *)
+    die "Don't know how to make a ${tarfile#$destdir} file"
+    ;;
+esac
+rm -fr $destdir

             reply	other threads:[~2005-04-26  7:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26  7:12 Joshua T. Corbin [this message]
2005-04-26 20:20 ` [PATCH] cg-export to tarball Petr Baudis
2005-04-26 22:24   ` Rene Scharfe

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=200504260312.46320.jcorbin@wunjo.org \
    --to=jcorbin@wunjo.org \
    --cc=git@vger.kernel.org \
    /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).