Merge branch 'maint-2.0' into maint
[gitweb.git] / builtin / fsck.c
index 8aadca160e857be8a87ec1f152e51eb6f51c90b5..0928a98a71ca2b764d4fbb59976f1c4bdc421dde 100644 (file)
@@ -388,7 +388,8 @@ static void fsck_sha1_list(void)
                unsigned char *sha1 = entry->sha1;
 
                sha1_list.entry[i] = NULL;
-               fsck_sha1(sha1);
+               if (fsck_sha1(sha1))
+                       errors_found |= ERROR_OBJECT;
                free(entry);
        }
        sha1_list.nr = 0;
@@ -481,11 +482,6 @@ static int fsck_handle_reflog(const char *logname, const unsigned char *sha1, in
        return 0;
 }
 
-static int is_branch(const char *refname)
-{
-       return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
-}
-
 static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
 {
        struct object *obj;
@@ -493,6 +489,7 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int f
        obj = parse_object(sha1);
        if (!obj) {
                error("%s: invalid sha1 pointer %s", refname, sha1_to_hex(sha1));
+               errors_found |= ERROR_REACHABLE;
                /* We'll continue with the rest despite the error.. */
                return 0;
        }
@@ -509,7 +506,7 @@ static void get_default_heads(void)
 {
        if (head_points_at && !is_null_sha1(head_sha1))
                fsck_handle_ref("HEAD", head_sha1, 0, NULL);
-       for_each_ref(fsck_handle_ref, NULL);
+       for_each_rawref(fsck_handle_ref, NULL);
        if (include_reflogs)
                for_each_reflog(fsck_handle_reflog, NULL);