t1400-update-ref: Add test verifying bug with symrefs in delete_ref()
When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD' to delete refs/heads/master), we currently fail to remove the packed version of that ref. This testcase demonstrates the bug. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johan Herland committed
Oct 21, 2012 at 12:40 UTC
75c96e05cec5654912122cb2435e8c3f928a441d
1 file changed
+18
t/t1400-update-ref.sh
+18
@@ -74,6 +74,24 @@ test_expect_success "delete $m (by HEAD)" '
74
'
75
rm -f .git/$m
76
77
+test_expect_success \
78
+ "create $m (by HEAD)" \
79
+ "git update-ref HEAD $A &&
80
+ test $A"' = $(cat .git/'"$m"')'
81
+test_expect_success \
82
+ "pack refs" \
83
+ "git pack-refs --all"
84
+test_expect_success \
85
+ "move $m (by HEAD)" \
86
+ "git update-ref HEAD $B $A &&
87
+ test $B"' = $(cat .git/'"$m"')'
88
+test_expect_failure "delete $m (by HEAD) should remove both packed and loose $m" '
89
+ git update-ref -d HEAD $B &&
90
+ ! grep "$m" .git/packed-refs &&
91
+ ! test -f .git/$m
92
+'
93
+rm -f .git/$m
94
+
95
cp -f .git/HEAD .git/HEAD.orig
96
test_expect_success "delete symref without dereference" '
97
git update-ref --no-deref -d HEAD &&