diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-11-08 16:07:37 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-08 16:07:37 -0800 |
commit | 3b8572a4297d8720b359c82e1dd9afeb45cda3cd (patch) | |
tree | 88163ad281fc3b0e69246ccb026cddd4bae0b367 /t | |
parent | 16088d8870b7da6d4dd280be2d1728dd3be346b5 (diff) | |
parent | 045a476f91a9a308c823a2709977163238baa3fd (diff) | |
download | git-3b8572a4297d8720b359c82e1dd9afeb45cda3cd.tar.gz git-3b8572a4297d8720b359c82e1dd9afeb45cda3cd.tar.xz |
Merge branch 'mv/maint-branch-m-symref' into maint
* mv/maint-branch-m-symref:
update-ref --no-deref -d: handle the case when the pointed ref is packed
git branch -m: forbid renaming of a symref
Fix git update-ref --no-deref -d.
rename_ref(): handle the case when the reflog of a ref does not exist
Fix git branch -m for symrefs.
Diffstat (limited to 't')
-rwxr-xr-x | t/t1400-update-ref.sh | 18 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 04c2b164b..bd589268f 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -75,6 +75,24 @@ test_expect_success "delete $m (by HEAD)" ' ' rm -f .git/$m +cp -f .git/HEAD .git/HEAD.orig +test_expect_success "delete symref without dereference" ' + git update-ref --no-deref -d HEAD && + ! test -f .git/HEAD +' +cp -f .git/HEAD.orig .git/HEAD + +test_expect_success "delete symref without dereference when the referred ref is packed" ' + echo foo >foo.c && + git add foo.c && + git commit -m foo && + git pack-refs --all && + git update-ref --no-deref -d HEAD && + ! test -f .git/HEAD +' +cp -f .git/HEAD.orig .git/HEAD +git update-ref -d $m + test_expect_success '(not) create HEAD with old sha1' " test_must_fail git update-ref HEAD $A $B " diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 2147eacc5..25e9971fd 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -112,6 +112,15 @@ 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 is not allowed' \ +' + git symbolic-ref refs/heads/master2 refs/heads/master && + 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/master3 +' + test_expect_success \ 'git branch -m u v should fail when the reflog for u is a symlink' ' git branch -l u && |