aboutsummaryrefslogtreecommitdiff
path: root/git-branch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-27 22:17:01 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-27 22:17:01 -0700
commit51b2dd4e3f730f6be6c19faf3b4a04caea9e0420 (patch)
tree5c9bdf73416b72cb5e029d3c8467f669a69ccbd5 /git-branch.sh
parent2b83ade9778552526abbe34ae03a57da52a7433d (diff)
parent9c7b0b3fc46e552bde1a65cd1950c3634854332b (diff)
downloadgit-51b2dd4e3f730f6be6c19faf3b4a04caea9e0420.tar.gz
git-51b2dd4e3f730f6be6c19faf3b4a04caea9e0420.tar.xz
Merge branch 'cc/branch-test'
* cc/branch-test: Remove empty ref directories that prevent creating a ref.
Diffstat (limited to 'git-branch.sh')
-rwxr-xr-xgit-branch.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec23..4f31903d6 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -112,6 +112,16 @@ rev=$(git-rev-parse --verify "$head") || exit
git-check-ref-format "heads/$branchname" ||
die "we do not like '$branchname' as a branch name."
+if [ -d "$GIT_DIR/refs/heads/$branchname" ]
+then
+ for refdir in `cd "$GIT_DIR" && \
+ find "refs/heads/$branchname" -type d | sort -r`
+ do
+ rmdir "$GIT_DIR/$refdir" || \
+ die "Could not delete '$refdir', there may still be a ref there."
+ done
+fi
+
if [ -e "$GIT_DIR/refs/heads/$branchname" ]
then
if test '' = "$force"