diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2006-09-26 07:23:37 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-09-25 23:54:40 -0700 |
commit | 9c7b0b3fc46e552bde1a65cd1950c3634854332b (patch) | |
tree | 7738ab6f8365a842c6862b6726a6fc9e70e08e68 /git-branch.sh | |
parent | 4dafd7d2444051fe0e1eb17e9ded503ad7d9dd25 (diff) | |
download | git-9c7b0b3fc46e552bde1a65cd1950c3634854332b.tar.gz git-9c7b0b3fc46e552bde1a65cd1950c3634854332b.tar.xz |
Remove empty ref directories that prevent creating a ref.
This patch also adds test cases from Linus and Junio.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-branch.sh')
-rwxr-xr-x | git-branch.sh | 10 |
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" |