MCPcopy Create free account
hub / github.com/git/git / odb_source_inmemory_read_object_stream

Function odb_source_inmemory_read_object_stream

odb/source-inmemory.c:101–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101static int odb_source_inmemory_read_object_stream(struct odb_read_stream **out,
102 struct odb_source *source,
103 const struct object_id *oid)
104{
105 struct odb_source_inmemory *inmemory = odb_source_inmemory_downcast(source);
106 struct odb_read_stream_inmemory *stream;
107 const struct inmemory_object *object;
108
109 object = find_cached_object(inmemory, oid);
110 if (!object)
111 return -1;
112
113 CALLOC_ARRAY(stream, 1);
114 stream->base.read = odb_read_stream_inmemory_read;
115 stream->base.close = odb_read_stream_inmemory_close;
116 stream->base.size = object->size;
117 stream->base.type = object->type;
118 stream->buf = object->buf;
119
120 *out = &stream->base;
121 return 0;
122}
123
124struct odb_source_inmemory_for_each_object_data {
125 struct odb_source_inmemory *inmemory;

Callers

nothing calls this directly

Calls 2

find_cached_objectFunction · 0.85

Tested by

no test coverage detected