chiark / gitweb /
Merge branch 'arkkra'
authorMark Wooding <mdw@distorted.org.uk>
Mon, 22 Jan 2007 10:10:56 +0000 (10:10 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 22 Jan 2007 10:10:56 +0000 (10:10 +0000)
import [new file with mode: 0755]

diff --git a/import b/import
new file mode 100755 (executable)
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"