]> git.ipfire.org Git - thirdparty/git.git/commit - t/t3200-branch.sh
branch -d: refuse deleting a branch which is currently checked out
authorKazuki Yamaguchi <k@rhe.jp>
Tue, 29 Mar 2016 09:38:39 +0000 (18:38 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Mar 2016 20:05:53 +0000 (13:05 -0700)
commitf292244c04d8109ee32a45016ce08984fbd925f0
tree2c492ec3099cd457f385cde6c1fc833f5bb8157d
parenta0feb1b1870fbb74f65d6a8951e4b2e2a2347ecf
branch -d: refuse deleting a branch which is currently checked out

When a branch is checked out by current working tree, deleting the
branch is forbidden. However when the branch is checked out only by
other working trees, deleting incorrectly succeeds.
Use find_shared_symref() to check if the branch is in use, not just
comparing with the current working tree's HEAD.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
t/t3200-branch.sh