]> git.ipfire.org Git - thirdparty/git.git/blame - git-branch.sh
Big tool rename.
[thirdparty/git.git] / git-branch.sh
CommitLineData
37f1a519
LT
1#!/bin/sh
2
215a7ad1 3. git-sh-setup || die "Not a git archive"
37f1a519 4
e4aec26f
KV
5case "$#" in
60)
7 headref=$(readlink "$GIT_DIR/HEAD" | sed -e 's|^refs/heads/||')
8 git-rev-parse --symbolic --all |
9 sed -ne 's|^refs/heads/||p' |
10 sort |
11 while read ref
12 do
13 if test "$headref" = "$ref"
14 then
15 pfx='*'
16 else
17 pfx=' '
18 fi
19 echo "$pfx $ref"
20 done
21 exit 0 ;;
221)
a38e7279 23 head=HEAD ;;
e4aec26f 242)
a38e7279
JH
25 head="$2^0" ;;
26esac
e4aec26f 27branchname="$1"
ff84d327 28rev=$(git-rev-parse --verify "$head") || exit
37f1a519 29
37f1a519
LT
30[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
31
32echo $rev > "$GIT_DIR/refs/heads/$branchname"