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

Function ref_resolves_to_object

refs.c:421–434  ·  view source on GitHub ↗

* Return true if refname, which has the specified oid and flags, can * be resolved to an object in the database. If the referred-to object * does not exist, emit a warning and return false. */

Source from the content-addressed store, hash-verified

419 * does not exist, emit a warning and return false.
420 */
421int ref_resolves_to_object(const char *refname,
422 struct repository *repo,
423 const struct object_id *oid,
424 unsigned int flags)
425{
426 if (flags & REF_ISBROKEN)
427 return 0;
428 if (!odb_has_object(repo->objects, oid,
429 ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR)) {
430 error(_("%s does not point to a valid object!"), refname);
431 return 0;
432 }
433 return 1;
434}
435
436char *refs_resolve_refdup(struct ref_store *refs,
437 const char *refname, int resolve_flags,

Callers 4

should_pack_refFunction · 0.85

Calls 2

odb_has_objectFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected