X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=git-branch.sh;h=5306b2719ffbedfa077f4d5489ab46448ef5c186;hb=9754563ca9a99bc0fe233f43202af15704fbed4d;hp=4cd5da16f74cee6e277d33bce74242496eca94fe;hpb=069b20a198f171512a1d2d2163b40f70c94f5257;p=git.git diff --git a/git-branch.sh b/git-branch.sh index 4cd5da16..5306b271 100755 --- a/git-branch.sh +++ b/git-branch.sh @@ -1,6 +1,11 @@ #!/bin/sh -. git-sh-setup +GIT_DIR=`git-rev-parse --git-dir` || exit $? + +die () { + echo >&2 "$*" + exit 1 +} usage () { echo >&2 "usage: $(basename $0)"' [-d ] | [[-f] [start-point]] @@ -12,8 +17,7 @@ If two arguments, create a new branch based off of . exit 1 } -headref=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD | - sed -e 's|^refs/heads/||') +headref=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||') delete_branch () { option="$1" @@ -114,4 +118,3 @@ then fi fi git update-ref "refs/heads/$branchname" $rev -