summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--refs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index bb0762ee2b..3da3c8cefc 100644
--- a/refs.c
+++ b/refs.c
@@ -531,9 +531,10 @@ static int do_one_ref(const char *base, each_ref_fn fn, int trim,
{
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;