summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 735c674)
raw | patch | inline | side by side (parent: 735c674)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 23 Jul 2009 06:07:05 +0000 (23:07 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 23 Jul 2009 06:07:05 +0000 (23:07 -0700) |
f8948e2 (remote prune: warn dangling symrefs, 2009-02-08) introduced a
more dangerous variant of for_each_ref() family that skips the check for
dangling refs, but it also made another unrelated check optional by
mistake.
The check to see if a ref points at 0{40} is not about brokenness, but is
about a possible future plan to represent a deleted ref by writing 40 "0"
in a loose ref when there is a stale version of the same ref already in
.git/packed-refs, so that we can implement deletion of a ref without
having to rewrite the packed refs file excluding the ref being deleted.
This check has to live outside of the conditional.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
more dangerous variant of for_each_ref() family that skips the check for
dangling refs, but it also made another unrelated check optional by
mistake.
The check to see if a ref points at 0{40} is not about brokenness, but is
about a possible future plan to represent a deleted ref by writing 40 "0"
in a loose ref when there is a stale version of the same ref already in
.git/packed-refs, so that we can implement deletion of a ref without
having to rewrite the packed refs file excluding the ref being deleted.
This check has to live outside of the conditional.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | patch | blob | history |
index bb0762ee2bcb736e72db1c0bbda0604246f14c15..3da3c8cefcbe123485fb5a68f2406488275ce43b 100644 (file)
--- a/refs.c
+++ b/refs.c
{
if (strncmp(base, entry->name, trim))
return 0;
+ /* Is this a "negative ref" that represents a deleted ref? */
+ if (is_null_sha1(entry->sha1))
+ return 0;
if (!(flags & DO_FOR_EACH_INCLUDE_BROKEN)) {
- if (is_null_sha1(entry->sha1))
- return 0;
if (!has_sha1_file(entry->sha1)) {
error("%s does not point to a valid object!", entry->name);
return 0;