2005-07-12 06:30:23 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
|
2005-08-16 19:58:10 +02:00
|
|
|
case "$#" in
|
|
|
|
0)
|
|
|
|
headref=$(readlink "$GIT_DIR/HEAD" | sed -e 's|^refs/heads/||')
|
|
|
|
git-rev-parse --symbolic --all |
|
|
|
|
sed -ne 's|^refs/heads/||p' |
|
|
|
|
sort |
|
|
|
|
while read ref
|
|
|
|
do
|
|
|
|
if test "$headref" = "$ref"
|
|
|
|
then
|
|
|
|
pfx='*'
|
|
|
|
else
|
|
|
|
pfx=' '
|
|
|
|
fi
|
|
|
|
echo "$pfx $ref"
|
|
|
|
done
|
|
|
|
exit 0 ;;
|
|
|
|
1)
|
2005-07-23 04:08:47 +02:00
|
|
|
head=HEAD ;;
|
2005-08-16 19:58:10 +02:00
|
|
|
2)
|
2005-07-23 04:08:47 +02:00
|
|
|
head="$2^0" ;;
|
|
|
|
esac
|
2005-08-16 19:58:10 +02:00
|
|
|
branchname="$1"
|
2005-07-23 04:08:47 +02:00
|
|
|
rev=$(git-rev-parse --revs-only --verify "$head") || exit
|
2005-07-12 06:30:23 +02:00
|
|
|
|
|
|
|
[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
|
|
|
|
|
|
|
|
echo $rev > "$GIT_DIR/refs/heads/$branchname"
|