2005-07-12 04:30:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
|
2005-08-16 17:58:10 +00: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 02:08:47 +00:00
|
|
|
head=HEAD ;;
|
2005-08-16 17:58:10 +00:00
|
|
|
2)
|
2005-07-23 02:08:47 +00:00
|
|
|
head="$2^0" ;;
|
|
|
|
esac
|
2005-08-16 17:58:10 +00:00
|
|
|
branchname="$1"
|
2005-08-24 21:31:36 +00:00
|
|
|
rev=$(git-rev-parse --verify "$head") || exit
|
2005-07-12 04:30:23 +00:00
|
|
|
|
|
|
|
[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
|
|
|
|
|
|
|
|
echo $rev > "$GIT_DIR/refs/heads/$branchname"
|