Git fork

odb: rename `has_object()`

Rename `has_object()` to `odb_has_object()` to match other functions
related to the object database and our modern coding guidelines.

Introduce a compatibility wrapper so that any in-flight topics will
continue to compile.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
fcf8e3e1 d4ff88ae

+87 -74
+1 -1
apply.c
··· 3204 3204 return 0; /* deletion patch */ 3205 3205 } 3206 3206 3207 - if (has_object(the_repository, &oid, 0)) { 3207 + if (odb_has_object(the_repository->objects, &oid, 0)) { 3208 3208 /* We already have the postimage */ 3209 3209 enum object_type type; 3210 3210 unsigned long size;
+2 -2
builtin/backfill.c
··· 67 67 return 0; 68 68 69 69 for (size_t i = 0; i < list->nr; i++) { 70 - if (!has_object(ctx->repo, &list->oid[i], 71 - OBJECT_INFO_FOR_PREFETCH)) 70 + if (!odb_has_object(ctx->repo->objects, &list->oid[i], 71 + OBJECT_INFO_FOR_PREFETCH)) 72 72 oid_array_append(&ctx->current_batch, &list->oid[i]); 73 73 } 74 74
+2 -2
builtin/cat-file.c
··· 160 160 goto cleanup; 161 161 162 162 case 'e': 163 - ret = !has_object(the_repository, &oid, 164 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR); 163 + ret = !odb_has_object(the_repository->objects, &oid, 164 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR); 165 165 goto cleanup; 166 166 167 167 case 'w':
+1 -1
builtin/clone.c
··· 506 506 continue; 507 507 if (ends_with(ref->name, "^{}")) 508 508 continue; 509 - if (!has_object(the_repository, &ref->old_oid, 0)) 509 + if (!odb_has_object(the_repository->objects, &ref->old_oid, 0)) 510 510 continue; 511 511 refs_update_ref(get_main_ref_store(the_repository), msg, 512 512 ref->name, &ref->old_oid, NULL, 0,
+9 -8
builtin/fetch.c
··· 366 366 */ 367 367 if (ends_with(ref->name, "^{}")) { 368 368 if (item && 369 - !has_object(the_repository, &ref->old_oid, 0) && 369 + !odb_has_object(the_repository->objects, &ref->old_oid, 0) && 370 370 !oidset_contains(&fetch_oids, &ref->old_oid) && 371 - !has_object(the_repository, &item->oid, 0) && 371 + !odb_has_object(the_repository->objects, &item->oid, 0) && 372 372 !oidset_contains(&fetch_oids, &item->oid)) 373 373 clear_item(item); 374 374 item = NULL; ··· 382 382 * fetch. 383 383 */ 384 384 if (item && 385 - !has_object(the_repository, &item->oid, 0) && 385 + !odb_has_object(the_repository->objects, &item->oid, 0) && 386 386 !oidset_contains(&fetch_oids, &item->oid)) 387 387 clear_item(item); 388 388 ··· 403 403 * checked to see if it needs fetching. 404 404 */ 405 405 if (item && 406 - !has_object(the_repository, &item->oid, 0) && 406 + !odb_has_object(the_repository->objects, &item->oid, 0) && 407 407 !oidset_contains(&fetch_oids, &item->oid)) 408 408 clear_item(item); 409 409 ··· 910 910 struct commit *current = NULL, *updated; 911 911 int fast_forward = 0; 912 912 913 - if (!has_object(the_repository, &ref->new_oid, 914 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 913 + if (!odb_has_object(the_repository->objects, &ref->new_oid, 914 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 915 915 die(_("object %s not found"), oid_to_hex(&ref->new_oid)); 916 916 917 917 if (oideq(&ref->old_oid, &ref->new_oid)) { ··· 1330 1330 * we need all direct targets to exist. 1331 1331 */ 1332 1332 for (r = rm; r; r = r->next) { 1333 - if (!has_object(the_repository, &r->old_oid, HAS_OBJECT_RECHECK_PACKED)) 1333 + if (!odb_has_object(the_repository->objects, &r->old_oid, 1334 + HAS_OBJECT_RECHECK_PACKED)) 1334 1335 return -1; 1335 1336 } 1336 1337 ··· 1485 1486 struct object_id oid; 1486 1487 if (repo_get_oid(the_repository, s, &oid)) 1487 1488 die(_("%s is not a valid object"), s); 1488 - if (!has_object(the_repository, &oid, 0)) 1489 + if (!odb_has_object(the_repository->objects, &oid, 0)) 1489 1490 die(_("the object %s does not exist"), s); 1490 1491 oid_array_append(oids, &oid); 1491 1492 continue;
+1 -1
builtin/fsck.c
··· 161 161 return 0; 162 162 163 163 if (!(obj->flags & HAS_OBJ)) { 164 - if (parent && !has_object(the_repository, &obj->oid, 1)) { 164 + if (parent && !odb_has_object(the_repository->objects, &obj->oid, 1)) { 165 165 printf_ln(_("broken link from %7s %s\n" 166 166 " to %7s %s"), 167 167 printable_type(&parent->oid, parent->type),
+2 -2
builtin/index-pack.c
··· 893 893 894 894 if (startup_info->have_repository) { 895 895 read_lock(); 896 - collision_test_needed = has_object(the_repository, oid, 897 - HAS_OBJECT_FETCH_PROMISOR); 896 + collision_test_needed = odb_has_object(the_repository->objects, oid, 897 + HAS_OBJECT_FETCH_PROMISOR); 898 898 read_unlock(); 899 899 } 900 900
+2 -2
builtin/pack-objects.c
··· 3968 3968 * Quietly ignore ALL missing objects. This avoids problems with 3969 3969 * staging them now and getting an odd error later. 3970 3970 */ 3971 - if (!has_object(the_repository, &obj->oid, 0)) 3971 + if (!odb_has_object(the_repository->objects, &obj->oid, 0)) 3972 3972 return; 3973 3973 3974 3974 show_object(obj, name, data); ··· 3982 3982 * Quietly ignore EXPECTED missing objects. This avoids problems with 3983 3983 * staging them now and getting an odd error later. 3984 3984 */ 3985 - if (!has_object(the_repository, &obj->oid, 0) && 3985 + if (!odb_has_object(the_repository->objects, &obj->oid, 0) && 3986 3986 is_promisor_object(to_pack.repo, &obj->oid)) 3987 3987 return; 3988 3988
+2 -2
builtin/receive-pack.c
··· 1509 1509 } 1510 1510 1511 1511 if (!is_null_oid(new_oid) && 1512 - !has_object(the_repository, new_oid, 1513 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 1512 + !odb_has_object(the_repository->objects, new_oid, 1513 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 1514 1514 error("unpack should have generated %s, " 1515 1515 "but I can't find it!", oid_to_hex(new_oid)); 1516 1516 ret = "bad pack";
+2 -2
builtin/remote.c
··· 454 454 info->status = PUSH_STATUS_UPTODATE; 455 455 else if (is_null_oid(&ref->old_oid)) 456 456 info->status = PUSH_STATUS_CREATE; 457 - else if (has_object(the_repository, &ref->old_oid, 458 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) && 457 + else if (odb_has_object(the_repository->objects, &ref->old_oid, 458 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) && 459 459 ref_newer(&ref->new_oid, &ref->old_oid)) 460 460 info->status = PUSH_STATUS_FASTFORWARD; 461 461 else
+2 -2
builtin/show-ref.c
··· 35 35 const char *hex; 36 36 struct object_id peeled; 37 37 38 - if (!has_object(the_repository, oid, 39 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 38 + if (!odb_has_object(the_repository->objects, oid, 39 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 40 40 die("git show-ref: bad ref %s (%s)", refname, 41 41 oid_to_hex(oid)); 42 42
+2 -2
builtin/unpack-objects.c
··· 449 449 delta_data = get_data(delta_size); 450 450 if (!delta_data) 451 451 return; 452 - if (has_object(the_repository, &base_oid, 453 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 452 + if (odb_has_object(the_repository->objects, &base_oid, 453 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 454 454 ; /* Ok we have this one */ 455 455 else if (resolve_against_held(nr, &base_oid, 456 456 delta_data, delta_size))
+2 -2
bulk-checkin.c
··· 130 130 static int already_written(struct bulk_checkin_packfile *state, struct object_id *oid) 131 131 { 132 132 /* The object may already exist in the repository */ 133 - if (has_object(the_repository, oid, 134 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 133 + if (odb_has_object(the_repository->objects, oid, 134 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 135 135 return 1; 136 136 137 137 /* Might want to keep the list sorted */
+8 -7
cache-tree.c
··· 239 239 if (!it) 240 240 return 0; 241 241 if (it->entry_count < 0 || 242 - has_object(the_repository, &it->oid, 243 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 242 + odb_has_object(the_repository->objects, &it->oid, 243 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 244 244 return 0; 245 245 for (i = 0; i < it->subtree_nr; i++) { 246 246 if (!cache_tree_fully_valid(it->down[i]->cache_tree)) ··· 292 292 } 293 293 294 294 if (0 <= it->entry_count && 295 - has_object(the_repository, &it->oid, 296 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 295 + odb_has_object(the_repository->objects, &it->oid, 296 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 297 297 return it->entry_count; 298 298 299 299 /* ··· 399 399 ce_missing_ok = mode == S_IFGITLINK || missing_ok || 400 400 !must_check_existence(ce); 401 401 if (is_null_oid(oid) || 402 - (!ce_missing_ok && !has_object(the_repository, oid, 403 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR))) { 402 + (!ce_missing_ok && 403 + !odb_has_object(the_repository->objects, oid, 404 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR))) { 404 405 strbuf_release(&buffer); 405 406 if (expected_missing) 406 407 return -1; ··· 448 449 struct object_id oid; 449 450 hash_object_file(the_hash_algo, buffer.buf, buffer.len, 450 451 OBJ_TREE, &oid); 451 - if (has_object(the_repository, &oid, HAS_OBJECT_RECHECK_PACKED)) 452 + if (odb_has_object(the_repository->objects, &oid, HAS_OBJECT_RECHECK_PACKED)) 452 453 oidcpy(&it->oid, &oid); 453 454 else 454 455 to_invalidate = 1;
+1 -1
commit-graph.c
··· 1040 1040 return NULL; 1041 1041 if (!search_commit_pos_in_graph(id, repo->objects->commit_graph, &pos)) 1042 1042 return NULL; 1043 - if (commit_graph_paranoia && !has_object(repo, id, 0)) 1043 + if (commit_graph_paranoia && !odb_has_object(repo->objects, id, 0)) 1044 1044 return NULL; 1045 1045 1046 1046 commit = lookup_commit(repo, id);
+1 -1
commit.c
··· 575 575 if (commit_graph_paranoia == -1) 576 576 commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0); 577 577 578 - if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) { 578 + if (commit_graph_paranoia && !odb_has_object(r->objects, &item->object.oid, 0)) { 579 579 unparse_commit(r, &item->object.oid); 580 580 return quiet_on_missing ? -1 : 581 581 error(_("commit %s exists in commit-graph but not in the object database"),
+4 -4
fetch-pack.c
··· 142 142 commit = lookup_commit_in_graph(the_repository, oid); 143 143 if (commit) { 144 144 if (mark_tags_complete_and_check_obj_db) { 145 - if (!has_object(the_repository, oid, 0)) 145 + if (!odb_has_object(the_repository->objects, oid, 0)) 146 146 die_in_commit_graph_only(oid); 147 147 } 148 148 return commit; ··· 770 770 if (!commit) { 771 771 struct object *o; 772 772 773 - if (!has_object(the_repository, &ref->old_oid, 0)) 773 + if (!odb_has_object(the_repository->objects, &ref->old_oid, 0)) 774 774 continue; 775 775 o = parse_object(the_repository, &ref->old_oid); 776 776 if (!o || o->type != OBJ_COMMIT) ··· 1984 1984 struct oid_array extra = OID_ARRAY_INIT; 1985 1985 struct object_id *oid = si->shallow->oid; 1986 1986 for (i = 0; i < si->shallow->nr; i++) 1987 - if (has_object(the_repository, &oid[i], 1988 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1987 + if (odb_has_object(the_repository->objects, &oid[i], 1988 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1989 1989 oid_array_append(&extra, &oid[i]); 1990 1990 if (extra.nr) { 1991 1991 setup_alternate_shallow(&shallow_lock,
+8 -6
http-push.c
··· 1447 1447 * may be required for updating server info later. 1448 1448 */ 1449 1449 if (repo->can_update_info_refs && 1450 - !has_object(the_repository, &ref->old_oid, 1451 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 1450 + !odb_has_object(the_repository->objects, &ref->old_oid, 1451 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 1452 1452 obj = lookup_unknown_object(the_repository, &ref->old_oid); 1453 1453 fprintf(stderr, " fetch %s for %s\n", 1454 1454 oid_to_hex(&ref->old_oid), refname); ··· 1653 1653 return error("Remote HEAD symrefs too deep"); 1654 1654 if (is_null_oid(&head_oid)) 1655 1655 return error("Unable to resolve remote HEAD"); 1656 - if (!has_object(the_repository, &head_oid, HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1656 + if (!odb_has_object(the_repository->objects, &head_oid, 1657 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1657 1658 return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", oid_to_hex(&head_oid)); 1658 1659 1659 1660 /* Remote branch must resolve to a known object */ 1660 1661 if (is_null_oid(&remote_ref->old_oid)) 1661 1662 return error("Unable to resolve remote branch %s", 1662 1663 remote_ref->name); 1663 - if (!has_object(the_repository, &remote_ref->old_oid, HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1664 + if (!odb_has_object(the_repository->objects, &remote_ref->old_oid, 1665 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 1664 1666 return error("Remote branch %s resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", remote_ref->name, oid_to_hex(&remote_ref->old_oid)); 1665 1667 1666 1668 /* Remote branch must be an ancestor of remote HEAD */ ··· 1881 1883 if (!force_all && 1882 1884 !is_null_oid(&ref->old_oid) && 1883 1885 !ref->force) { 1884 - if (!has_object(the_repository, &ref->old_oid, 1885 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) || 1886 + if (!odb_has_object(the_repository->objects, &ref->old_oid, 1887 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) || 1886 1888 !ref_newer(&ref->peer_ref->new_oid, 1887 1889 &ref->old_oid)) { 1888 1890 /*
+4 -4
http-walker.c
··· 138 138 list_for_each_safe(pos, tmp, head) { 139 139 obj_req = list_entry(pos, struct object_request, node); 140 140 if (obj_req->state == WAITING) { 141 - if (has_object(the_repository, &obj_req->oid, 142 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 141 + if (odb_has_object(the_repository->objects, &obj_req->oid, 142 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 143 143 obj_req->state = COMPLETE; 144 144 else { 145 145 start_object_request(obj_req); ··· 497 497 if (!obj_req) 498 498 return error("Couldn't find request for %s in the queue", hex); 499 499 500 - if (has_object(the_repository, &obj_req->oid, 501 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 500 + if (odb_has_object(the_repository->objects, &obj_req->oid, 501 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 502 502 if (obj_req->req) 503 503 abort_http_object_request(&obj_req->req); 504 504 abort_object_request(obj_req);
+2 -2
list-objects.c
··· 74 74 * of missing objects. 75 75 */ 76 76 if (ctx->revs->exclude_promisor_objects && 77 - !has_object(the_repository, &obj->oid, 78 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) && 77 + !odb_has_object(the_repository->objects, &obj->oid, 78 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) && 79 79 is_promisor_object(ctx->revs->repo, &obj->oid)) 80 80 return; 81 81
+2 -2
notes.c
··· 794 794 struct note_delete_list **l = (struct note_delete_list **) cb_data; 795 795 struct note_delete_list *n; 796 796 797 - if (has_object(the_repository, object_oid, 798 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 797 + if (odb_has_object(the_repository->objects, object_oid, 798 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 799 799 return 0; /* nothing to do for this note */ 800 800 801 801 /* failed to find object => prune this note */
+3 -3
odb.c
··· 871 871 char *co_buf; 872 872 873 873 hash_object_file(repo->hash_algo, buf, len, type, oid); 874 - if (has_object(repo, oid, 0) || 874 + if (odb_has_object(repo->objects, oid, 0) || 875 875 find_cached_object(repo->objects, oid)) 876 876 return 0; 877 877 ··· 953 953 } 954 954 } 955 955 956 - int has_object(struct repository *r, const struct object_id *oid, 956 + int odb_has_object(struct object_database *odb, const struct object_id *oid, 957 957 unsigned flags) 958 958 { 959 959 unsigned object_info_flags = 0; ··· 965 965 if (!(flags & HAS_OBJECT_FETCH_PROMISOR)) 966 966 object_info_flags |= OBJECT_INFO_SKIP_FETCH_OBJECT; 967 967 968 - return odb_read_object_info_extended(r->objects, oid, NULL, object_info_flags) >= 0; 968 + return odb_read_object_info_extended(odb, oid, NULL, object_info_flags) >= 0; 969 969 } 970 970 971 971 void odb_assert_oid_type(struct object_database *odb,
+10 -2
odb.h
··· 372 372 * Returns 1 if the object exists. This function will not lazily fetch objects 373 373 * in a partial clone by default. 374 374 */ 375 - int has_object(struct repository *r, const struct object_id *oid, 376 - unsigned flags); 375 + int odb_has_object(struct object_database *odb, 376 + const struct object_id *oid, 377 + unsigned flags); 377 378 378 379 void odb_assert_oid_type(struct object_database *odb, 379 380 const struct object_id *oid, enum object_type expect); ··· 461 462 unsigned long *size) 462 463 { 463 464 return odb_read_object(r->objects, oid, type, size); 465 + } 466 + 467 + static inline int has_object(struct repository *r, 468 + const struct object_id *oid, 469 + unsigned flags) 470 + { 471 + return odb_has_object(r->objects, oid, flags); 464 472 } 465 473 466 474 #endif /* ODB_H */
+1 -1
reflog.c
··· 152 152 init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size); 153 153 complete = 1; 154 154 while (tree_entry(&desc, &entry)) { 155 - if (!has_object(the_repository, &entry.oid, 155 + if (!odb_has_object(the_repository->objects, &entry.oid, 156 156 HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR) || 157 157 (S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) { 158 158 tree->object.flags |= INCOMPLETE;
+2 -1
refs.c
··· 376 376 { 377 377 if (flags & REF_ISBROKEN) 378 378 return 0; 379 - if (!has_object(repo, oid, HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 379 + if (!odb_has_object(repo->objects, oid, 380 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 380 381 error(_("%s does not point to a valid object!"), refname); 381 382 return 0; 382 383 }
+1 -1
remote.c
··· 1703 1703 if (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) { 1704 1704 if (starts_with(ref->name, "refs/tags/")) 1705 1705 reject_reason = REF_STATUS_REJECT_ALREADY_EXISTS; 1706 - else if (!has_object(the_repository, &ref->old_oid, HAS_OBJECT_RECHECK_PACKED)) 1706 + else if (!odb_has_object(the_repository->objects, &ref->old_oid, HAS_OBJECT_RECHECK_PACKED)) 1707 1707 reject_reason = REF_STATUS_REJECT_FETCH_FIRST; 1708 1708 else if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) || 1709 1709 !lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))
+1 -1
send-pack.c
··· 45 45 static void feed_object(struct repository *r, 46 46 const struct object_id *oid, FILE *fh, int negative) 47 47 { 48 - if (negative && !has_object(r, oid, 0)) 48 + if (negative && !odb_has_object(r->objects, oid, 0)) 49 49 return; 50 50 51 51 if (negative)
+6 -6
shallow.c
··· 310 310 if (graft->nr_parent != -1) 311 311 return 0; 312 312 if (data->flags & QUICK) { 313 - if (!has_object(the_repository, &graft->oid, 314 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 313 + if (!odb_has_object(the_repository->objects, &graft->oid, 314 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 315 315 return 0; 316 316 } else if (data->flags & SEEN_ONLY) { 317 317 struct commit *c = lookup_commit(the_repository, &graft->oid); ··· 477 477 ALLOC_ARRAY(info->ours, sa->nr); 478 478 ALLOC_ARRAY(info->theirs, sa->nr); 479 479 for (size_t i = 0; i < sa->nr; i++) { 480 - if (has_object(the_repository, sa->oid + i, 481 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 480 + if (odb_has_object(the_repository->objects, sa->oid + i, 481 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 482 482 struct commit_graft *graft; 483 483 graft = lookup_commit_graft(the_repository, 484 484 &sa->oid[i]); ··· 515 515 for (i = dst = 0; i < info->nr_theirs; i++) { 516 516 if (i != dst) 517 517 info->theirs[dst] = info->theirs[i]; 518 - if (has_object(the_repository, oid + info->theirs[i], 519 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 518 + if (odb_has_object(the_repository->objects, oid + info->theirs[i], 519 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) 520 520 dst++; 521 521 } 522 522 info->nr_theirs = dst;
+1 -1
upload-pack.c
··· 509 509 { 510 510 if (get_oid_hex(hex, oid)) 511 511 die("git upload-pack: expected SHA1 object, got '%s'", hex); 512 - if (!has_object(the_repository, oid, 0)) 512 + if (!odb_has_object(the_repository->objects, oid, 0)) 513 513 return -1; 514 514 return do_got_oid(data, oid); 515 515 }
+2 -2
walker.c
··· 150 150 return 0; 151 151 obj->flags |= SEEN; 152 152 153 - if (has_object(the_repository, &obj->oid, 154 - HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 153 + if (odb_has_object(the_repository->objects, &obj->oid, 154 + HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)) { 155 155 /* We already have it, so we should scan it now. */ 156 156 obj->flags |= TO_SCAN; 157 157 }