Skip to content

Commit 729a534

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

odb/source-inmemory.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ static int odb_source_inmemory_write_object_stream(struct odb_source *source,
287287
return ret;
288288
}
289289

290+
static int odb_source_inmemory_freshen_object(struct odb_source *source,
291+
const struct object_id *oid)
292+
{
293+
struct odb_source_inmemory *inmemory = odb_source_inmemory_downcast(source);
294+
if (find_cached_object(inmemory, oid))
295+
return 1;
296+
return 0;
297+
}
298+
290299
static int inmemory_object_free(const struct object_id *oid UNUSED,
291300
void *node_data,
292301
void *cb_data UNUSED)
@@ -329,6 +338,7 @@ struct odb_source_inmemory *odb_source_inmemory_new(struct object_database *odb)
329338
source->base.count_objects = odb_source_inmemory_count_objects;
330339
source->base.write_object = odb_source_inmemory_write_object;
331340
source->base.write_object_stream = odb_source_inmemory_write_object_stream;
341+
source->base.freshen_object = odb_source_inmemory_freshen_object;
332342

333343
return source;
334344
}

0 commit comments

Comments
 (0)