git branch -m: forbid renaming of a symref

There may be cases where one would really want to rename the symbolic
ref without changing its value, but "git branch -m" is not such a
use-case.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Miklos Vajna
2008-10-29 01:05:27 +01:00
committed by Junio C Hamano
parent 569740bdd0
commit fa58186c9b
2 changed files with 17 additions and 20 deletions

View File

@ -112,13 +112,13 @@ test_expect_success 'config information was renamed, too' \
"test $(git config branch.s.dummy) = Hello &&
test_must_fail git config branch.s/s/dummy"
test_expect_success 'renaming a symref' \
test_expect_success 'renaming a symref is not allowed' \
'
git symbolic-ref refs/heads/master2 refs/heads/master &&
git branch -m master2 master3 &&
git symbolic-ref refs/heads/master3 &&
test_must_fail git branch -m master2 master3 &&
git symbolic-ref refs/heads/master2 &&
test -f .git/refs/heads/master &&
! test -f .git/refs/heads/master2
! test -f .git/refs/heads/master3
'
test_expect_success \