X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=git-branch.sh;h=074229c206d01b8ca097b4ced902e9bf40987a06;hb=d1c5f2a42d7b5c0e3d3862212dea1f09809c4963;hp=dcec2a9f2f0e379cff152cb70ddf6c2c942d1c99;hpb=8ac93bc98f5e868e890e1a740df9f0c6513189c8;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 |