2005-07-12 06:30:23 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
|
|
|
|
branchname="$1"
|
2005-07-23 04:08:47 +02:00
|
|
|
case "$2" in
|
|
|
|
'')
|
|
|
|
head=HEAD ;;
|
|
|
|
*)
|
|
|
|
head="$2^0" ;;
|
|
|
|
esac
|
|
|
|
rev=$(git-rev-parse --revs-only --verify "$head") || exit
|
2005-07-12 06:30:23 +02:00
|
|
|
|
|
|
|
[ -z "$branchname" ] && die "git branch: I want a branch name"
|
|
|
|
[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
|
|
|
|
|
|
|
|
echo $rev > "$GIT_DIR/refs/heads/$branchname"
|