From: Mark Wooding Date: Mon, 22 Jan 2007 10:07:32 +0000 (+0000) Subject: Create import script. X-Git-Tag: 5.3-1~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mup/commitdiff_plain/9a9898dd4ba609d7aee47471a543f7d2a39e3c25 Create import script. --- 9a9898dd4ba609d7aee47471a543f7d2a39e3c25 diff --git a/import b/import new file mode 100755 index 0000000..e2bb0df --- /dev/null +++ b/import @@ -0,0 +1,37 @@ +#! /bin/sh + +set -e +tarball=${1?tarball} +case $tarball in /*);; *) tarball=`pwd`/$tarball;; esac +tmp=${TMPDIR-/tmp}/mup-$$ +mkdir $tmp +: ${GIT_DIR=`git rev-parse --git-dir`} +case $GIT_DIR in /*);; *) GIT_DIR=`pwd`/$GIT_DIR;; esac +export GIT_DIR +trap 'cd /; rm -rf $tmp' 0 +cd $tmp +GIT_INDEX_FILE=$tmp/index +export GIT_INDEX_FILE + +mkdir unpack; cd unpack +cp $tarball . +tar xfz $tarball +mupdir=`ls -d mup-*` +version=${mupdir#mup-} +mv $mupdir mup +echo $version + +find . -type f -print0 | git update-index --add -z --stdin +tree=$(git write-tree) +if [ -f $GIT_DIR/refs/heads/arkkra ]; then + pp="-p $(cat $GIT_DIR/refs/heads/arkkra)" +else + pp="" +fi +commit=$( + echo "Import upstream version $version." | + git commit-tree $tree $pp +) +git update-ref refs/heads/arkkra $commit +git update-ref refs/tags/$version $commit +echo "Imported Mup $version: $commit"