const struct object_id *oid)
{
struct odb_source_files *files = odb_source_files_downcast(source);
- if (packfile_store_freshen_object(files->packed, oid) ||
+ if (odb_source_freshen_object(&files->packed->base, oid) ||
odb_source_freshen_object(&files->loose->base, oid))
return 1;
return 0;
#include "odb/streaming.h"
#include "packfile.h"
-int find_pack_entry(struct odb_source_packed *store,
- const struct object_id *oid,
- struct pack_entry *e)
+static int find_pack_entry(struct odb_source_packed *store,
+ const struct object_id *oid,
+ struct pack_entry *e)
{
struct packfile_list_entry *l;
return 0;
}
+static int odb_source_packed_freshen_object(struct odb_source *source,
+ const struct object_id *oid)
+{
+ struct odb_source_packed *packed = odb_source_packed_downcast(source);
+ struct pack_entry e;
+
+ if (!find_pack_entry(packed, oid, &e))
+ return 0;
+ if (e.p->is_cruft)
+ return 0;
+ if (e.p->freshened)
+ return 1;
+ if (utime(e.p->pack_name, NULL))
+ return 0;
+ e.p->freshened = 1;
+
+ return 1;
+}
+
void (*report_garbage)(unsigned seen_bits, const char *path);
static void report_helper(const struct string_list *list,
packed->base.for_each_object = odb_source_packed_for_each_object;
packed->base.count_objects = odb_source_packed_count_objects;
packed->base.find_abbrev_len = odb_source_packed_find_abbrev_len;
+ packed->base.freshen_object = odb_source_packed_freshen_object;
if (!is_absolute_path(parent->base.path))
chdir_notify_register(NULL, odb_source_packed_reparent, packed);
return 1;
}
-int packfile_store_freshen_object(struct odb_source_packed *store,
- const struct object_id *oid)
-{
- struct pack_entry e;
- if (!find_pack_entry(store, oid, &e))
- return 0;
- if (e.p->is_cruft)
- return 0;
- if (e.p->freshened)
- return 1;
- if (utime(e.p->pack_name, NULL))
- return 0;
- e.p->freshened = 1;
- return 1;
-}
-
static void maybe_invalidate_kept_pack_cache(struct odb_source_packed *store,
unsigned flags)
{
struct packed_git *packfile_store_load_pack(struct odb_source_packed *store,
const char *idx_path, int local);
-int packfile_store_freshen_object(struct odb_source_packed *store,
- const struct object_id *oid);
-
enum kept_pack_type {
KEPT_PACK_ON_DISK = (1 << 0),
KEPT_PACK_IN_CORE = (1 << 1),