diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2013-04-22 21:52:25 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-01 15:33:10 -0700 |
commit | ab292bc4f30dd29d3d111b040b9e982f20b9ceb7 (patch) | |
tree | d2cdfdb734618e2a5a7e5db3835335600f31f52a /t/t3210-pack-refs.sh | |
parent | 0a0b8d1531feced259223314238aa43cb8ca2ce4 (diff) | |
download | git-ab292bc4f30dd29d3d111b040b9e982f20b9ceb7.tar.gz |
repack_without_ref(): silence errors for dangling packed refs
Stop emitting an error message when deleting a packed reference if we
find another dangling packed reference that is overridden by a loose
reference. See the previous commit for a longer explanation of the
issue.
We have to be careful to make sure that the invalid packed reference
really *is* overridden by a loose reference; otherwise what we have
found is repository corruption, which we *should* report.
Please note that this approach is vulnerable to a race condition
similar to the race conditions already known to affect packed
references [1]:
* Process 1 tries to peel packed reference X as part of deleting
another packed reference. It discovers that X does not refer to a
valid object (because the object that it referred to has been
garbage collected).
* Process 2 tries to delete reference X. It starts by deleting the
loose reference X.
* Process 1 checks whether there is a loose reference X. There is not
(it has just been deleted by process 2), so process 1 reports a
spurious error "X does not point to a valid object!"
The worst case seems relatively harmless, and the fix is identical to
the fix that will be needed for the other race conditions (namely
holding a lock on the packed-refs file during *all* reference
deletions), so we leave the cleaning up of all of them as a future
project.
[1] http://thread.gmane.org/gmane.comp.version-control.git/211956
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3210-pack-refs.sh')
-rwxr-xr-x | t/t3210-pack-refs.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh index 675f06a02d..1a2080e3dc 100755 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@ -140,7 +140,7 @@ test_expect_success 'delete ref with dangling packed version' ' test_cmp /dev/null result ' -test_expect_failure 'delete ref while another dangling packed ref' ' +test_expect_success 'delete ref while another dangling packed ref' ' git branch lamb && git commit --allow-empty -m "future garbage" && git pack-refs --all && |