зеркало из https://github.com/microsoft/git.git
t3210: test for spurious error messages for dangling packed refs
A packed reference can be overridden by a loose reference, in which
case the packed reference is obsolete and is never used. The object
pointed to by such a reference can be garbage collected. Since
d66da478f2
, this could lead to the emission of a spurious error
message:
error: refs/heads/master does not point to a valid object!
The error is generated by repack_without_ref() if there is an obsolete
dangling packed reference in packed-refs when the packed-refs file has
to be rewritten due to the deletion of another packed reference. Add
a failing test demonstrating this problem and some passing tests of
related scenarios.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
624cac3514
Коммит
0a0b8d1531
|
@ -118,4 +118,37 @@ test_expect_success 'pack, prune and repack' '
|
|||
test_cmp all-of-them again
|
||||
'
|
||||
|
||||
test_expect_success 'explicit pack-refs with dangling packed reference' '
|
||||
git commit --allow-empty -m "soon to be garbage-collected" &&
|
||||
git pack-refs --all &&
|
||||
git reset --hard HEAD^ &&
|
||||
git reflog expire --expire=all --all &&
|
||||
git prune --expire=all &&
|
||||
git pack-refs --all 2>result &&
|
||||
test_cmp /dev/null result
|
||||
'
|
||||
|
||||
test_expect_success 'delete ref with dangling packed version' '
|
||||
git checkout -b lamb &&
|
||||
git commit --allow-empty -m "future garbage" &&
|
||||
git pack-refs --all &&
|
||||
git reset --hard HEAD^ &&
|
||||
git checkout master &&
|
||||
git reflog expire --expire=all --all &&
|
||||
git prune --expire=all &&
|
||||
git branch -d lamb 2>result &&
|
||||
test_cmp /dev/null result
|
||||
'
|
||||
|
||||
test_expect_failure 'delete ref while another dangling packed ref' '
|
||||
git branch lamb &&
|
||||
git commit --allow-empty -m "future garbage" &&
|
||||
git pack-refs --all &&
|
||||
git reset --hard HEAD^ &&
|
||||
git reflog expire --expire=all --all &&
|
||||
git prune --expire=all &&
|
||||
git branch -d lamb 2>result &&
|
||||
test_cmp /dev/null result
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче