chiark / gitweb /
Merge branch 'arkkra' into shiny
[mup] / import
1 #! /bin/sh
2
3 set -e
4 tarball=${1?tarball}
5 case $tarball in /*);; *) tarball=`pwd`/$tarball;; esac
6 tmp=${TMPDIR-/tmp}/mup-$$
7 mkdir $tmp
8 : ${GIT_DIR=`git rev-parse --git-dir`}
9 case $GIT_DIR in /*);; *) GIT_DIR=`pwd`/$GIT_DIR;; esac
10 export GIT_DIR
11 trap 'cd /; rm -rf $tmp' 0
12 cd $tmp
13 GIT_INDEX_FILE=$tmp/index
14 export GIT_INDEX_FILE
15
16 mkdir unpack; cd unpack
17 tar xfz $tarball
18 mupdir=`ls -d mup-*`
19 version=${mupdir#mup-}
20 cp $tarball mup_$version.orig.tar.gz
21 mv $mupdir mup
22 echo $version
23
24 find . -type f -print0 | git update-index --add -z --stdin
25 tree=$(git write-tree)
26 if [ -f $GIT_DIR/refs/heads/arkkra ]; then
27   pp="-p $(cat $GIT_DIR/refs/heads/arkkra)"
28 else
29   pp=""
30 fi
31 commit=$(
32   echo "Import upstream version $version." |
33   git commit-tree $tree $pp
34 )
35 git update-ref refs/heads/arkkra $commit
36 git update-ref refs/tags/$version $commit
37 echo "Imported Mup $version: $commit"