X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-branch.sh;h=074229c206d01b8ca097b4ced902e9bf40987a06;hb=1d389ab65dc6867d3059d60bb2b3951bc01a185e;hp=dcec2a9f2f0e379cff152cb70ddf6c2c942d1c99;hpb=ba65af9c1f67461c0dfa6582c911d6a893d80284;p=git.git diff --git a/git-branch.sh b/git-branch.sh index dcec2a9f..074229c2 100755 --- a/git-branch.sh +++ b/git-branch.sh @@ -14,7 +14,8 @@ If two arguments, create a new branch based off of . delete_branch () { option="$1" branch_name="$2" - headref=$(readlink "$GIT_DIR/HEAD" | sed -e 's|^refs/heads/||') + headref=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD | + sed -e 's|^refs/heads/||') case ",$headref," in ",$branch_name,") die "Cannot delete the branch you are on." ;; @@ -67,7 +68,8 @@ done case "$#" in 0) - headref=$(readlink "$GIT_DIR/HEAD" | sed -e 's|^refs/heads/||') + headref=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD | + sed -e 's|^refs/heads/||') git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' | sort |