Update git-diff-script.
[git/jrn.git] / git-branch-script
bloba6dfeaf55fb917de346132a94e9d3d123223eecd
1 #!/bin/sh
3 . git-sh-setup-script || die "Not a git archive"
5 case "$#" in
6 0)
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
13 if test "$headref" = "$ref"
14 then
15 pfx='*'
16 else
17 pfx=' '
19 echo "$pfx $ref"
20 done
21 exit 0 ;;
23 head=HEAD ;;
25 head="$2^0" ;;
26 esac
27 branchname="$1"
28 rev=$(git-rev-parse --revs-only --verify "$head") || exit
30 [ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
32 echo $rev > "$GIT_DIR/refs/heads/$branchname"