MCPcopy Index your code
hub / github.com/git/git / peel_object_ext

Function peel_object_ext

object.c:211–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211enum peel_status peel_object_ext(struct repository *r,
212 const struct object_id *name,
213 struct object_id *oid,
214 unsigned flags,
215 enum object_type *typep)
216{
217 struct object *o = lookup_unknown_object(r, name);
218
219 if (o->type == OBJ_NONE) {
220 int type = odb_read_object_info(r->objects, name, NULL);
221 if (type < 0 || !object_as_type(o, type, 0))
222 return PEEL_INVALID;
223 }
224
225 if (o->type != OBJ_TAG) {
226 *typep = o->type;
227 return PEEL_NON_TAG;
228 }
229
230 while (o && o->type == OBJ_TAG) {
231 o = parse_object(r, &o->oid);
232 if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged) {
233 o = ((struct tag *)o)->tagged;
234
235 if (flags & PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE) {
236 int type = odb_read_object_info(r->objects, &o->oid, NULL);
237 if (type < 0 || !object_as_type(o, type, 0))
238 return PEEL_INVALID;
239 }
240 } else {
241 o = NULL;
242 }
243 }
244 if (!o)
245 return PEEL_INVALID;
246
247 oidcpy(oid, &o->oid);
248 *typep = o->type;
249 return PEEL_PEELED;
250}
251
252enum peel_status peel_object(struct repository *r,
253 const struct object_id *name,

Callers 2

peel_objectFunction · 0.85

Calls 5

lookup_unknown_objectFunction · 0.85
odb_read_object_infoFunction · 0.85
object_as_typeFunction · 0.85
parse_objectFunction · 0.85
oidcpyFunction · 0.85

Tested by

no test coverage detected