Skip to content

Commit 1919e90

Browse files
pks-tgitster
authored andcommitted
odb/source-inmemory: implement freshen_object() callback
Implement the `freshen_object()` callback function for the in-memory source. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e612614 commit 1919e90

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

odb/source-inmemory.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ static int odb_source_inmemory_write_object_stream(struct odb_source *source,
290290
return ret;
291291
}
292292

293+
static int odb_source_inmemory_freshen_object(struct odb_source *source,
294+
const struct object_id *oid)
295+
{
296+
struct odb_source_inmemory *inmemory = odb_source_inmemory_downcast(source);
297+
if (find_cached_object(inmemory, oid))
298+
return 1;
299+
return 0;
300+
}
301+
293302
static int inmemory_object_free(const struct object_id *oid UNUSED,
294303
void *node_data,
295304
void *cb_data UNUSED)
@@ -332,6 +341,7 @@ struct odb_source_inmemory *odb_source_inmemory_new(struct object_database *odb)
332341
source->base.count_objects = odb_source_inmemory_count_objects;
333342
source->base.write_object = odb_source_inmemory_write_object;
334343
source->base.write_object_stream = odb_source_inmemory_write_object_stream;
344+
source->base.freshen_object = odb_source_inmemory_freshen_object;
335345

336346
return source;
337347
}

0 commit comments

Comments
 (0)