| 1 |
#!/bin/sh |
| 2 |
set -e |
| 3 |
if [ $# -lt 2 ]; then |
| 4 |
echo Usage: $0 tarfile merge_tag upstream_tag |
| 5 |
exit 2 |
| 6 |
fi |
| 7 |
tarfile=$1 |
| 8 |
merge_tag=$2 |
| 9 |
upstream_tag=$3 |
| 10 |
dir=$( basename $(tar tzf $tarfile |head -1 ) ) |
| 11 |
tar xzf $tarfile |
| 12 |
git add -f $dir |
| 13 |
tree=$( git write-tree --prefix=${dir}/ ) |
| 14 |
commit=$( echo "Merge in $merge_tag to upstream by unpacking $tarfile." | \ |
| 15 |
git commit-tree $tree -p upstream -p $( git rev-list -n1 $merge_tag ) ) |
| 16 |
|
| 17 |
git branch -f upstream $commit |
| 18 |
git tag $upstream_tag $commit |
| 19 |
git rm -q -r -f $dir |
| 20 |
|