17aac0
#!/bin/sh
17aac0
17aac0
proto=$1
17aac0
branch=$2
17aac0
17aac0
if [ -z "$proto" ]; then
17aac0
    echo "Usage: $0 <proto name> [<branch>]"
17aac0
    exit 1
17aac0
fi
17aac0
17aac0
dirname=$proto-$( date +%Y%m%d )
17aac0
17aac0
rm -rf $dirname
17aac0
git clone git://git.freedesktop.org/git/xorg/proto/$proto $dirname
17aac0
cd $dirname
17aac0
if [ -z "$branch" ]; then
17aac0
    git log | head -1
17aac0
else
17aac0
    git checkout $branch
17aac0
fi
17aac0
sha=`git rev-list --max-count=1 --abbrev-commit HEAD`
17aac0
git repack -a -d
17aac0
cd ..
17aac0
17aac0
# append sha to dirname
17aac0
mv $dirname $dirname-git$sha
17aac0
dirname=$dirname-git$sha
17aac0
tarball=$dirname.tar.bz2
17aac0
tar jcf $tarball $dirname
17aac0
rm -rf $dirname
17aac0
echo "$tarball is now available"