From: Junio C Hamano Date: Tue, 15 Jul 2025 22:18:17 +0000 (-0700) Subject: Merge branch 'ps/object-store' X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51b50c55a93205e8cf427a9c5f9c489c6b468542;p=thirdparty%2Fgit.git Merge branch 'ps/object-store' Code clean-up around object access API. * ps/object-store: odb: rename `read_object_with_reference()` odb: rename `pretend_object_file()` odb: rename `has_object()` odb: rename `repo_read_object_file()` odb: rename `oid_object_info()` odb: trivial refactorings to get rid of `the_repository` odb: get rid of `the_repository` when handling submodule sources odb: get rid of `the_repository` when handling the primary source odb: get rid of `the_repository` in `for_each()` functions odb: get rid of `the_repository` when handling alternates odb: get rid of `the_repository` in `odb_mkstemp()` odb: get rid of `the_repository` in `assert_oid_type()` odb: get rid of `the_repository` in `find_odb()` odb: introduce parent pointers object-store: rename files to "odb.{c,h}" object-store: rename `object_directory` to `odb_source` object-store: rename `raw_object_store` to `object_database` --- 51b50c55a93205e8cf427a9c5f9c489c6b468542 diff --cc builtin/cat-file.c index 4b23fcecbd,08afecbf57..2492a0b6f3 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@@ -489,17 -482,14 +487,17 @@@ static void batch_object_write(const ch data->info.sizep = &data->size; if (pack) - ret = packed_object_info(the_repository, pack, offset, - &data->info); + ret = packed_object_info(the_repository, pack, + offset, &data->info); else - ret = oid_object_info_extended(the_repository, - &data->oid, &data->info, - OBJECT_INFO_LOOKUP_REPLACE); + ret = odb_read_object_info_extended(the_repository->objects, + &data->oid, &data->info, + OBJECT_INFO_LOOKUP_REPLACE); if (ret < 0) { - report_object_status(opt, obj_name, &data->oid, "missing"); + if (data->mode == S_IFGITLINK) + report_object_status(opt, oid_to_hex(&data->oid), &data->oid, "submodule"); + else + report_object_status(opt, obj_name, &data->oid, "missing"); return; } @@@ -881,9 -870,10 +879,9 @@@ static int batch_objects(struct batch_o /* * Expand once with our special mark_query flag, which will prime the - * object_info to be handed to oid_object_info_extended for each + * object_info to be handed to odb_read_object_info_extended for each * object. */ - memset(&data, 0, sizeof(data)); data.mark_query = 1; expand_format(&output, opt->format ? opt->format : DEFAULT_FORMAT, diff --cc builtin/gc.c index 0a583912e3,ff551fab43..fab8f4dd4f --- a/builtin/gc.c +++ b/builtin/gc.c @@@ -1047,8 -1018,8 +1047,8 @@@ int cmd_gc(int argc } if (the_repository->settings.gc_write_commit_graph == 1) - write_commit_graph_reachable(the_repository->objects->odb, + write_commit_graph_reachable(the_repository->objects->sources, - !quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0, + !opts.quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0, NULL); if (opts.auto_flag && too_many_loose_objects(&cfg)) diff --cc builtin/prune.c index 320e9c2341,339017c7cc..d1c0ee1419 --- a/builtin/prune.c +++ b/builtin/prune.c @@@ -98,7 -99,8 +98,8 @@@ static int prune_object(const struct ob if (st.st_mtime > expire) return 0; if (show_only || verbose) { - enum object_type type = oid_object_info(revs->repo, oid, NULL); - enum object_type type = odb_read_object_info(the_repository->objects, - oid, NULL); ++ enum object_type type = ++ odb_read_object_info(revs->repo->objects, oid, NULL); printf("%s %s\n", oid_to_hex(oid), (type > 0) ? type_name(type) : "unknown"); }