]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-branch.sh
Merge branch 'master' into lj/refs
[thirdparty/git.git] / git-branch.sh
index 4379a07210cf30c5d6e5abdb36722985983edb46..bf84b30695fdeda5d5e18456813e0b3cc3d11275 100755 (executable)
@@ -111,6 +111,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
+
 prev=''
 if git-show-ref --verify --quiet -- "refs/heads/$branchname"
 then