diff options
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/object-file.c b/object-file.c index b5d1d12b68..6c8e3b1660 100644 --- a/object-file.c +++ b/object-file.c @@ -838,7 +838,7 @@ static void fill_alternate_refs_command(struct child_process *cmd, } } - strvec_pushv(&cmd->env_array, (const char **)local_repo_env); + strvec_pushv(&cmd->env, (const char **)local_repo_env); cmd->out = -1; } @@ -997,7 +997,7 @@ int has_loose_object_nonlocal(const struct object_id *oid) return check_and_freshen_nonlocal(oid, 0); } -static int has_loose_object(const struct object_id *oid) +int has_loose_object(const struct object_id *oid) { return check_and_freshen(oid, 0); } @@ -1728,7 +1728,7 @@ void *read_object_file_extended(struct repository *r, die(_("loose object %s (stored in %s) is corrupt"), oid_to_hex(repl), path); - if ((p = has_packed_and_bad(r, repl)) != NULL) + if ((p = has_packed_and_bad(r, repl))) die(_("packed object %s (stored in %s) is corrupt"), oid_to_hex(repl), p->pack_name); obj_read_unlock(); @@ -1893,7 +1893,9 @@ static void close_loose_object(int fd, const char *filename) if (the_repository->objects->odb->will_destroy) goto out; - if (fsync_object_files > 0) + if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT)) + fsync_loose_object_bulk_checkin(fd, filename); + else if (fsync_object_files > 0) fsync_or_die(fd, filename); else fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd, @@ -1961,6 +1963,9 @@ static int write_loose_object(const struct object_id *oid, char *hdr, static struct strbuf tmp_file = STRBUF_INIT; static struct strbuf filename = STRBUF_INIT; + if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT)) + prepare_loose_object_bulk_checkin(); + loose_object_path(the_repository, &filename, oid); fd = create_tmpfile(&tmp_file, filename.buf); @@ -2035,6 +2040,8 @@ static int freshen_packed_object(const struct object_id *oid) struct pack_entry e; if (!find_pack_entry(the_repository, oid, &e)) return 0; + if (e.p->is_cruft) + return 0; if (e.p->freshened) return 1; if (!freshen_file(e.p->pack_name)) @@ -2623,12 +2630,8 @@ int read_loose_object(const char *path, goto out; } - switch (unpack_loose_header(&stream, map, mapsize, hdr, sizeof(hdr), - NULL)) { - case ULHR_OK: - break; - case ULHR_BAD: - case ULHR_TOO_LONG: + if (unpack_loose_header(&stream, map, mapsize, hdr, sizeof(hdr), + NULL) != ULHR_OK) { error(_("unable to unpack header of %s"), path); goto out; } |