#! /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"