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

Function check_has_commit

submodule.c:959–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957};
958
959static int check_has_commit(const struct object_id *oid, void *data)
960{
961 struct has_commit_data *cb = data;
962 struct repository subrepo;
963 enum object_type type;
964
965 if (repo_submodule_init(&subrepo, cb->repo, cb->path, cb->super_oid)) {
966 cb->result = 0;
967 /* subrepo failed to init, so don't clean it up. */
968 return 0;
969 }
970
971 type = odb_read_object_info(subrepo.objects, oid, NULL);
972
973 switch (type) {
974 case OBJ_COMMIT:
975 goto cleanup;
976 case OBJ_BAD:
977 /*
978 * Object is missing or invalid. If invalid, an error message
979 * has already been printed.
980 */
981 cb->result = 0;
982 goto cleanup;
983 default:
984 die(_("submodule entry '%s' (%s) is a %s, not a commit"),
985 cb->path, oid_to_hex(oid), type_name(type));
986 }
987cleanup:
988 repo_clear(&subrepo);
989 return 0;
990}
991
992static int submodule_has_commits(struct repository *r,
993 const char *path,

Callers

nothing calls this directly

Calls 6

repo_submodule_initFunction · 0.85
odb_read_object_infoFunction · 0.85
oid_to_hexFunction · 0.85
type_nameFunction · 0.85
repo_clearFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected