Code

remove logical typo in documentation of sample update hook
[git.git] / builtin-fsck.c
index e077e72dea94892e2f74ddd6be528b02bc6ccea4..c58b0e337ed434ffb90cfb5c80540531d94a4a6a 100644 (file)
@@ -217,7 +217,7 @@ static void check_unreachable_object(struct object *obj)
                                return;
                        }
                        if (!(f = fopen(filename, "w")))
-                               die("Could not open %s", filename);
+                               die_errno("Could not open '%s'", filename);
                        if (obj->type == OBJ_BLOB) {
                                enum object_type type;
                                unsigned long size;
@@ -225,15 +225,15 @@ static void check_unreachable_object(struct object *obj)
                                                &type, &size);
                                if (buf) {
                                        if (fwrite(buf, size, 1, f) != 1)
-                                               die("Could not write %s: %s",
-                                                   filename, strerror(errno));
+                                               die_errno("Could not write '%s'",
+                                                         filename);
                                        free(buf);
                                }
                        } else
                                fprintf(f, "%s\n", sha1_to_hex(obj->sha1));
                        if (fclose(f))
-                               die("Could not finish %s: %s",
-                                   filename, strerror(errno));
+                               die_errno("Could not finish '%s'",
+                                         filename);
                }
                return;
        }
@@ -589,6 +589,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
        struct alternate_object_database *alt;
 
        errors_found = 0;
+       read_replace_refs = 0;
 
        argc = parse_options(argc, argv, prefix, fsck_opts, fsck_usage, 0);
        if (write_lost_and_found) {