{"thread":{"id":"59404","subject":"[PATCH 00/17] cocci: remove \"the_index\" wrapper macros","startedAt":"2023-03-17T15:36:00Z","lastAt":"2023-03-30T18:08:32Z","messageCount":60,"participants":["Ævar Arnfjörð Bjarmason","Eric Sunshine","Junio C Hamano","Elijah Newren","Glen Choo","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":17},"messages":[{"id":"473633","messageId":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":null,"subject":"[PATCH 00/17] cocci: remove \"the_index\" wrapper macros","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:04Z","receivedAt":"2023-03-17T15:36:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In 2.40 the last use of \"USE_THE_INDEX_COMPATIBILITY_MACROS\" went\naway, this series does the same for our long-standing migration of\n\"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\".\n\nFor review the only interesting patches here are 01-04/17 and\n16-17/17, the rest are all a result of mechanically applying the\ncoccinelle rules incrementally on a header-by-header basis.\n\nFor 3x of those I made minor tweaks to the coccille output, because:\n\n * For whatever reason, it sometimes emits output that would fail\n   \"diff --check\".\n * It would produce very long lines in some cases, which have been\n   manually wrapped.\n * For the few that needed casts it wanted to add whitespace between\n   the closing \")\" and the function name, but the pre-image didn't use\n   that, so I adjusted it back.\n\nWhen merging this to \"seen\" there's a very trivial conflict in\ncommit.h, the resolution is to delete both sides:\n\t\n\tdiff --cc commit.h\n\tindex d4adf111019,d65f1e00145..00000000000\n\t--- a/commit.h\n\t+++ b/commit.h\n\t@@@ -193,7 -207,9 +195,13 @@@ void free_commit_list(struct commit_lis\n\t  \n\t  struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n\t  \n\t++<<<<<<< HEAD\n\t +int has_non_ascii(const char *text);\n\t++=======\n\t+ const char *logmsg_reencode(const struct commit *commit,\n\t+                           char **commit_encoding,\n\t+                           const char *output_encoding);\n\t++>>>>>>> origin/seen\n\t  const char *repo_logmsg_reencode(struct repository *r,\n\t                                 const struct commit *commit,\n\t                                 char **commit_encoding,\n\nBranch & CI for this at:\nhttps://github.com/avar/git/tree/avar/cocci-the-repository-from-pending\n\nÆvar Arnfjörð Bjarmason (17):\n  cocci: remove dead rule from \"the_repository.pending.cocci\"\n  cocci: fix incorrect & verbose \"the_repository\" rules\n  cocci: sort \"the_repository\" rules by header\n  cocci: add missing \"the_repository\" macros to \"pending\"\n  cocci: apply the \"cache.h\" part of \"the_repository.pending\"\n  cocci: apply the \"commit-reach.h\" part of \"the_repository.pending\"\n  cocci: apply the \"commit.h\" part of \"the_repository.pending\"\n  cocci: apply the \"diff.h\" part of \"the_repository.pending\"\n  cocci: apply the \"object-store.h\" part of \"the_repository.pending\"\n  cocci: apply the \"pretty.h\" part of \"the_repository.pending\"\n  cocci: apply the \"packfile.h\" part of \"the_repository.pending\"\n  cocci: apply the \"promisor-remote.h\" part of \"the_repository.pending\"\n  cocci: apply the \"refs.h\" part of \"the_repository.pending\"\n  cocci: apply the \"rerere.h\" part of \"the_repository.pending\"\n  cocci: apply the \"revision.h\" part of \"the_repository.pending\"\n  post-cocci: adjust comments for recent repo_* migration\n  libs: use \"struct repository *\" argument, not \"the_repository\"\n\n add-interactive.c                             |   2 +-\n add-patch.c                                   |   2 +-\n apply.c                                       |  13 +-\n archive.c                                     |  12 +-\n bisect.c                                      |  11 +-\n blame.c                                       |  15 +-\n branch.c                                      |   7 +-\n builtin/am.c                                  |  23 +--\n builtin/bisect.c                              |  33 ++--\n builtin/blame.c                               |  15 +-\n builtin/branch.c                              |   9 +-\n builtin/cat-file.c                            |  25 +--\n builtin/checkout.c                            |  35 ++--\n builtin/clone.c                               |   6 +-\n builtin/commit-tree.c                         |   4 +-\n builtin/commit.c                              |  29 ++--\n builtin/describe.c                            |   9 +-\n builtin/diff.c                                |   3 +-\n builtin/difftool.c                            |   3 +-\n builtin/fast-export.c                         |  12 +-\n builtin/fast-import.c                         |  17 +-\n builtin/fetch.c                               |  21 +--\n builtin/fsck.c                                |   2 +-\n builtin/gc.c                                  |   8 +-\n builtin/grep.c                                |   6 +-\n builtin/index-pack.c                          |  11 +-\n builtin/log.c                                 |  30 ++--\n builtin/ls-files.c                            |   4 +-\n builtin/ls-tree.c                             |   9 +-\n builtin/merge-base.c                          |   9 +-\n builtin/merge-recursive.c                     |   6 +-\n builtin/merge-tree.c                          |  18 ++-\n builtin/merge.c                               |  23 +--\n builtin/mktag.c                               |   3 +-\n builtin/name-rev.c                            |  11 +-\n builtin/notes.c                               |  34 ++--\n builtin/pack-objects.c                        |  24 ++-\n builtin/prune.c                               |   2 +-\n builtin/pull.c                                |   4 +-\n builtin/range-diff.c                          |  12 +-\n builtin/read-tree.c                           |   2 +-\n builtin/rebase.c                              |  21 +--\n builtin/receive-pack.c                        |  14 +-\n builtin/remote.c                              |   2 +-\n builtin/repack.c                              |   2 +-\n builtin/replace.c                             |  20 +--\n builtin/reset.c                               |  22 +--\n builtin/rev-list.c                            |   2 +-\n builtin/rev-parse.c                           |  18 ++-\n builtin/rm.c                                  |   2 +-\n builtin/shortlog.c                            |  13 +-\n builtin/show-branch.c                         |  19 +--\n builtin/show-ref.c                            |   6 +-\n builtin/sparse-checkout.c                     |   2 +-\n builtin/stash.c                               |  26 +--\n builtin/submodule--helper.c                   |   6 +-\n builtin/tag.c                                 |  10 +-\n builtin/unpack-file.c                         |   4 +-\n builtin/unpack-objects.c                      |   5 +-\n builtin/update-ref.c                          |   8 +-\n builtin/verify-commit.c                       |   2 +-\n builtin/verify-tag.c                          |   2 +-\n builtin/worktree.c                            |   8 +-\n bulk-checkin.c                                |   2 +-\n bundle.c                                      |   5 +-\n cache-tree.c                                  |  16 +-\n cache.h                                       |  19 +--\n checkout.c                                    |   2 +-\n combine-diff.c                                |   8 +-\n commit-graph.c                                |   4 +-\n commit-reach.c                                |  21 +--\n commit-reach.h                                |   9 --\n commit.c                                      |  44 ++---\n commit.h                                      |  22 +--\n connected.c                                   |   4 +-\n contrib/coccinelle/the_repository.cocci       | 123 ++++++++++++++\n .../coccinelle/the_repository.pending.cocci   | 128 ---------------\n delta-islands.c                               |   5 +-\n diff-lib.c                                    |   2 +-\n diff.c                                        |   6 +-\n diff.h                                        |   5 +-\n diffcore-break.c                              |   2 +-\n diffcore-rename.c                             |   4 +-\n dir.c                                         |   2 +-\n entry.c                                       |   3 +-\n fetch-pack.c                                  |   8 +-\n fmt-merge-msg.c                               |  15 +-\n fsck.c                                        |   6 +-\n http-push.c                                   |  16 +-\n http-walker.c                                 |   4 +-\n list-objects-filter-options.c                 |   7 +-\n list-objects.c                                |  20 ++-\n log-tree.c                                    |  28 ++--\n mailmap.c                                     |   4 +-\n match-trees.c                                 |   4 +-\n merge-blobs.c                                 |   6 +-\n merge-ort.c                                   |   6 +-\n merge-recursive.c                             |   9 +-\n negotiator/default.c                          |   6 +-\n negotiator/skipping.c                         |   2 +-\n notes-cache.c                                 |   5 +-\n notes-merge.c                                 |  11 +-\n notes-utils.c                                 |   2 +-\n notes.c                                       |  18 ++-\n object-file.c                                 |   4 +-\n object-name.c                                 |  19 ++-\n object-store.h                                |  11 +-\n pack-bitmap-write.c                           |   3 +-\n packfile.c                                    |   2 +-\n packfile.h                                    |   1 -\n parse-options-cb.c                            |   8 +-\n pretty.c                                      |  10 +-\n pretty.h                                      |   4 -\n promisor-remote.h                             |  15 --\n range-diff.c                                  |  12 +-\n read-cache.c                                  |   9 +-\n rebase-interactive.c                          |   2 +-\n ref-filter.c                                  |   8 +-\n reflog.c                                      |   7 +-\n refs.c                                        |   2 +-\n refs.h                                        |   6 -\n remote.c                                      |  15 +-\n rerere.c                                      |   5 +-\n rerere.h                                      |   3 -\n reset.c                                       |   4 +-\n revision.c                                    |  27 ++--\n revision.h                                    |   3 -\n send-pack.c                                   |   6 +-\n sequencer.c                                   | 150 ++++++++++--------\n shallow.c                                     |  21 +--\n strbuf.h                                      |   6 +-\n submodule-config.c                            |   5 +-\n submodule.c                                   |   8 +-\n t/helper/test-fast-rebase.c                   |  19 ++-\n t/helper/test-match-trees.c                   |   4 +-\n t/helper/test-oidmap.c                        |   6 +-\n t/helper/test-reach.c                         |  12 +-\n t/helper/test-revision-walking.c              |   3 +-\n t/helper/test-submodule-config.c              |   2 +-\n tag.c                                         |   9 +-\n transport-helper.c                            |   2 +-\n transport.c                                   |   3 +-\n tree.c                                        |   5 +-\n unpack-trees.c                                |   2 +-\n upload-pack.c                                 |   8 +-\n walker.c                                      |   6 +-\n wt-status.c                                   |  21 +--\n xdiff-interface.c                             |   2 +-\n 148 files changed, 958 insertions(+), 873 deletions(-)\n create mode 100644 contrib/coccinelle/the_repository.cocci\n delete mode 100644 contrib/coccinelle/the_repository.pending.cocci\n\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473634","messageId":"patch-02.17-1b1fc5d41f5-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:06Z","receivedAt":"2023-03-17T15:36:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"When these rules started being added in [1] they didn't use a \";\"\nafter the \")\", and would thus catch uses of these macros within\nexpressions. But as of [2] the new additions were broken in that\nthey'd only match a subset of the users of these macros.\n\nRather than narrowly fixing that, let's have these use the much less\nverbose pattern introduced in my recent [3]: There's no need to\nexhaustively enumerate arguments if we use the \"...\" syntax. This\nmeans that we can fold all of these different rules into one.\n\n1. afd69dcc219 (object-store: prepare read_object_file to deal with\n   any repo, 2018-11-13)\n2. 21a9651ba3f (commit-reach: prepare get_merge_bases to handle any\n   repo, 2018-11-13)\n3. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,\n   2022-11-19)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 160 +++++-------------\n 1 file changed, 46 insertions(+), 114 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 23b97536da5..99e192736ee 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -3,118 +3,50 @@\n // our code base.\n \n @@\n-expression E;\n-expression F;\n-expression G;\n @@\n-- read_object_file(\n-+ repo_read_object_file(the_repository,\n-  E, F, G)\n-\n-@@\n-expression E;\n-@@\n-- has_object_file(\n-+ repo_has_object_file(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-@@\n-- has_object_file_with_flags(\n-+ repo_has_object_file_with_flags(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- parse_commit_internal(\n-+ repo_parse_commit_internal(the_repository,\n-  E, F, G)\n-\n-@@\n-expression E;\n-@@\n-- parse_commit(\n-+ repo_parse_commit(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- get_merge_bases(\n-+ repo_get_merge_bases(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- get_merge_bases_many(\n-+ repo_get_merge_bases_many(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- get_merge_bases_many_dirty(\n-+ repo_get_merge_bases_many_dirty(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- in_merge_bases(\n-+ repo_in_merge_bases(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- in_merge_bases_many(\n-+ repo_in_merge_bases_many(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- get_commit_buffer(\n-+ repo_get_commit_buffer(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- unuse_commit_buffer(\n-+ repo_unuse_commit_buffer(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- logmsg_reencode(\n-+ repo_logmsg_reencode(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-expression H;\n-@@\n-- format_commit_message(\n-+ repo_format_commit_message(the_repository,\n-  E, F, G, H);\n+(\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n+|\n+- get_merge_bases\n++ repo_get_merge_bases\n+|\n+- get_merge_bases_many\n++ repo_get_merge_bases_many\n+|\n+- get_merge_bases_many_dirty\n++ repo_get_merge_bases_many_dirty\n+|\n+- in_merge_bases\n++ repo_in_merge_bases\n+|\n+- in_merge_bases_many\n++ repo_in_merge_bases_many\n+|\n+- get_commit_buffer\n++ repo_get_commit_buffer\n+|\n+- unuse_commit_buffer\n++ repo_unuse_commit_buffer\n+|\n+- logmsg_reencode\n++ repo_logmsg_reencode\n+|\n+- format_commit_message\n++ repo_format_commit_message\n+)\n+  (\n++ the_repository,\n+  ...)\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473635","messageId":"patch-01.17-c167bde3c0c-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 01/17] cocci: remove dead rule from \"the_repository.pending.cocci\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:05Z","receivedAt":"2023-03-17T15:36:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The \"parse_commit_gently\" macro went away in [1], so we don't need to\ncarry his for its migration.\n\n1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n   commits, 2020-06-23)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/coccinelle/the_repository.pending.cocci | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 747d382ff5f..23b97536da5 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -34,14 +34,6 @@ expression G;\n + repo_parse_commit_internal(the_repository,\n   E, F, G)\n \n-@@\n-expression E;\n-expression F;\n-@@\n-- parse_commit_gently(\n-+ repo_parse_commit_gently(the_repository,\n-  E, F)\n-\n @@\n expression E;\n @@\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473636","messageId":"patch-03.17-34c6b8afd6c-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 03/17] cocci: sort \"the_repository\" rules by header","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:07Z","receivedAt":"2023-03-17T15:36:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Sort the \"the_repository.pending.cocci\" file by which header the\nmacros are in, and add a comment to that effect in front of the\nrules. This will make subsequent commits easier to follow, as we'll be\napplying these rules on a header-by-header basis.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 34 +++++++++++--------\n 1 file changed, 19 insertions(+), 15 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 99e192736ee..84b79dce480 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,21 +5,7 @@\n @@\n @@\n (\n-- read_object_file\n-+ repo_read_object_file\n-|\n-- has_object_file\n-+ repo_has_object_file\n-|\n-- has_object_file_with_flags\n-+ repo_has_object_file_with_flags\n-|\n-- parse_commit_internal\n-+ repo_parse_commit_internal\n-|\n-- parse_commit\n-+ repo_parse_commit\n-|\n+// commit-reach.h\n - get_merge_bases\n + repo_get_merge_bases\n |\n@@ -34,6 +20,13 @@\n |\n - in_merge_bases_many\n + repo_in_merge_bases_many\n+// commit.h\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n |\n - get_commit_buffer\n + repo_get_commit_buffer\n@@ -43,6 +36,17 @@\n |\n - logmsg_reencode\n + repo_logmsg_reencode\n+// object-store.h\n+|\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n+// pretty.h\n |\n - format_commit_message\n + repo_format_commit_message\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473637","messageId":"patch-04.17-4b62e9a35a9-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 04/17] cocci: add missing \"the_repository\" macros to \"pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:08Z","receivedAt":"2023-03-17T15:36:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In the case of diff.h, rerere.h and revision.h the macros were added\nin [1], [2] and [3] when \"the_repository.pending.cocci\" didn't\nexist. None of the subsequently added migration rules covered\nthem. Let's add those missing rules.\n\nIn the case of macros in \"cache.h\", \"commit.h\", \"packfile.h\",\n\"promisor-remote.h\" and \"refs.h\" those aren't guarded by\n\"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\", but they're also macros that\nadd \"the_repository\" as the first argument, so we should migrate away\nfrom them.\n\n1. 2abf3503854 (revision.c: remove implicit dependency on the_index,\n   2018-09-21)\n2. e6757652350 (diff.c: remove implicit dependency on the_index,\n   2018-09-21)\n3. 35843b1123e (rerere.c: remove implicit dependency on the_index,\n   2018-09-21)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 70 +++++++++++++++++++\n 1 file changed, 70 insertions(+)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 84b79dce480..8b3f2580e6b 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,7 +5,44 @@\n @@\n @@\n (\n+// cache.h\n+- get_oid\n++ repo_get_oid\n+|\n+- get_oid_commit\n++ repo_get_oid_commit\n+|\n+- get_oid_committish\n++ repo_get_oid_committish\n+|\n+- get_oid_tree\n++ repo_get_oid_tree\n+|\n+- get_oid_treeish\n++ repo_get_oid_treeish\n+|\n+- get_oid_blob\n++ repo_get_oid_blob\n+|\n+- get_oid_mb\n++ repo_get_oid_mb\n+|\n+- find_unique_abbrev\n++ repo_find_unique_abbrev\n+|\n+- find_unique_abbrev_r\n++ repo_find_unique_abbrev_r\n+|\n+- for_each_abbrev\n++ repo_for_each_abbrev\n+|\n+- interpret_branch_name\n++ repo_interpret_branch_name\n+|\n+- peel_to_type\n++ repo_peel_to_type\n // commit-reach.h\n+|\n - get_merge_bases\n + repo_get_merge_bases\n |\n@@ -36,6 +73,13 @@\n |\n - logmsg_reencode\n + repo_logmsg_reencode\n+|\n+- get_commit_tree\n++ repo_get_commit_tree\n+// diff.h\n+|\n+- diff_setup\n++ repo_diff_setup\n // object-store.h\n |\n - read_object_file\n@@ -50,6 +94,32 @@\n |\n - format_commit_message\n + repo_format_commit_message\n+// packfile.h\n+|\n+- approximate_object_count\n++ repo_approximate_object_count\n+// promisor-remote.h\n+|\n+- promisor_remote_reinit\n++ repo_promisor_remote_reinit\n+|\n+- promisor_remote_find\n++ repo_promisor_remote_find\n+|\n+- has_promisor_remote\n++ repo_has_promisor_remote\n+// refs.h\n+|\n+- dwim_ref\n++ repo_dwim_ref\n+// rerere.h\n+|\n+- rerere\n++ repo_rerere\n+// revision.h\n+|\n+- init_revisions\n++ repo_init_revisions\n )\n   (\n + the_repository,\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473638","messageId":"patch-08.17-6c5f4861471-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 08/17] cocci: apply the \"diff.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:12Z","receivedAt":"2023-03-17T15:36:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"diff.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/log.c                                   | 2 +-\n builtin/rebase.c                                | 2 +-\n builtin/stash.c                                 | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n diff.h                                          | 3 ---\n log-tree.c                                      | 2 +-\n range-diff.c                                    | 2 +-\n 8 files changed, 9 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex f249aca049a..b76a1c82d8f 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1371,7 +1371,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,\n \t\t\t.other_arg = &other_arg\n \t\t};\n \n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.file = rev->diffopt.file;\n \t\topts.use_color = rev->diffopt.use_color;\n \t\tdiff_setup_done(&opts);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex eba48bffaad..76cce94373e 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1786,7 +1786,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \n \t\t/* We want color (if set), but no pager */\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.stat_width = -1; /* use full terminal width */\n \t\topts.stat_graph_width = -1; /* respect statGraphWidth config */\n \t\topts.output_format |=\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex ed1275829e7..6c062e52048 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -427,7 +427,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)\n \t * to the index before a merge was run) and the current index\n \t * (reflecting the changes brought in by the merge).\n \t */\n-\tdiff_setup(&diff_opts);\n+\trepo_diff_setup(the_repository, &diff_opts);\n \tdiff_opts.flags.recursive = 1;\n \tdiff_opts.detect_rename = 0;\n \tdiff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 0cdf3f46304..3c0bd8781e7 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -73,6 +73,10 @@\n |\n - get_commit_tree\n + repo_get_commit_tree\n+// diff.h\n+|\n+- diff_setup\n++ repo_diff_setup\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex bf19e6a2487..00461ee86b3 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// diff.h\n-- diff_setup\n-+ repo_diff_setup\n // object-store.h\n-|\n - read_object_file\n + repo_read_object_file\n |\ndiff --git a/diff.h b/diff.h\nindex 8d770b1d579..8b510eb579d 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -535,9 +535,6 @@ int git_diff_basic_config(const char *var, const char *value, void *cb);\n int git_diff_heuristic_config(const char *var, const char *value, void *cb);\n void init_diff_ui_defaults(void);\n int git_diff_ui_config(const char *var, const char *value, void *cb);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define diff_setup(diffopts) repo_diff_setup(the_repository, diffopts)\n-#endif\n void repo_diff_setup(struct repository *, struct diff_options *);\n struct option *add_diff_options(const struct option *, struct diff_options *);\n int diff_opt_parse(struct diff_options *, const char **, int, const char *);\ndiff --git a/log-tree.c b/log-tree.c\nindex 4bebb86ecac..1bd4d6ab008 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -849,7 +849,7 @@ void show_log(struct rev_info *opt)\n \t\t * Pass minimum required diff-options to range-diff; others\n \t\t * can be added later if deemed desirable.\n \t\t */\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.file = opt->diffopt.file;\n \t\topts.use_color = opt->diffopt.use_color;\n \t\tdiff_setup_done(&opts);\ndiff --git a/range-diff.c b/range-diff.c\nindex 5bcf966f6c5..15d0bc35a87 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -485,7 +485,7 @@ static void output(struct string_list *a, struct string_list *b,\n \tif (range_diff_opts->diffopt)\n \t\tmemcpy(&opts, range_diff_opts->diffopt, sizeof(opts));\n \telse\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \n \topts.no_free = 1;\n \tif (!opts.output_format)\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473639","messageId":"patch-06.17-b06ea9861fd-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 06/17] cocci: apply the \"commit-reach.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:10Z","receivedAt":"2023-03-17T15:36:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"commit-reach.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n bisect.c                                        |  3 ++-\n builtin/branch.c                                |  5 +++--\n builtin/fast-import.c                           |  2 +-\n builtin/fetch.c                                 |  3 ++-\n builtin/log.c                                   | 10 +++++++---\n builtin/merge-base.c                            |  5 +++--\n builtin/merge-tree.c                            |  3 ++-\n builtin/merge.c                                 |  7 +++++--\n builtin/rebase.c                                |  5 +++--\n builtin/receive-pack.c                          |  2 +-\n builtin/rev-parse.c                             |  2 +-\n commit-reach.c                                  |  3 ++-\n commit-reach.h                                  |  9 ---------\n commit.c                                        |  3 ++-\n contrib/coccinelle/the_repository.cocci         | 16 ++++++++++++++++\n contrib/coccinelle/the_repository.pending.cocci | 16 ----------------\n http-push.c                                     |  2 +-\n log-tree.c                                      |  2 +-\n merge-ort.c                                     |  2 +-\n merge-recursive.c                               |  2 +-\n notes-merge.c                                   |  2 +-\n remote.c                                        |  2 +-\n revision.c                                      |  4 ++--\n sequencer.c                                     |  3 ++-\n shallow.c                                       |  9 +++++----\n t/helper/test-reach.c                           | 10 +++++++---\n 26 files changed, 72 insertions(+), 60 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex ef5ee5a6436..3088516e174 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -846,7 +846,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int\n \tenum bisect_error res = BISECT_OK;\n \tstruct commit_list *result;\n \n-\tresult = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);\n+\tresult = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,\n+\t\t\t\t\t   rev + 1);\n \n \tfor (; result; result = result->next) {\n \t\tconst struct object_id *mb = &result->item->object.oid;\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 968ea03c059..bbcfb34b3c6 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -150,7 +150,8 @@ static int branch_merged(int kind, const char *name,\n \tif (!reference_rev)\n \t\treference_rev = head_rev;\n \n-\tmerged = reference_rev ? in_merge_bases(rev, reference_rev) : 0;\n+\tmerged = reference_rev ? repo_in_merge_bases(the_repository, rev,\n+\t\t\t\t\t\t     reference_rev) : 0;\n \n \t/*\n \t * After the safety valve is fully redefined to \"check with\n@@ -160,7 +161,7 @@ static int branch_merged(int kind, const char *name,\n \t * a gentle reminder is in order.\n \t */\n \tif ((head_rev != reference_rev) &&\n-\t    (head_rev ? in_merge_bases(rev, head_rev) : 0) != merged) {\n+\t    (head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {\n \t\tif (merged)\n \t\t\twarning(_(\"deleting branch '%s' that has been merged to\\n\"\n \t\t\t\t\"         '%s', but not yet merged to HEAD.\"),\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f533b768efb..2098c0c5a37 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1625,7 +1625,7 @@ static int update_branch(struct branch *b)\n \t\tif (!old_cmit || !new_cmit)\n \t\t\treturn error(\"Branch %s is missing commits.\", b->name);\n \n-\t\tif (!in_merge_bases(old_cmit, new_cmit)) {\n+\t\tif (!repo_in_merge_bases(the_repository, old_cmit, new_cmit)) {\n \t\t\twarning(\"Not updating %s\"\n \t\t\t\t\" (new tip %s does not contain %s)\",\n \t\t\t\tb->name, oid_to_hex(&b->oid),\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 80cf1d01583..db8815032fc 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -965,7 +965,8 @@ static int update_local_ref(struct ref *ref,\n \n \tif (fetch_show_forced_updates) {\n \t\tuint64_t t_before = getnanotime();\n-\t\tfast_forward = in_merge_bases(current, updated);\n+\t\tfast_forward = repo_in_merge_bases(the_repository, current,\n+\t\t\t\t\t\t   updated);\n \t\tforced_updates_ms += (getnanotime() - t_before) / 1000000;\n \t} else {\n \t\tfast_forward = 1;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b4c38f6ad87..5604b4b5f05 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1649,7 +1649,9 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\t\t\t\treturn NULL;\n \t\t\t}\n \t\t\tcommit = lookup_commit_or_die(&oid, \"upstream base\");\n-\t\t\tbase_list = get_merge_bases_many(commit, total, list);\n+\t\t\tbase_list = repo_get_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t      commit, total,\n+\t\t\t\t\t\t\t      list);\n \t\t\t/* There should be one and only one merge base. */\n \t\t\tif (!base_list || base_list->next) {\n \t\t\t\tif (die_on_failure) {\n@@ -1683,7 +1685,9 @@ static struct commit *get_base_commit(const char *base_commit,\n \twhile (rev_nr > 1) {\n \t\tfor (i = 0; i < rev_nr / 2; i++) {\n \t\t\tstruct commit_list *merge_base;\n-\t\t\tmerge_base = get_merge_bases(rev[2 * i], rev[2 * i + 1]);\n+\t\t\tmerge_base = repo_get_merge_bases(the_repository,\n+\t\t\t\t\t\t\t  rev[2 * i],\n+\t\t\t\t\t\t\t  rev[2 * i + 1]);\n \t\t\tif (!merge_base || merge_base->next) {\n \t\t\t\tif (die_on_failure) {\n \t\t\t\t\tdie(_(\"failed to find exact merge base\"));\n@@ -1701,7 +1705,7 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\trev_nr = DIV_ROUND_UP(rev_nr, 2);\n \t}\n \n-\tif (!in_merge_bases(base, rev[0])) {\n+\tif (!repo_in_merge_bases(the_repository, base, rev[0])) {\n \t\tif (die_on_failure) {\n \t\t\tdie(_(\"base commit should be the ancestor of revision list\"));\n \t\t} else {\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 688d5c29b76..64d29136d16 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -13,7 +13,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)\n {\n \tstruct commit_list *result, *r;\n \n-\tresult = get_merge_bases_many_dirty(rev[0], rev_nr - 1, rev + 1);\n+\tresult = repo_get_merge_bases_many_dirty(the_repository, rev[0],\n+\t\t\t\t\t\t rev_nr - 1, rev + 1);\n \n \tif (!result)\n \t\treturn 1;\n@@ -105,7 +106,7 @@ static int handle_is_ancestor(int argc, const char **argv)\n \t\tdie(\"--is-ancestor takes exactly two commits\");\n \tone = get_commit_reference(argv[0]);\n \ttwo = get_commit_reference(argv[1]);\n-\tif (in_merge_bases(one, two))\n+\tif (repo_in_merge_bases(the_repository, one, two))\n \t\treturn 0;\n \telse\n \t\treturn 1;\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 828dc81c426..4e4a9d6ba17 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -452,7 +452,8 @@ static int real_merge(struct merge_tree_options *o,\n \t\t * Get the merge bases, in reverse order; see comment above\n \t\t * merge_incore_recursive in merge-ort.h\n \t\t */\n-\t\tmerge_bases = get_merge_bases(parent1, parent2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, parent1,\n+\t\t\t\t\t\t   parent2);\n \t\tif (!merge_bases && !o->allow_unrelated_histories)\n \t\t\tdie(_(\"refusing to merge unrelated histories\"));\n \t\tmerge_bases = reverse_commit_list(merge_bases);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 7331a0cd911..c5a9321806d 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1531,7 +1531,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \tif (!remoteheads)\n \t\t; /* already up-to-date */\n \telse if (!remoteheads->next)\n-\t\tcommon = get_merge_bases(head_commit, remoteheads->item);\n+\t\tcommon = repo_get_merge_bases(the_repository, head_commit,\n+\t\t\t\t\t      remoteheads->item);\n \telse {\n \t\tstruct commit_list *list = remoteheads;\n \t\tcommit_list_insert(head_commit, &list);\n@@ -1649,7 +1650,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t * merge_bases again, otherwise \"git merge HEAD^\n \t\t\t * HEAD^^\" would be missed.\n \t\t\t */\n-\t\t\tcommon_one = get_merge_bases(head_commit, j->item);\n+\t\t\tcommon_one = repo_get_merge_bases(the_repository,\n+\t\t\t\t\t\t\t  head_commit,\n+\t\t\t\t\t\t\t  j->item);\n \t\t\tif (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {\n \t\t\t\tup_to_date = 0;\n \t\t\t\tbreak;\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex d5358ca89d2..5fd7bfb4860 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -882,7 +882,7 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,\n \tif (!upstream)\n \t\tgoto done;\n \n-\tmerge_bases = get_merge_bases(upstream, head);\n+\tmerge_bases = repo_get_merge_bases(the_repository, upstream, head);\n \tif (!merge_bases || merge_bases->next)\n \t\tgoto done;\n \n@@ -901,7 +901,8 @@ static void fill_branch_base(struct rebase_options *options,\n {\n \tstruct commit_list *merge_bases = NULL;\n \n-\tmerge_bases = get_merge_bases(options->onto, options->orig_head);\n+\tmerge_bases = repo_get_merge_bases(the_repository, options->onto,\n+\t\t\t\t\t   options->orig_head);\n \tif (!merge_bases || merge_bases->next)\n \t\toidcpy(branch_base, null_oid());\n \telse\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex b5816624d25..6d4fc1368a4 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1548,7 +1548,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)\n \t\t}\n \t\told_commit = (struct commit *)old_object;\n \t\tnew_commit = (struct commit *)new_object;\n-\t\tif (!in_merge_bases(old_commit, new_commit)) {\n+\t\tif (!repo_in_merge_bases(the_repository, old_commit, new_commit)) {\n \t\t\trp_error(\"denying non-fast-forward %s\"\n \t\t\t\t \" (you should pull first)\", name);\n \t\t\tret = \"non-fast-forward\";\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex eb53a303de6..5685cf0ea7d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -292,7 +292,7 @@ static int try_difference(const char *arg)\n \t\t\t\t*dotdot = '.';\n \t\t\t\treturn 0;\n \t\t\t}\n-\t\t\texclude = get_merge_bases(a, b);\n+\t\t\texclude = repo_get_merge_bases(the_repository, a, b);\n \t\t\twhile (exclude) {\n \t\t\t\tstruct commit *commit = pop_commit(&exclude);\n \t\t\t\tshow_rev(REVERSED, &commit->object.oid, NULL);\ndiff --git a/commit-reach.c b/commit-reach.c\nindex 2e33c599a82..a4b9eda723f 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -162,7 +162,8 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)\n \n \t\tfor (j = ret; j; j = j->next) {\n \t\t\tstruct commit_list *bases;\n-\t\t\tbases = get_merge_bases(i->item, j->item);\n+\t\t\tbases = repo_get_merge_bases(the_repository, i->item,\n+\t\t\t\t\t\t     j->item);\n \t\t\tif (!new_commits)\n \t\t\t\tnew_commits = bases;\n \t\t\telse\ndiff --git a/commit-reach.h b/commit-reach.h\nindex 148b56fea50..94a96e03299 100644\n--- a/commit-reach.h\n+++ b/commit-reach.h\n@@ -19,11 +19,6 @@ struct commit_list *repo_get_merge_bases_many(struct repository *r,\n struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,\n \t\t\t\t\t\t    struct commit *one, int n,\n \t\t\t\t\t\t    struct commit **twos);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define get_merge_bases(r1, r2)           repo_get_merge_bases(the_repository, r1, r2)\n-#define get_merge_bases_many(one, n, two) repo_get_merge_bases_many(the_repository, one, n, two)\n-#define get_merge_bases_many_dirty(one, n, twos) repo_get_merge_bases_many_dirty(the_repository, one, n, twos)\n-#endif\n \n struct commit_list *get_octopus_merge_bases(struct commit_list *in);\n \n@@ -36,10 +31,6 @@ int repo_in_merge_bases(struct repository *r,\n int repo_in_merge_bases_many(struct repository *r,\n \t\t\t     struct commit *commit,\n \t\t\t     int nr_reference, struct commit **reference);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define in_merge_bases(c1, c2) repo_in_merge_bases(the_repository, c1, c2)\n-#define in_merge_bases_many(c1, n, cs) repo_in_merge_bases_many(the_repository, c1, n, cs)\n-#endif\n \n /*\n  * Takes a list of commits and returns a new list where those\ndiff --git a/commit.c b/commit.c\nindex 06a7c728e80..62682f55643 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -1014,7 +1014,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)\n \tfor (i = 0; i < revs.nr; i++)\n \t\trevs.commit[i]->object.flags &= ~TMP_MARK;\n \n-\tbases = get_merge_bases_many(commit, revs.nr, revs.commit);\n+\tbases = repo_get_merge_bases_many(the_repository, commit, revs.nr,\n+\t\t\t\t\t  revs.commit);\n \n \t/*\n \t * There should be one and only one merge base, when we found\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex dcdba314fc2..1ab63f0196b 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -38,6 +38,22 @@\n |\n - peel_to_type\n + repo_peel_to_type\n+// commit-reach.h\n+|\n+- get_merge_bases\n++ repo_get_merge_bases\n+|\n+- get_merge_bases_many\n++ repo_get_merge_bases_many\n+|\n+- get_merge_bases_many_dirty\n++ repo_get_merge_bases_many_dirty\n+|\n+- in_merge_bases\n++ repo_in_merge_bases\n+|\n+- in_merge_bases_many\n++ repo_in_merge_bases_many\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 2d200ab83e7..e9209fc0cc4 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,23 +5,7 @@\n @@\n @@\n (\n-// commit-reach.h\n-- get_merge_bases\n-+ repo_get_merge_bases\n-|\n-- get_merge_bases_many\n-+ repo_get_merge_bases_many\n-|\n-- get_merge_bases_many_dirty\n-+ repo_get_merge_bases_many_dirty\n-|\n-- in_merge_bases\n-+ repo_in_merge_bases\n-|\n-- in_merge_bases_many\n-+ repo_in_merge_bases_many\n // commit.h\n-|\n - parse_commit_internal\n + repo_parse_commit_internal\n |\ndiff --git a/http-push.c b/http-push.c\nindex 7f71316456c..ceab00bd901 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1570,7 +1570,7 @@ static int verify_merge_base(struct object_id *head_oid, struct ref *remote)\n \tstruct commit *branch = lookup_commit_or_die(&remote->old_oid,\n \t\t\t\t\t\t     remote->name);\n \n-\treturn in_merge_bases(branch, head);\n+\treturn repo_in_merge_bases(the_repository, branch, head);\n }\n \n static int delete_remote_branch(const char *pattern, int force)\ndiff --git a/log-tree.c b/log-tree.c\nindex f36adb947e8..4bebb86ecac 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -993,7 +993,7 @@ static int do_remerge_diff(struct rev_info *opt,\n \t/* Parse the relevant commits and get the merge bases */\n \tparse_commit_or_die(parent1);\n \tparse_commit_or_die(parent2);\n-\tbases = get_merge_bases(parent1, parent2);\n+\tbases = repo_get_merge_bases(the_repository, parent1, parent2);\n \n \t/* Re-merge the parents */\n \tmerge_incore_recursive(&o, bases, parent1, parent2, &res);\ndiff --git a/merge-ort.c b/merge-ort.c\nindex d1611ca400a..e9f8bd15982 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5017,7 +5017,7 @@ static void merge_ort_internal(struct merge_options *opt,\n \tstruct strbuf merge_base_abbrev = STRBUF_INIT;\n \n \tif (!merge_bases) {\n-\t\tmerge_bases = get_merge_bases(h1, h2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, h1, h2);\n \t\t/* See merge-ort.h:merge_incore_recursive() declaration NOTE */\n \t\tmerge_bases = reverse_commit_list(merge_bases);\n \t}\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex ae469f8cc81..9771ef540c4 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3592,7 +3592,7 @@ static int merge_recursive_internal(struct merge_options *opt,\n \t}\n \n \tif (!merge_bases) {\n-\t\tmerge_bases = get_merge_bases(h1, h2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, h1, h2);\n \t\tmerge_bases = reverse_commit_list(merge_bases);\n \t}\n \ndiff --git a/notes-merge.c b/notes-merge.c\nindex d290c7478e2..fca9422a294 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -600,7 +600,7 @@ int notes_merge(struct notes_merge_options *o,\n \tassert(local && remote);\n \n \t/* Find merge bases */\n-\tbases = get_merge_bases(local, remote);\n+\tbases = repo_get_merge_bases(the_repository, local, remote);\n \tif (!bases) {\n \t\tbase_oid = null_oid();\n \t\tbase_tree_oid = the_hash_algo->empty_tree;\ndiff --git a/remote.c b/remote.c\nindex ff9b0238318..71b1ae2db05 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2662,7 +2662,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote)\n \t\tif (MERGE_BASES_BATCH_SIZE < size)\n \t\t\tsize = MERGE_BASES_BATCH_SIZE;\n \n-\t\tif ((ret = in_merge_bases_many(commit, size, chunk)))\n+\t\tif ((ret = repo_in_merge_bases_many(the_repository, commit, size, chunk)))\n \t\t\tbreak;\n \t}\n \ndiff --git a/revision.c b/revision.c\nindex 0f775ee2e90..c2b7b2f1073 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1957,7 +1957,7 @@ static void prepare_show_merge(struct rev_info *revs)\n \tother = lookup_commit_or_die(&oid, \"MERGE_HEAD\");\n \tadd_pending_object(revs, &head->object, \"HEAD\");\n \tadd_pending_object(revs, &other->object, \"MERGE_HEAD\");\n-\tbases = get_merge_bases(head, other);\n+\tbases = repo_get_merge_bases(the_repository, head, other);\n \tadd_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);\n \tadd_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);\n \tfree_commit_list(bases);\n@@ -2052,7 +2052,7 @@ static int handle_dotdot_1(const char *arg, char *dotdot,\n \t\tif (!a || !b)\n \t\t\treturn dotdot_missing(arg, dotdot, revs, symmetric);\n \n-\t\texclude = get_merge_bases(a, b);\n+\t\texclude = repo_get_merge_bases(the_repository, a, b);\n \t\tadd_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,\n \t\t\t\t     flags_exclude);\n \t\tadd_pending_commit_list(revs, exclude, flags_exclude);\ndiff --git a/sequencer.c b/sequencer.c\nindex 818932a630a..d97923883ff 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -4102,7 +4102,8 @@ static int do_merge(struct repository *r,\n \t}\n \n \tmerge_commit = to_merge->item;\n-\tbases = get_merge_bases(head_commit, merge_commit);\n+\tbases = repo_get_merge_bases(the_repository, head_commit,\n+\t\t\t\t     merge_commit);\n \tif (bases && oideq(&merge_commit->object.oid,\n \t\t\t   &bases->item->object.oid)) {\n \t\tret = 0;\ndiff --git a/shallow.c b/shallow.c\nindex 17f9bcdb5f3..0fcdfd7d35a 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -791,7 +791,7 @@ static void post_assign_shallow(struct shallow_info *info,\n \t\tfor (j = 0; j < bitmap_nr; j++)\n \t\t\tif (bitmap[0][j] &&\n \t\t\t    /* Step 7, reachability test at commit level */\n-\t\t\t    !in_merge_bases_many(c, ca.nr, ca.commits)) {\n+\t\t\t    !repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits)) {\n \t\t\t\tupdate_refstatus(ref_status, info->ref->nr, *bitmap);\n \t\t\t\tdst++;\n \t\t\t\tbreak;\n@@ -819,9 +819,10 @@ int delayed_reachability_test(struct shallow_info *si, int c)\n \t\t\tsi->nr_commits = ca.nr;\n \t\t}\n \n-\t\tsi->reachable[c] = in_merge_bases_many(commit,\n-\t\t\t\t\t\t       si->nr_commits,\n-\t\t\t\t\t\t       si->commits);\n+\t\tsi->reachable[c] = repo_in_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t    commit,\n+\t\t\t\t\t\t\t    si->nr_commits,\n+\t\t\t\t\t\t\t    si->commits);\n \t\tsi->need_reachability_test[c] = 0;\n \t}\n \treturn si->reachable[c];\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 00f0f29a6a6..b6d197722f0 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -106,13 +106,17 @@ int cmd__reach(int ac, const char **av)\n \tif (!strcmp(av[1], \"ref_newer\"))\n \t\tprintf(\"%s(A,B):%d\\n\", av[1], ref_newer(&oid_A, &oid_B));\n \telse if (!strcmp(av[1], \"in_merge_bases\"))\n-\t\tprintf(\"%s(A,B):%d\\n\", av[1], in_merge_bases(A, B));\n+\t\tprintf(\"%s(A,B):%d\\n\", av[1],\n+\t\t       repo_in_merge_bases(the_repository, A, B));\n \telse if (!strcmp(av[1], \"in_merge_bases_many\"))\n-\t\tprintf(\"%s(A,X):%d\\n\", av[1], in_merge_bases_many(A, X_nr, X_array));\n+\t\tprintf(\"%s(A,X):%d\\n\", av[1],\n+\t\t       repo_in_merge_bases_many(the_repository, A, X_nr, X_array));\n \telse if (!strcmp(av[1], \"is_descendant_of\"))\n \t\tprintf(\"%s(A,X):%d\\n\", av[1], repo_is_descendant_of(r, A, X));\n \telse if (!strcmp(av[1], \"get_merge_bases_many\")) {\n-\t\tstruct commit_list *list = get_merge_bases_many(A, X_nr, X_array);\n+\t\tstruct commit_list *list = repo_get_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t\t     A, X_nr,\n+\t\t\t\t\t\t\t\t     X_array);\n \t\tprintf(\"%s(A,X):\\n\", av[1]);\n \t\tprint_sorted_commit_ids(list);\n \t} else if (!strcmp(av[1], \"reduce_heads\")) {\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473640","messageId":"patch-10.17-c4bf81a2892-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 10/17] cocci: apply the \"pretty.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:14Z","receivedAt":"2023-03-17T15:36:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"pretty.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n archive.c                                       |  3 ++-\n bisect.c                                        |  3 ++-\n builtin/bisect.c                                | 10 ++++++----\n builtin/commit.c                                | 13 ++++++++-----\n builtin/notes.c                                 |  3 ++-\n builtin/shortlog.c                              |  6 ++++--\n contrib/coccinelle/the_repository.cocci         |  4 ++++\n contrib/coccinelle/the_repository.pending.cocci |  4 ----\n fmt-merge-msg.c                                 |  3 ++-\n log-tree.c                                      |  9 ++++++---\n notes-cache.c                                   |  3 ++-\n object-name.c                                   |  6 ++++--\n pretty.c                                        |  3 ++-\n pretty.h                                        |  4 ----\n sequencer.c                                     | 12 ++++++++----\n t/helper/test-revision-walking.c                |  3 ++-\n 16 files changed, 54 insertions(+), 35 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 0b48de00634..d43687a5c44 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -59,7 +59,8 @@ static void format_subst(const struct commit *commit,\n \t\tstrbuf_add(&fmt, b + 8, c - b - 8);\n \n \t\tstrbuf_add(buf, src, b - src);\n-\t\tformat_commit_message(commit, fmt.buf, buf, ctx);\n+\t\trepo_format_commit_message(the_repository, commit, fmt.buf,\n+\t\t\t\t\t   buf, ctx);\n \t\tlen -= c + 1 - src;\n \t\tsrc  = c + 1;\n \t}\ndiff --git a/bisect.c b/bisect.c\nindex db7aa2032e1..761dd48ad20 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -752,7 +752,8 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,\n \t}\n \n \tcommit = lookup_commit_reference(the_repository, bisect_rev);\n-\tformat_commit_message(commit, \"[%H] %s%n\", &commit_msg, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"[%H] %s%n\",\n+\t\t\t\t   &commit_msg, &pp);\n \tfputs(commit_msg.buf, stdout);\n \tstrbuf_release(&commit_msg);\n \ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 7d51eecab82..34ba7b18f69 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -265,7 +265,8 @@ static void log_commit(FILE *fp, char *fmt, const char *state,\n \tstruct strbuf commit_msg = STRBUF_INIT;\n \tchar *label = xstrfmt(fmt, state);\n \n-\tformat_commit_message(commit, \"%s\", &commit_msg, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &commit_msg,\n+\t\t\t\t   &pp);\n \n \tfprintf(fp, \"# %s: [%s] %s\\n\", label, oid_to_hex(&commit->object.oid),\n \t\tcommit_msg.buf);\n@@ -603,8 +604,8 @@ static int bisect_skipped_commits(struct bisect_terms *terms)\n \n \twhile ((commit = get_revision(&revs)) != NULL) {\n \t\tstrbuf_reset(&commit_name);\n-\t\tformat_commit_message(commit, \"%s\",\n-\t\t\t\t      &commit_name, &pp);\n+\t\trepo_format_commit_message(the_repository, commit, \"%s\",\n+\t\t\t\t\t   &commit_name, &pp);\n \t\tfprintf(fp, \"# possible first %s commit: [%s] %s\\n\",\n \t\t\tterms->term_bad, oid_to_hex(&commit->object.oid),\n \t\t\tcommit_name.buf);\n@@ -633,7 +634,8 @@ static int bisect_successful(struct bisect_terms *terms)\n \n \tread_ref(bad_ref, &oid);\n \tcommit = lookup_commit_reference_by_name(bad_ref);\n-\tformat_commit_message(commit, \"%s\", &commit_name, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &commit_name,\n+\t\t\t\t   &pp);\n \n \tres = append_to_file(git_path_bisect_log(), \"# first %s commit: [%s] %s\\n\",\n \t\t\t    terms->term_bad, oid_to_hex(&commit->object.oid),\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex bda6afc4bd6..92b7e8c56f7 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -719,7 +719,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n \t * duplicate the subject line.\n \t */\n \tfmt = starts_with(subject, \"amend!\") ? \"%b\" : \"%B\";\n-\tformat_commit_message(commit, fmt, sb, ctx);\n+\trepo_format_commit_message(the_repository, commit, fmt, sb, ctx);\n \trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n@@ -760,8 +760,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tif (!c)\n \t\t\t\tdie(_(\"could not lookup commit %s\"), squash_message);\n \t\t\tctx.output_encoding = get_commit_output_encoding();\n-\t\t\tformat_commit_message(c, \"squash! %s\\n\\n\", &sb,\n-\t\t\t\t\t      &ctx);\n+\t\t\trepo_format_commit_message(the_repository, c,\n+\t\t\t\t\t\t   \"squash! %s\\n\\n\", &sb,\n+\t\t\t\t\t\t   &ctx);\n \t\t}\n \t}\n \n@@ -795,7 +796,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tdie(_(\"could not lookup commit %s\"), fixup_commit);\n \t\tctx.output_encoding = get_commit_output_encoding();\n \t\tfmt = xstrfmt(\"%s! %%s\\n\\n\", fixup_prefix);\n-\t\tformat_commit_message(commit, fmt, &sb, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit, fmt, &sb,\n+\t\t\t\t\t   &ctx);\n \t\tfree(fmt);\n \t\thook_arg1 = \"message\";\n \n@@ -1135,7 +1137,8 @@ static const char *find_author_by_nickname(const char *name)\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode.type = DATE_NORMAL;\n \t\tstrbuf_release(&buf);\n-\t\tformat_commit_message(commit, \"%aN <%aE>\", &buf, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   \"%aN <%aE>\", &buf, &ctx);\n \t\trelease_revisions(&revs);\n \t\treturn strbuf_detach(&buf, NULL);\n \t}\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex ba1daa4ff0f..f4939176dae 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -742,7 +742,8 @@ static int merge_commit(struct notes_merge_options *o)\n \n \t/* Reuse existing commit message in reflog message */\n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\tformat_commit_message(partial, \"%s\", &msg, &pretty_ctx);\n+\trepo_format_commit_message(the_repository, partial, \"%s\", &msg,\n+\t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \tstrbuf_insertstr(&msg, 0, \"notes: \");\n \tupdate_ref(msg.buf, o->local_ref, &oid,\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 8afd1ad865e..62f91b8b932 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -223,7 +223,8 @@ static void insert_records_from_format(struct shortlog *log,\n \tfor_each_string_list_item(item, &log->format) {\n \t\tstrbuf_reset(&buf);\n \n-\t\tformat_commit_message(commit, item->string, &buf, ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   item->string, &buf, ctx);\n \n \t\tif (!shortlog_needs_dedup(log) || strset_add(dups, buf.buf))\n \t\t\tinsert_one_record(log, buf.buf, oneline);\n@@ -249,7 +250,8 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tif (log->user_format)\n \t\t\tpretty_print_commit(&ctx, commit, &oneline);\n \t\telse\n-\t\t\tformat_commit_message(commit, \"%s\", &oneline, &ctx);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%s\", &oneline, &ctx);\n \t}\n \toneline_str = oneline.len ? oneline.buf : \"<none>\";\n \ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex fa159aba5b5..ff4c56114f1 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -87,6 +87,10 @@\n |\n - has_object_file_with_flags\n + repo_has_object_file_with_flags\n+// pretty.h\n+|\n+- format_commit_message\n++ repo_format_commit_message\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 69e9694111e..375850e773c 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// pretty.h\n-- format_commit_message\n-+ repo_format_commit_message\n // packfile.h\n-|\n - approximate_object_count\n + repo_approximate_object_count\n // promisor-remote.h\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex e9c6623647d..62529344407 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -385,7 +385,8 @@ static void shortlog(const char *name,\n \t\tif (subjects.nr > limit)\n \t\t\tcontinue;\n \n-\t\tformat_commit_message(commit, \"%s\", &sb, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit, \"%s\", &sb,\n+\t\t\t\t\t   &ctx);\n \t\tstrbuf_ltrim(&sb);\n \n \t\tif (!sb.len)\ndiff --git a/log-tree.c b/log-tree.c\nindex 1bd4d6ab008..7eee664cd23 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -407,7 +407,8 @@ void fmt_output_commit(struct strbuf *filename,\n \tstruct pretty_print_context ctx = {0};\n \tstruct strbuf subject = STRBUF_INIT;\n \n-\tformat_commit_message(commit, \"%f\", &subject, &ctx);\n+\trepo_format_commit_message(the_repository, commit, \"%f\", &subject,\n+\t\t\t\t   &ctx);\n \tfmt_output_subject(filename, subject.buf, info);\n \tstrbuf_release(&subject);\n }\n@@ -985,8 +986,10 @@ static int do_remerge_diff(struct rev_info *opt,\n \to.msg_header_prefix = \"remerge\";\n \n \tctx.abbrev = DEFAULT_ABBREV;\n-\tformat_commit_message(parent1, \"%h (%s)\", &parent1_desc, &ctx);\n-\tformat_commit_message(parent2, \"%h (%s)\", &parent2_desc, &ctx);\n+\trepo_format_commit_message(the_repository, parent1, \"%h (%s)\",\n+\t\t\t\t   &parent1_desc, &ctx);\n+\trepo_format_commit_message(the_repository, parent2, \"%h (%s)\",\n+\t\t\t\t   &parent2_desc, &ctx);\n \to.branch1 = parent1_desc.buf;\n \to.branch2 = parent2_desc.buf;\n \ndiff --git a/notes-cache.c b/notes-cache.c\nindex 38466091360..e5e9092d367 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -23,7 +23,8 @@ static int notes_cache_match_validity(struct repository *r,\n \t\treturn 0;\n \n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\tformat_commit_message(commit, \"%s\", &msg, &pretty_ctx);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &msg,\n+\t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \n \tret = !strcmp(msg.buf, validity);\ndiff --git a/object-name.c b/object-name.c\nindex 2926f26251f..df31f192ce3 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -394,8 +394,10 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)\n \t\tif (commit) {\n \t\t\tstruct pretty_print_context pp = {0};\n \t\t\tpp.date_mode.type = DATE_SHORT;\n-\t\t\tformat_commit_message(commit, \"%ad\", &date, &pp);\n-\t\t\tformat_commit_message(commit, \"%s\", &msg, &pp);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%ad\", &date, &pp);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%s\", &msg, &pp);\n \t\t}\n \n \t\t/*\ndiff --git a/pretty.c b/pretty.c\nindex 7e1614f67fe..076d1c363e7 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2199,7 +2199,8 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \tint need_8bit_cte = pp->need_8bit_cte;\n \n \tif (pp->fmt == CMIT_FMT_USERFORMAT) {\n-\t\tformat_commit_message(commit, user_format, sb, pp);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   user_format, sb, pp);\n \t\treturn;\n \t}\n \ndiff --git a/pretty.h b/pretty.h\nindex f34e24c53a4..1e37c56d73d 100644\n--- a/pretty.h\n+++ b/pretty.h\n@@ -120,10 +120,6 @@ void repo_format_commit_message(struct repository *r,\n \t\t\tconst struct commit *commit,\n \t\t\tconst char *format, struct strbuf *sb,\n \t\t\tconst struct pretty_print_context *context);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define format_commit_message(c, f, s, con) \\\n-\trepo_format_commit_message(the_repository, c, f, s, con)\n-#endif\n \n /*\n  * Parse given arguments from \"arg\", check it for correctness and\ndiff --git a/sequencer.c b/sequencer.c\nindex 592b3d2875a..aa3ebb47d98 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1343,8 +1343,10 @@ void print_commit_summary(struct repository *r,\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n \n-\tformat_commit_message(commit, \"%an <%ae>\", &author_ident, &pctx);\n-\tformat_commit_message(commit, \"%cn <%ce>\", &committer_ident, &pctx);\n+\trepo_format_commit_message(the_repository, commit, \"%an <%ae>\",\n+\t\t\t\t   &author_ident, &pctx);\n+\trepo_format_commit_message(the_repository, commit, \"%cn <%ce>\",\n+\t\t\t\t   &committer_ident, &pctx);\n \tif (strbuf_cmp(&author_ident, &committer_ident)) {\n \t\tstrbuf_addstr(&format, \"\\n Author: \");\n \t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n@@ -1352,7 +1354,8 @@ void print_commit_summary(struct repository *r,\n \tif (flags & SUMMARY_SHOW_AUTHOR_DATE) {\n \t\tstruct strbuf date = STRBUF_INIT;\n \n-\t\tformat_commit_message(commit, \"%ad\", &date, &pctx);\n+\t\trepo_format_commit_message(the_repository, commit, \"%ad\",\n+\t\t\t\t\t   &date, &pctx);\n \t\tstrbuf_addstr(&format, \"\\n Date: \");\n \t\tstrbuf_addbuf_percentquote(&format, &date);\n \t\tstrbuf_release(&date);\n@@ -2125,7 +2128,8 @@ static void refer_to_commit(struct replay_opts *opts,\n \t\t\t.abbrev = DEFAULT_ABBREV,\n \t\t\t.date_mode.type = DATE_SHORT,\n \t\t};\n-\t\tformat_commit_message(commit, \"%h (%s, %ad)\", msgbuf, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   \"%h (%s, %ad)\", msgbuf, &ctx);\n \t} else {\n \t\tstrbuf_addstr(msgbuf, oid_to_hex(&commit->object.oid));\n \t}\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex 4a45d5bac2a..c7b22cb33d5 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -19,7 +19,8 @@ static void print_commit(struct commit *commit)\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n \tctx.date_mode.type = DATE_NORMAL;\n-\tformat_commit_message(commit, \" %m %s\", &sb, &ctx);\n+\trepo_format_commit_message(the_repository, commit, \" %m %s\", &sb,\n+\t\t\t\t   &ctx);\n \tprintf(\"%s\\n\", sb.buf);\n \tstrbuf_release(&sb);\n }\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473641","messageId":"patch-05.17-36eae891341-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 05/17] cocci: apply the \"cache.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:09Z","receivedAt":"2023-03-17T15:36:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"cache.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-patch.c                                   |  2 +-\n apply.c                                       |  4 +-\n archive.c                                     |  2 +-\n branch.c                                      |  2 +-\n builtin/am.c                                  | 16 +++---\n builtin/bisect.c                              | 19 +++----\n builtin/blame.c                               |  9 ++--\n builtin/branch.c                              |  2 +-\n builtin/checkout.c                            | 16 +++---\n builtin/commit-tree.c                         |  4 +-\n builtin/commit.c                              |  8 +--\n builtin/describe.c                            |  5 +-\n builtin/fast-import.c                         |  8 +--\n builtin/fetch.c                               |  2 +-\n builtin/fsck.c                                |  2 +-\n builtin/log.c                                 |  8 +--\n builtin/ls-files.c                            |  4 +-\n builtin/ls-tree.c                             |  9 ++--\n builtin/merge-base.c                          |  4 +-\n builtin/merge-recursive.c                     |  6 +--\n builtin/merge.c                               | 10 ++--\n builtin/name-rev.c                            |  7 +--\n builtin/notes.c                               | 22 ++++----\n builtin/prune.c                               |  2 +-\n builtin/pull.c                                |  4 +-\n builtin/range-diff.c                          | 12 ++---\n builtin/read-tree.c                           |  2 +-\n builtin/rebase.c                              | 12 +++--\n builtin/receive-pack.c                        | 10 ++--\n builtin/replace.c                             | 16 +++---\n builtin/reset.c                               | 19 +++----\n builtin/rev-list.c                            |  2 +-\n builtin/rev-parse.c                           | 12 +++--\n builtin/rm.c                                  |  2 +-\n builtin/show-branch.c                         | 12 ++---\n builtin/show-ref.c                            |  4 +-\n builtin/sparse-checkout.c                     |  2 +-\n builtin/stash.c                               | 13 ++---\n builtin/submodule--helper.c                   |  4 +-\n builtin/tag.c                                 |  6 +--\n builtin/unpack-file.c                         |  2 +-\n builtin/update-ref.c                          |  8 +--\n builtin/verify-commit.c                       |  2 +-\n builtin/verify-tag.c                          |  2 +-\n builtin/worktree.c                            |  8 +--\n cache.h                                       | 15 ------\n checkout.c                                    |  2 +-\n combine-diff.c                                |  6 +--\n commit.c                                      | 10 ++--\n contrib/coccinelle/the_repository.cocci       | 44 ++++++++++++++++\n .../coccinelle/the_repository.pending.cocci   | 37 --------------\n diff-lib.c                                    |  2 +-\n diff.c                                        |  4 +-\n fmt-merge-msg.c                               |  4 +-\n log-tree.c                                    | 15 +++---\n mailmap.c                                     |  2 +-\n notes-merge.c                                 |  2 +-\n notes.c                                       |  6 +--\n object-name.c                                 |  5 +-\n parse-options-cb.c                            |  8 +--\n range-diff.c                                  |  8 +--\n read-cache.c                                  |  2 +-\n rebase-interactive.c                          |  2 +-\n ref-filter.c                                  |  8 +--\n remote.c                                      |  6 +--\n reset.c                                       |  4 +-\n revision.c                                    | 11 ++--\n sequencer.c                                   | 51 ++++++++++---------\n submodule-config.c                            |  2 +-\n submodule.c                                   |  8 +--\n t/helper/test-fast-rebase.c                   | 10 ++--\n t/helper/test-match-trees.c                   |  4 +-\n t/helper/test-oidmap.c                        |  6 +--\n t/helper/test-reach.c                         |  2 +-\n t/helper/test-submodule-config.c              |  2 +-\n tag.c                                         |  4 +-\n transport-helper.c                            |  2 +-\n transport.c                                   |  3 +-\n wt-status.c                                   | 18 +++----\n 79 files changed, 332 insertions(+), 310 deletions(-)\n create mode 100644 contrib/coccinelle/the_repository.cocci\n\ndiff --git a/add-patch.c b/add-patch.c\nindex a86a92e1646..3cbb9591945 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -414,7 +414,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)\n \t\tstrvec_push(&args,\n \t\t\t    /* could be on an unborn branch */\n \t\t\t    !strcmp(\"HEAD\", s->revision) &&\n-\t\t\t    get_oid(\"HEAD\", &oid) ?\n+\t\t\t    repo_get_oid(the_repository, \"HEAD\", &oid) ?\n \t\t\t    empty_tree_oid_hex() : s->revision);\n \t}\n \tcolor_arg_index = args.nr;\ndiff --git a/apply.c b/apply.c\nindex 5cc5479c9c3..57f45cedd2b 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3610,7 +3610,7 @@ static int try_threeway(struct apply_state *state,\n \t/* Preimage the patch was prepared for */\n \tif (patch->is_new)\n \t\twrite_object_file(\"\", 0, OBJ_BLOB, &pre_oid);\n-\telse if (get_oid(patch->old_oid_prefix, &pre_oid) ||\n+\telse if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) ||\n \t\t read_blob_object(&buf, &pre_oid, patch->old_mode))\n \t\treturn error(_(\"repository lacks the necessary blob to perform 3-way merge.\"));\n \n@@ -4127,7 +4127,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \t\t\telse\n \t\t\t\treturn error(_(\"sha1 information is lacking or \"\n \t\t\t\t\t       \"useless for submodule %s\"), name);\n-\t\t} else if (!get_oid_blob(patch->old_oid_prefix, &oid)) {\n+\t\t} else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) {\n \t\t\t; /* ok */\n \t\t} else if (!patch->lines_added && !patch->lines_deleted) {\n \t\t\t/* mode-only change: update the current */\ndiff --git a/archive.c b/archive.c\nindex 9aeaf2bd87d..732e2100544 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -461,7 +461,7 @@ static void parse_treeish_arg(const char **argv,\n \t\tdwim_ref(name, strlen(name), &oid, &ref, 0);\n \t}\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\tdie(_(\"not a valid object name: %s\"), name);\n \n \tcommit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);\ndiff --git a/branch.c b/branch.c\nindex e5614b53b36..2efb5fbaa5f 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -531,7 +531,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\texplicit_tracking = 1;\n \n \treal_ref = NULL;\n-\tif (get_oid_mb(start_name, &oid)) {\n+\tif (repo_get_oid_mb(the_repository, start_name, &oid)) {\n \t\tif (explicit_tracking) {\n \t\t\tint code = die_message(_(upstream_missing), start_name);\n \t\t\tadvise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,\ndiff --git a/builtin/am.c b/builtin/am.c\nindex e0848ddadfe..c04038f1f3d 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1066,7 +1066,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,\n \telse\n \t\twrite_state_text(state, \"applying\", \"\");\n \n-\tif (!get_oid(\"HEAD\", &curr_head)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &curr_head)) {\n \t\twrite_state_text(state, \"abort-safety\", oid_to_hex(&curr_head));\n \t\tif (!state->rebasing)\n \t\t\tupdate_ref(\"am\", \"ORIG_HEAD\", &curr_head, NULL, 0,\n@@ -1109,7 +1109,7 @@ static void am_next(struct am_state *state)\n \tunlink(am_path(state, \"original-commit\"));\n \tdelete_ref(NULL, \"REBASE_HEAD\", NULL, REF_NO_DEREF);\n \n-\tif (!get_oid(\"HEAD\", &head))\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head))\n \t\twrite_state_text(state, \"abort-safety\", oid_to_hex(&head));\n \telse\n \t\twrite_state_text(state, \"abort-safety\", \"\");\n@@ -1402,7 +1402,7 @@ static void write_index_patch(const struct am_state *state)\n \tstruct rev_info rev_info;\n \tFILE *fp;\n \n-\tif (!get_oid(\"HEAD\", &head)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\tstruct commit *commit = lookup_commit_or_die(&head, \"HEAD\");\n \t\ttree = get_commit_tree(commit);\n \t} else\n@@ -1556,7 +1556,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa\n \tstruct commit *result;\n \tchar *their_tree_name;\n \n-\tif (get_oid(\"HEAD\", &our_tree) < 0)\n+\tif (repo_get_oid(the_repository, \"HEAD\", &our_tree) < 0)\n \t\toidcpy(&our_tree, the_hash_algo->empty_tree);\n \n \tif (build_fake_ancestor(state, index_path))\n@@ -1646,7 +1646,7 @@ static void do_commit(const struct am_state *state)\n \tif (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL))\n \t\tdie(_(\"git write-tree failed to write a tree\"));\n \n-\tif (!get_oid_commit(\"HEAD\", &parent)) {\n+\tif (!repo_get_oid_commit(the_repository, \"HEAD\", &parent)) {\n \t\told_oid = &parent;\n \t\tcommit_list_insert(lookup_commit(the_repository, &parent),\n \t\t\t\t   &parents);\n@@ -2088,7 +2088,7 @@ static void am_skip(struct am_state *state)\n \n \tam_rerere_clear();\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\toidcpy(&head, the_hash_algo->empty_tree);\n \n \tif (clean_index(&head, &head))\n@@ -2130,7 +2130,7 @@ static int safe_to_abort(const struct am_state *state)\n \t\toidclr(&abort_safety);\n \tstrbuf_release(&sb);\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\toidclr(&head);\n \n \tif (oideq(&head, &abort_safety))\n@@ -2163,7 +2163,7 @@ static void am_abort(struct am_state *state)\n \tif (!has_curr_head)\n \t\toidcpy(&curr_head, the_hash_algo->empty_tree);\n \n-\thas_orig_head = !get_oid(\"ORIG_HEAD\", &orig_head);\n+\thas_orig_head = !repo_get_oid(the_repository, \"ORIG_HEAD\", &orig_head);\n \tif (!has_orig_head)\n \t\toidcpy(&orig_head, the_hash_algo->empty_tree);\n \ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 73017402671..7d51eecab82 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -235,7 +235,7 @@ static int bisect_reset(const char *commit)\n \t} else {\n \t\tstruct object_id oid;\n \n-\t\tif (get_oid_commit(commit, &oid))\n+\t\tif (repo_get_oid_commit(the_repository, commit, &oid))\n \t\t\treturn error(_(\"'%s' is not a valid commit\"), commit);\n \t\tstrbuf_addstr(&branch, commit);\n \t}\n@@ -292,7 +292,7 @@ static int bisect_write(const char *state, const char *rev,\n \t\tgoto finish;\n \t}\n \n-\tif (get_oid(rev, &oid)) {\n+\tif (repo_get_oid(the_repository, rev, &oid)) {\n \t\tres = error(_(\"couldn't get the oid of the rev '%s'\"), rev);\n \t\tgoto finish;\n \t}\n@@ -775,7 +775,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t */\n \thead = resolve_ref_unsafe(\"HEAD\", 0, &head_oid, &flags);\n \tif (!head)\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\treturn error(_(\"bad HEAD - I need a HEAD\"));\n \n \t/*\n@@ -801,11 +801,11 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t\t}\n \t} else {\n \t\t/* Get the rev from where we start. */\n-\t\tif (!get_oid(head, &head_oid) &&\n+\t\tif (!repo_get_oid(the_repository, head, &head_oid) &&\n \t\t    !starts_with(head, \"refs/heads/\")) {\n \t\t\tstrbuf_reset(&start_head);\n \t\t\tstrbuf_addstr(&start_head, oid_to_hex(&head_oid));\n-\t\t} else if (!get_oid(head, &head_oid) &&\n+\t\t} else if (!repo_get_oid(the_repository, head, &head_oid) &&\n \t\t\t   skip_prefix(head, \"refs/heads/\", &head)) {\n \t\t\tstrbuf_addstr(&start_head, head);\n \t\t} else {\n@@ -828,7 +828,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t\twrite_file(git_path_bisect_first_parent(), \"\\n\");\n \n \tif (no_checkout) {\n-\t\tif (get_oid(start_head.buf, &oid) < 0) {\n+\t\tif (repo_get_oid(the_repository, start_head.buf, &oid) < 0) {\n \t\t\tres = error(_(\"invalid ref: '%s'\"), start_head.buf);\n \t\t\tgoto finish;\n \t\t}\n@@ -933,11 +933,12 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,\n \n \tif (argc == 0) {\n \t\tconst char *head = \"BISECT_HEAD\";\n-\t\tenum get_oid_result res_head = get_oid(head, &oid);\n+\t\tenum get_oid_result res_head = repo_get_oid(the_repository,\n+\t\t\t\t\t\t\t    head, &oid);\n \n \t\tif (res_head == MISSING_OBJECT) {\n \t\t\thead = \"HEAD\";\n-\t\t\tres_head = get_oid(head, &oid);\n+\t\t\tres_head = repo_get_oid(the_repository, head, &oid);\n \t\t}\n \n \t\tif (res_head)\n@@ -953,7 +954,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,\n \tfor (; argc; argc--, argv++) {\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(*argv, &oid)){\n+\t\tif (repo_get_oid(the_repository, *argv, &oid)){\n \t\t\terror(_(\"Bad rev input: %s\"), *argv);\n \t\t\toid_array_clear(&revs);\n \t\t\treturn BISECT_FAILED;\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 71f925e456c..0155062de11 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -601,8 +601,9 @@ static int read_ancestry(const char *graft_file)\n \n static int update_auto_abbrev(int auto_abbrev, struct blame_origin *suspect)\n {\n-\tconst char *uniq = find_unique_abbrev(&suspect->commit->object.oid,\n-\t\t\t\t\t      auto_abbrev);\n+\tconst char *uniq = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t   &suspect->commit->object.oid,\n+\t\t\t\t\t\t   auto_abbrev);\n \tint len = strlen(uniq);\n \tif (auto_abbrev < len)\n \t\treturn len;\n@@ -802,7 +803,7 @@ static int is_a_rev(const char *name)\n {\n \tstruct object_id oid;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn 0;\n \treturn OBJ_NONE < oid_object_info(the_repository, &oid, NULL);\n }\n@@ -845,7 +846,7 @@ static void build_ignorelist(struct blame_scoreboard *sb,\n \t\t\t\t\t\t    peel_to_commit_oid, sb);\n \t}\n \tfor_each_string_list_item(i, ignore_rev_list) {\n-\t\tif (get_oid_committish(i->string, &oid) ||\n+\t\tif (repo_get_oid_committish(the_repository, i->string, &oid) ||\n \t\t    peel_to_commit_oid(&oid, sb))\n \t\t\tdie(_(\"cannot find revision %s to ignore\"), i->string);\n \t\toidset_insert(&sb->ignore_list, &oid);\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex f63fd45edb9..968ea03c059 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -280,7 +280,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,\n \t\titem = string_list_append(&refs_to_delete, name);\n \t\titem->util = xstrdup((flags & REF_ISBROKEN) ? \"broken\"\n \t\t\t\t    : (flags & REF_ISSYMREF) ? target\n-\t\t\t\t    : find_unique_abbrev(&oid, DEFAULT_ABBREV));\n+\t\t\t\t    : repo_find_unique_abbrev(the_repository, &oid, DEFAULT_ABBREV));\n \n \tnext:\n \t\tfree(target);\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex a5155cf55c1..6216bb6bba3 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -432,8 +432,8 @@ static int checkout_worktree(const struct checkout_opts *opts,\n \t\t\t\t\t      \"Updated %d paths from %s\",\n \t\t\t\t\t      nr_checkouts),\n \t\t\t\t   nr_checkouts,\n-\t\t\t\t   find_unique_abbrev(&opts->source_tree->object.oid,\n-\t\t\t\t\t\t      DEFAULT_ABBREV));\n+\t\t\t\t   repo_find_unique_abbrev(the_repository, &opts->source_tree->object.oid,\n+\t\t\t\t\t\t\t   DEFAULT_ABBREV));\n \t\telse if (!nr_unmerged || nr_checkouts)\n \t\t\tfprintf_ln(stderr, Q_(\"Updated %d path from the index\",\n \t\t\t\t\t      \"Updated %d paths from the index\",\n@@ -644,10 +644,12 @@ static void describe_detached_head(const char *msg, struct commit *commit)\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);\n \tif (print_sha1_ellipsis()) {\n \t\tfprintf(stderr, \"%s %s... %s\\n\", msg,\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n+\t\t\tsb.buf);\n \t} else {\n \t\tfprintf(stderr, \"%s %s %s\\n\", msg,\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n+\t\t\tsb.buf);\n \t}\n \tstrbuf_release(&sb);\n }\n@@ -1060,7 +1062,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n \t\t\t\" git branch <new-branch-name> %s\\n\\n\",\n \t\t\t/* Give ngettext() the count */\n \t\t\tlost),\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n }\n \n /*\n@@ -1322,7 +1324,7 @@ static int parse_branchname_arg(int argc, const char **argv,\n \tif (!strcmp(arg, \"-\"))\n \t\targ = \"@{-1}\";\n \n-\tif (get_oid_mb(arg, rev)) {\n+\tif (repo_get_oid_mb(the_repository, arg, rev)) {\n \t\t/*\n \t\t * Either case (3) or (4), with <something> not being\n \t\t * a commit, or an attempt to use case (1) with an\n@@ -1748,7 +1750,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,\n \t} else if (!opts->accept_ref && opts->from_treeish) {\n \t\tstruct object_id rev;\n \n-\t\tif (get_oid_mb(opts->from_treeish, &rev))\n+\t\tif (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))\n \t\t\tdie(_(\"could not resolve %s\"), opts->from_treeish);\n \n \t\tsetup_new_branch_info_and_source_tree(new_branch_info,\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex cc8d584be2f..7941512c19f 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -53,7 +53,7 @@ static int parse_parent_arg_callback(const struct option *opt,\n \n \tBUG_ON_OPT_NEG_NOARG(unset, arg);\n \n-\tif (get_oid_commit(arg, &oid))\n+\tif (repo_get_oid_commit(the_repository, arg, &oid))\n \t\tdie(_(\"not a valid object name %s\"), arg);\n \n \tassert_oid_type(&oid, OBJ_COMMIT);\n@@ -131,7 +131,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \tif (argc != 1)\n \t\tdie(_(\"must give exactly one tree\"));\n \n-\tif (get_oid_tree(argv[0], &tree_oid))\n+\tif (repo_get_oid_tree(the_repository, argv[0], &tree_oid))\n \t\tdie(_(\"not a valid object name %s\"), argv[0]);\n \n \tif (!buffer.len) {\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 985a0445b78..80d1e31f25a 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -557,7 +557,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \ts->index_file = index_file;\n \ts->fp = fp;\n \ts->nowarn = nowarn;\n-\ts->is_initial = get_oid(s->reference, &oid) ? 1 : 0;\n+\ts->is_initial = repo_get_oid(the_repository, s->reference, &oid) ? 1 : 0;\n \tif (!s->is_initial)\n \t\toidcpy(&s->oid_commit, &oid);\n \ts->status_format = status_format;\n@@ -1000,7 +1000,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tif (amend)\n \t\t\tparent = \"HEAD^1\";\n \n-\t\tif (get_oid(parent, &oid)) {\n+\t\tif (repo_get_oid(the_repository, parent, &oid)) {\n \t\t\tint i, ita_nr = 0;\n \n \t\t\t/* TODO: audit for interaction with sparse-index. */\n@@ -1567,7 +1567,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \telse\n \t\tfd = -1;\n \n-\ts.is_initial = get_oid(s.reference, &oid) ? 1 : 0;\n+\ts.is_initial = repo_get_oid(the_repository, s.reference, &oid) ? 1 : 0;\n \tif (!s.is_initial)\n \t\toidcpy(&s.oid_commit, &oid);\n \n@@ -1714,7 +1714,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tstatus_format = STATUS_FORMAT_NONE; /* Ignore status.short */\n \ts.colopts = 0;\n \n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\tcurrent_head = NULL;\n \telse {\n \t\tcurrent_head = lookup_commit_or_die(&oid, \"HEAD\");\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex eea1e330c00..c85bf9c418b 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -298,7 +298,8 @@ static void append_name(struct commit_name *n, struct strbuf *dst)\n \n static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)\n {\n-\tstrbuf_addf(dst, \"-%d-g%s\", depth, find_unique_abbrev(oid, abbrev));\n+\tstrbuf_addf(dst, \"-%d-g%s\", depth,\n+\t\t    repo_find_unique_abbrev(the_repository, oid, abbrev));\n }\n \n static void describe_commit(struct object_id *oid, struct strbuf *dst)\n@@ -531,7 +532,7 @@ static void describe(const char *arg, int last_one)\n \tif (debug)\n \t\tfprintf(stderr, _(\"describe %s\\n\"), arg);\n \n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\tdie(_(\"Not a valid object name %s\"), arg);\n \tcmit = lookup_commit_reference_gently(the_repository, &oid, 1);\n \ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 7134683ab93..f533b768efb 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -2486,7 +2486,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa\n \t\tif (commit_oe->type != OBJ_COMMIT)\n \t\t\tdie(\"Mark :%\" PRIuMAX \" not a commit\", commit_mark);\n \t\toidcpy(&commit_oid, &commit_oe->idx.oid);\n-\t} else if (!get_oid(p, &commit_oid)) {\n+\t} else if (!repo_get_oid(the_repository, p, &commit_oid)) {\n \t\tunsigned long size;\n \t\tchar *buf = read_object_with_reference(the_repository,\n \t\t\t\t\t\t       &commit_oid,\n@@ -2599,7 +2599,7 @@ static int parse_objectish(struct branch *b, const char *objectish)\n \t\t\t} else\n \t\t\t\tparse_from_existing(b);\n \t\t}\n-\t} else if (!get_oid(objectish, &b->oid)) {\n+\t} else if (!repo_get_oid(the_repository, objectish, &b->oid)) {\n \t\tparse_from_existing(b);\n \t\tif (is_null_oid(&b->oid))\n \t\t\tb->delete = 1;\n@@ -2654,7 +2654,7 @@ static struct hash_list *parse_merge(unsigned int *count)\n \t\t\tif (oe->type != OBJ_COMMIT)\n \t\t\t\tdie(\"Mark :%\" PRIuMAX \" not a commit\", idnum);\n \t\t\toidcpy(&n->oid, &oe->idx.oid);\n-\t\t} else if (!get_oid(from, &n->oid)) {\n+\t\t} else if (!repo_get_oid(the_repository, from, &n->oid)) {\n \t\t\tunsigned long size;\n \t\t\tchar *buf = read_object_with_reference(the_repository,\n \t\t\t\t\t\t\t       &n->oid,\n@@ -2827,7 +2827,7 @@ static void parse_new_tag(const char *arg)\n \t\toe = find_mark(marks, from_mark);\n \t\ttype = oe->type;\n \t\toidcpy(&oid, &oe->idx.oid);\n-\t} else if (!get_oid(from, &oid)) {\n+\t} else if (!repo_get_oid(the_repository, from, &oid)) {\n \t\tstruct object_entry *oe = find_object(&oid);\n \t\tif (!oe) {\n \t\t\ttype = oid_object_info(the_repository, &oid, NULL);\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex a09606b4726..80cf1d01583 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1487,7 +1487,7 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)\n \t\tint old_nr;\n \t\tif (!has_glob_specials(s)) {\n \t\t\tstruct object_id oid;\n-\t\t\tif (get_oid(s, &oid))\n+\t\t\tif (repo_get_oid(the_repository, s, &oid))\n \t\t\t\tdie(_(\"%s is not a valid object\"), s);\n \t\t\tif (!has_object(the_repository, &oid, 0))\n \t\t\t\tdie(_(\"the object %s does not exist\"), s);\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex d207bd909b4..2bf183a43be 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -923,7 +923,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tstruct object_id oid;\n-\t\tif (!get_oid(arg, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, arg, &oid)) {\n \t\t\tstruct object *obj = lookup_object(the_repository,\n \t\t\t\t\t\t\t   &oid);\n \ndiff --git a/builtin/log.c b/builtin/log.c\nindex a70fba198f9..b4c38f6ad87 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1642,7 +1642,7 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\t\tstruct commit *commit;\n \t\t\tstruct object_id oid;\n \n-\t\t\tif (get_oid(upstream, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, upstream, &oid)) {\n \t\t\t\tif (die_on_failure)\n \t\t\t\t\tdie(_(\"failed to resolve '%s' as a valid ref\"), upstream);\n \t\t\t\telse\n@@ -2396,7 +2396,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)\n {\n \tstruct object_id oid;\n-\tif (get_oid(arg, &oid) == 0) {\n+\tif (repo_get_oid(the_repository, arg, &oid) == 0) {\n \t\tstruct commit *commit = lookup_commit_reference(the_repository,\n \t\t\t\t\t\t\t\t&oid);\n \t\tif (commit) {\n@@ -2418,12 +2418,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,\n {\n \tif (!verbose) {\n \t\tfprintf(file, \"%c %s\\n\", sign,\n-\t\t       find_unique_abbrev(&commit->object.oid, abbrev));\n+\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev));\n \t} else {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);\n \t\tfprintf(file, \"%c %s %s\\n\", sign,\n-\t\t       find_unique_abbrev(&commit->object.oid, abbrev),\n+\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev),\n \t\t       buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex a03b559ecaa..c10d51a969d 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -360,7 +360,7 @@ static void show_ru_info(struct index_state *istate)\n \t\t\tif (!ui->mode[i])\n \t\t\t\tcontinue;\n \t\t\tprintf(\"%s%06o %s %d\\t\", tag_resolve_undo, ui->mode[i],\n-\t\t\t       find_unique_abbrev(&ui->oid[i], abbrev),\n+\t\t\t       repo_find_unique_abbrev(the_repository, &ui->oid[i], abbrev),\n \t\t\t       i + 1);\n \t\t\twrite_name(path);\n \t\t}\n@@ -575,7 +575,7 @@ void overlay_tree_on_index(struct index_state *istate,\n \tread_tree_fn_t fn = NULL;\n \tint err;\n \n-\tif (get_oid(tree_name, &oid))\n+\tif (repo_get_oid(the_repository, tree_name, &oid))\n \t\tdie(\"tree-ish %s not found.\", tree_name);\n \ttree = parse_tree_indirect(&oid);\n \tif (!tree)\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 8cc8c995df9..ebcc8fd6ff8 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -228,7 +228,7 @@ static int show_tree_default(const struct object_id *oid, struct strbuf *base,\n \t\treturn early;\n \n \tprintf(\"%06o %s %s\\t\", mode, type_name(object_type(mode)),\n-\t       find_unique_abbrev(oid, options->abbrev));\n+\t       repo_find_unique_abbrev(the_repository, oid, options->abbrev));\n \tshow_tree_common_default_long(options, base, pathname, base->len);\n \treturn recurse;\n }\n@@ -259,7 +259,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \t}\n \n \tprintf(\"%06o %s %s %7s\\t\", mode, type_name(type),\n-\t       find_unique_abbrev(oid, options->abbrev), size_text);\n+\t       repo_find_unique_abbrev(the_repository, oid, options->abbrev),\n+\t       size_text);\n \tshow_tree_common_default_long(options, base, pathname, base->len);\n \treturn recurse;\n }\n@@ -310,7 +311,7 @@ static int show_tree_object(const struct object_id *oid, struct strbuf *base,\n \tif (early >= 0)\n \t\treturn early;\n \n-\tstr = find_unique_abbrev(oid, options->abbrev);\n+\tstr = repo_find_unique_abbrev(the_repository, oid, options->abbrev);\n \tif (options->null_termination) {\n \t\tfputs(str, stdout);\n \t\tfputc('\\0', stdout);\n@@ -433,7 +434,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)\n \t\t\tls_tree_usage, ls_tree_options);\n \tif (argc < 1)\n \t\tusage_with_options(ls_tree_usage, ls_tree_options);\n-\tif (get_oid(argv[0], &oid))\n+\tif (repo_get_oid(the_repository, argv[0], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[0]);\n \n \t/*\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 6f3941f2a49..688d5c29b76 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -42,7 +42,7 @@ static struct commit *get_commit_reference(const char *arg)\n \tstruct object_id revkey;\n \tstruct commit *r;\n \n-\tif (get_oid(arg, &revkey))\n+\tif (repo_get_oid(the_repository, arg, &revkey))\n \t\tdie(\"Not a valid object name %s\", arg);\n \tr = lookup_commit_reference(the_repository, &revkey);\n \tif (!r)\n@@ -118,7 +118,7 @@ static int handle_fork_point(int argc, const char **argv)\n \tconst char *commitname;\n \n \tcommitname = (argc == 2) ? argv[1] : \"HEAD\";\n-\tif (get_oid(commitname, &oid))\n+\tif (repo_get_oid(the_repository, commitname, &oid))\n \t\tdie(\"Not a valid object name: '%s'\", commitname);\n \n \tderived = lookup_commit_reference(the_repository, &oid);\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex b9acbf5d342..a50b328d943 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -49,7 +49,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)\n \t\t}\n \t\tif (bases_count < ARRAY_SIZE(bases)-1) {\n \t\t\tstruct object_id *oid = xmalloc(sizeof(struct object_id));\n-\t\t\tif (get_oid(argv[i], oid))\n+\t\t\tif (repo_get_oid(the_repository, argv[i], oid))\n \t\t\t\tdie(_(\"could not parse object '%s'\"), argv[i]);\n \t\t\tbases[bases_count++] = oid;\n \t\t}\n@@ -70,9 +70,9 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)\n \to.branch1 = argv[++i];\n \to.branch2 = argv[++i];\n \n-\tif (get_oid(o.branch1, &h1))\n+\tif (repo_get_oid(the_repository, o.branch1, &h1))\n \t\tdie(_(\"could not resolve ref '%s'\"), o.branch1);\n-\tif (get_oid(o.branch2, &h2))\n+\tif (repo_get_oid(the_repository, o.branch2, &h2))\n \t\tdie(_(\"could not resolve ref '%s'\"), o.branch2);\n \n \to.branch1 = better1 = better_branch_name(o.branch1);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 0a3c10a0966..7331a0cd911 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -337,7 +337,7 @@ static int save_state(struct object_id *stash)\n \telse if (!len)\t\t/* no changes */\n \t\tgoto out;\n \tstrbuf_setlen(&buffer, buffer.len-1);\n-\tif (get_oid(buffer.buf, stash))\n+\tif (repo_get_oid(the_repository, buffer.buf, stash))\n \t\tdie(_(\"not a valid object: %s\"), buffer.buf);\n \trc = 0;\n out:\n@@ -1567,10 +1567,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \n \t\tif (verbosity >= 0) {\n \t\t\tprintf(_(\"Updating %s..%s\\n\"),\n-\t\t\t       find_unique_abbrev(&head_commit->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV),\n-\t\t\t       find_unique_abbrev(&remoteheads->item->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &head_commit->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV),\n+\t\t\t       repo_find_unique_abbrev(the_repository, &remoteheads->item->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV));\n \t\t}\n \t\tcommit = remoteheads->item;\n \t\tif (!commit) {\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 97959bfaf9e..35fd89f794d 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -493,7 +493,8 @@ static void show_name(const struct object *obj,\n \telse if (allow_undefined)\n \t\tprintf(\"undefined\\n\");\n \telse if (always)\n-\t\tprintf(\"%s\\n\", find_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\tprintf(\"%s\\n\",\n+\t\t       repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \telse\n \t\tdie(\"cannot describe '%s'\", oid_to_hex(oid));\n \tstrbuf_release(&buf);\n@@ -527,7 +528,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)\n \t\t\tcounter = 0;\n \n \t\t\t*(p+1) = 0;\n-\t\t\tif (!get_oid(p - (hexsz - 1), &oid)) {\n+\t\t\tif (!repo_get_oid(the_repository, p - (hexsz - 1), &oid)) {\n \t\t\t\tstruct object *o =\n \t\t\t\t\tlookup_object(the_repository, &oid);\n \t\t\t\tif (o)\n@@ -604,7 +605,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)\n \t\tstruct object *object;\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(*argv, &oid)) {\n+\t\tif (repo_get_oid(the_repository, *argv, &oid)) {\n \t\t\tfprintf(stderr, \"Could not get sha1 for %s. Skipping.\\n\",\n \t\t\t\t\t*argv);\n \t\t\tcontinue;\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 80d9dfd25ca..d98460e5d61 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -257,7 +257,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)\n \tif (d->buf.len)\n \t\tstrbuf_addch(&d->buf, '\\n');\n \n-\tif (get_oid(arg, &object))\n+\tif (repo_get_oid(the_repository, arg, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), arg);\n \tif (!(buf = read_object_file(&object, &type, &len)))\n \t\tdie(_(\"failed to read object '%s'.\"), arg);\n@@ -307,9 +307,9 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd)\n \t\t\tdie(_(\"malformed input line: '%s'.\"), buf.buf);\n \t\tstrbuf_rtrim(split[0]);\n \t\tstrbuf_rtrim(split[1]);\n-\t\tif (get_oid(split[0]->buf, &from_obj))\n+\t\tif (repo_get_oid(the_repository, split[0]->buf, &from_obj))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), split[0]->buf);\n-\t\tif (get_oid(split[1]->buf, &to_obj))\n+\t\tif (repo_get_oid(the_repository, split[1]->buf, &to_obj))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), split[1]->buf);\n \n \t\tif (rewrite_cmd)\n@@ -377,7 +377,7 @@ static int list(int argc, const char **argv, const char *prefix)\n \n \tt = init_notes_check(\"list\", 0);\n \tif (argc) {\n-\t\tif (get_oid(argv[0], &object))\n+\t\tif (repo_get_oid(the_repository, argv[0], &object))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), argv[0]);\n \t\tnote = get_note(t, &object);\n \t\tif (note) {\n@@ -432,7 +432,7 @@ static int add(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = argc > 1 ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"add\", NOTES_INIT_WRITABLE);\n@@ -520,12 +520,12 @@ static int copy(int argc, const char **argv, const char *prefix)\n \t\tusage_with_options(git_notes_copy_usage, options);\n \t}\n \n-\tif (get_oid(argv[0], &from_obj))\n+\tif (repo_get_oid(the_repository, argv[0], &from_obj))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), argv[0]);\n \n \tobject_ref = 1 < argc ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"copy\", NOTES_INIT_WRITABLE);\n@@ -604,7 +604,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = 1 < argc ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(argv[0], NOTES_INIT_WRITABLE);\n@@ -666,7 +666,7 @@ static int show(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = argc ? argv[0] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"show\", 0);\n@@ -716,7 +716,7 @@ static int merge_commit(struct notes_merge_options *o)\n \t * and target notes ref from .git/NOTES_MERGE_REF.\n \t */\n \n-\tif (get_oid(\"NOTES_MERGE_PARTIAL\", &oid))\n+\tif (repo_get_oid(the_repository, \"NOTES_MERGE_PARTIAL\", &oid))\n \t\tdie(_(\"failed to read ref NOTES_MERGE_PARTIAL\"));\n \telse if (!(partial = lookup_commit_reference(the_repository, &oid)))\n \t\tdie(_(\"could not find commit from NOTES_MERGE_PARTIAL.\"));\n@@ -895,7 +895,7 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag\n {\n \tint status;\n \tstruct object_id oid;\n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn error(_(\"Failed to resolve '%s' as a valid ref.\"), name);\n \tstatus = remove_note(t, oid.hash);\n \tif (status)\ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 27192201086..93be90825dc 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -168,7 +168,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)\n \t\tstruct object_id oid;\n \t\tconst char *name = *argv++;\n \n-\t\tif (!get_oid(name, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n \t\t\tstruct object *object = parse_object_or_die(&oid,\n \t\t\t\t\t\t\t\t    name);\n \t\t\tadd_pending_object(&revs, object, \"\");\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 1ab4de0005d..880eebcdd65 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -1036,7 +1036,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (file_exists(git_path_merge_head(the_repository)))\n \t\tdie_conclude_merge();\n \n-\tif (get_oid(\"HEAD\", &orig_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &orig_head))\n \t\toidclr(&orig_head);\n \n \tif (opt_rebase) {\n@@ -1061,7 +1061,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (opt_dry_run)\n \t\treturn 0;\n \n-\tif (get_oid(\"HEAD\", &curr_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &curr_head))\n \t\toidclr(&curr_head);\n \n \tif (!is_null_oid(&orig_head) && !is_null_oid(&curr_head) &&\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex aecfae12d3a..556ee84b6d3 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -65,20 +65,20 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)\n \n \tif (dash_dash == 3 ||\n \t    (dash_dash < 0 && argc > 2 &&\n-\t     !get_oid_committish(argv[0], &oid) &&\n-\t     !get_oid_committish(argv[1], &oid) &&\n-\t     !get_oid_committish(argv[2], &oid))) {\n+\t     !repo_get_oid_committish(the_repository, argv[0], &oid) &&\n+\t     !repo_get_oid_committish(the_repository, argv[1], &oid) &&\n+\t     !repo_get_oid_committish(the_repository, argv[2], &oid))) {\n \t\tif (dash_dash < 0)\n \t\t\t; /* already validated arguments */\n-\t\telse if (get_oid_committish(argv[0], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[0], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[0]);\n-\t\telse if (get_oid_committish(argv[1], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[1], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[1]);\n-\t\telse if (get_oid_committish(argv[2], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[2], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[2]);\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 3ce75417833..a1c6aa9641c 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -198,7 +198,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)\n \tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \n-\t\tif (get_oid(arg, &oid))\n+\t\tif (repo_get_oid(the_repository, arg, &oid))\n \t\t\tdie(\"Not a valid object name %s\", arg);\n \t\tif (list_tree(&oid) < 0)\n \t\t\tdie(\"failed to unpack tree object %s\", arg);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 6635f10d529..d5358ca89d2 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -218,13 +218,15 @@ static int get_revision_ranges(struct commit *upstream, struct commit *onto,\n \t*revisions = xstrfmt(\"%s...%s\", oid_to_hex(&base_rev->object.oid),\n \t\t\t     oid_to_hex(orig_head));\n \n-\tshorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);\n+\tshorthead = repo_find_unique_abbrev(the_repository, orig_head,\n+\t\t\t\t\t    DEFAULT_ABBREV);\n \n \tif (upstream) {\n \t\tconst char *shortrev;\n \n-\t\tshortrev = find_unique_abbrev(&base_rev->object.oid,\n-\t\t\t\t\t      DEFAULT_ABBREV);\n+\t\tshortrev = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t   &base_rev->object.oid,\n+\t\t\t\t\t\t   DEFAULT_ABBREV);\n \n \t\t*shortrevisions = xstrfmt(\"%s..%s\", shortrev, shorthead);\n \t} else\n@@ -1261,7 +1263,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\tint fd;\n \n \t\t/* Sanity check */\n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\tdie(_(\"Cannot read HEAD\"));\n \n \t\tfd = repo_hold_locked_index(the_repository, &lock_file, 0);\n@@ -1680,7 +1682,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t} else if (!options.onto_name)\n \t\toptions.onto_name = options.upstream_name;\n \tif (strstr(options.onto_name, \"...\")) {\n-\t\tif (get_oid_mb(options.onto_name, &branch_base) < 0) {\n+\t\tif (repo_get_oid_mb(the_repository, options.onto_name, &branch_base) < 0) {\n \t\t\tif (keep_base)\n \t\t\t\tdie(_(\"'%s': need exactly one merge base with branch\"),\n \t\t\t\t    options.upstream_name);\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex cd5c7a28eff..b5816624d25 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1347,7 +1347,7 @@ static int head_has_history(void)\n {\n \tstruct object_id oid;\n \n-\treturn !get_oid(\"HEAD\", &oid);\n+\treturn !repo_get_oid(the_repository, \"HEAD\", &oid);\n }\n \n static const char *push_to_deploy(unsigned char *sha1,\n@@ -1681,11 +1681,11 @@ static void check_aliased_update_internal(struct command *cmd,\n \trp_error(\"refusing inconsistent update between symref '%s' (%s..%s) and\"\n \t\t \" its target '%s' (%s..%s)\",\n \t\t cmd->ref_name,\n-\t\t find_unique_abbrev(&cmd->old_oid, DEFAULT_ABBREV),\n-\t\t find_unique_abbrev(&cmd->new_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &cmd->old_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &cmd->new_oid, DEFAULT_ABBREV),\n \t\t dst_cmd->ref_name,\n-\t\t find_unique_abbrev(&dst_cmd->old_oid, DEFAULT_ABBREV),\n-\t\t find_unique_abbrev(&dst_cmd->new_oid, DEFAULT_ABBREV));\n+\t\t repo_find_unique_abbrev(the_repository, &dst_cmd->old_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &dst_cmd->new_oid, DEFAULT_ABBREV));\n \n \tcmd->error_string = dst_cmd->error_string =\n \t\t\"inconsistent aliased update\";\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex a29e911d309..33c6cdb79c8 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -54,7 +54,7 @@ static int show_reference(struct repository *r, const char *refname,\n \t\t\tstruct object_id object;\n \t\t\tenum object_type obj_type, repl_type;\n \n-\t\t\tif (get_oid(refname, &object))\n+\t\t\tif (repo_get_oid(the_repository, refname, &object))\n \t\t\t\treturn error(_(\"failed to resolve '%s' as a valid ref\"), refname);\n \n \t\t\tobj_type = oid_object_info(r, &object, NULL);\n@@ -112,7 +112,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)\n \tbase_len = ref.len;\n \n \tfor (p = argv; *p; p++) {\n-\t\tif (get_oid(*p, &oid)) {\n+\t\tif (repo_get_oid(the_repository, *p, &oid)) {\n \t\t\terror(\"failed to resolve '%s' as a valid ref\", *p);\n \t\t\thad_error = 1;\n \t\t\tcontinue;\n@@ -206,10 +206,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f\n {\n \tstruct object_id object, repl;\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\treturn error(_(\"failed to resolve '%s' as a valid ref\"),\n \t\t\t     object_ref);\n-\tif (get_oid(replace_ref, &repl))\n+\tif (repo_get_oid(the_repository, replace_ref, &repl))\n \t\treturn error(_(\"failed to resolve '%s' as a valid ref\"),\n \t\t\t     replace_ref);\n \n@@ -320,7 +320,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n \tstruct object_id old_oid, new_oid, prev;\n \tstruct strbuf ref = STRBUF_INIT;\n \n-\tif (get_oid(object_ref, &old_oid) < 0)\n+\tif (repo_get_oid(the_repository, object_ref, &old_oid) < 0)\n \t\treturn error(_(\"not a valid object name: '%s'\"), object_ref);\n \n \ttype = oid_object_info(the_repository, &old_oid, NULL);\n@@ -375,7 +375,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)\n \t\tstruct object_id oid;\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(argv[i], &oid) < 0) {\n+\t\tif (repo_get_oid(the_repository, argv[i], &oid) < 0) {\n \t\t\tstrbuf_release(&new_parents);\n \t\t\treturn error(_(\"not a valid object name: '%s'\"),\n \t\t\t\t     argv[i]);\n@@ -422,7 +422,7 @@ static int check_one_mergetag(struct commit *commit,\n \t/* iterate over new parents */\n \tfor (i = 1; i < mergetag_data->argc; i++) {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(mergetag_data->argv[i], &oid) < 0)\n+\t\tif (repo_get_oid(the_repository, mergetag_data->argv[i], &oid) < 0)\n \t\t\treturn error(_(\"not a valid object name: '%s'\"),\n \t\t\t\t     mergetag_data->argv[i]);\n \t\tif (oideq(get_tagged_oid(tag), &oid))\n@@ -452,7 +452,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)\n \tconst char *buffer;\n \tunsigned long size;\n \n-\tif (get_oid(old_ref, &old_oid) < 0)\n+\tif (repo_get_oid(the_repository, old_ref, &old_oid) < 0)\n \t\treturn error(_(\"not a valid object name: '%s'\"), old_ref);\n \tcommit = lookup_commit_reference(the_repository, &old_oid);\n \tif (!commit)\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 0697fa89de2..75b447ffdc6 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -89,7 +89,7 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t\n \n \tif (reset_type == KEEP) {\n \t\tstruct object_id head_oid;\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\treturn error(_(\"You do not have a valid HEAD.\"));\n \t\tif (!fill_tree_descriptor(the_repository, desc + nr, &head_oid))\n \t\t\treturn error(_(\"Failed to find tree of HEAD.\"));\n@@ -124,7 +124,7 @@ static void print_new_head_line(struct commit *commit)\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tprintf(_(\"HEAD is now at %s\"),\n-\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \n \tpp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);\n \tif (buf.len > 0)\n@@ -260,8 +260,8 @@ static void parse_args(struct pathspec *pathspec,\n \t\t * has to be unambiguous. If there is a single argument, it\n \t\t * can not be a tree\n \t\t */\n-\t\telse if ((!argv[1] && !get_oid_committish(argv[0], &unused)) ||\n-\t\t\t (argv[1] && !get_oid_treeish(argv[0], &unused))) {\n+\t\telse if ((!argv[1] && !repo_get_oid_committish(the_repository, argv[0], &unused)) ||\n+\t\t\t (argv[1] && !repo_get_oid_treeish(the_repository, argv[0], &unused))) {\n \t\t\t/*\n \t\t\t * Ok, argv[0] looks like a commit/tree; it should not\n \t\t\t * be a filename.\n@@ -288,9 +288,9 @@ static int reset_refs(const char *rev, const struct object_id *oid)\n \tstruct object_id *orig = NULL, oid_orig,\n \t\t*old_orig = NULL, oid_old_orig;\n \n-\tif (!get_oid(\"ORIG_HEAD\", &oid_old_orig))\n+\tif (!repo_get_oid(the_repository, \"ORIG_HEAD\", &oid_old_orig))\n \t\told_orig = &oid_old_orig;\n-\tif (!get_oid(\"HEAD\", &oid_orig)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &oid_orig)) {\n \t\torig = &oid_orig;\n \t\tset_reflog_message(&msg, \"updating ORIG_HEAD\", NULL);\n \t\tupdate_ref(msg.buf, \"ORIG_HEAD\", orig, old_orig, 0,\n@@ -365,13 +365,14 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\tdie(_(\"the option '%s' requires '%s'\"), \"--pathspec-file-nul\", \"--pathspec-from-file\");\n \t}\n \n-\tunborn = !strcmp(rev, \"HEAD\") && get_oid(\"HEAD\", &oid);\n+\tunborn = !strcmp(rev, \"HEAD\") && repo_get_oid(the_repository, \"HEAD\",\n+\t\t\t\t\t\t      &oid);\n \tif (unborn) {\n \t\t/* reset on unborn branch: treat as reset to empty tree */\n \t\toidcpy(&oid, the_hash_algo->empty_tree);\n \t} else if (!pathspec.nr && !patch_mode) {\n \t\tstruct commit *commit;\n-\t\tif (get_oid_committish(rev, &oid))\n+\t\tif (repo_get_oid_committish(the_repository, rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid revision.\"), rev);\n \t\tcommit = lookup_commit_reference(the_repository, &oid);\n \t\tif (!commit)\n@@ -379,7 +380,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\toidcpy(&oid, &commit->object.oid);\n \t} else {\n \t\tstruct tree *tree;\n-\t\tif (get_oid_treeish(rev, &oid))\n+\t\tif (repo_get_oid_treeish(the_repository, rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid tree.\"), rev);\n \t\ttree = parse_tree_indirect(&oid);\n \t\tif (!tree)\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex d42db0b0cc9..0f55eae22eb 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -134,7 +134,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tif (!revs->graph)\n \t\t\tfputs(get_revision_mark(revs, commit), stdout);\n \t\tif (revs->abbrev_commit && revs->abbrev)\n-\t\t\tfputs(find_unique_abbrev(&commit->object.oid, revs->abbrev),\n+\t\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),\n \t\t\t      stdout);\n \t\telse\n \t\t\tfputs(oid_to_hex(&commit->object.oid), stdout);\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex e67999e5ebc..eb53a303de6 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -162,7 +162,8 @@ static void show_rev(int type, const struct object_id *oid, const char *name)\n \t\t}\n \t}\n \telse if (abbrev)\n-\t\tshow_with_type(type, find_unique_abbrev(oid, abbrev));\n+\t\tshow_with_type(type,\n+\t\t\t       repo_find_unique_abbrev(the_repository, oid, abbrev));\n \telse\n \t\tshow_with_type(type, oid_to_hex(oid));\n }\n@@ -187,7 +188,7 @@ static int show_default(void)\n \t\tstruct object_id oid;\n \n \t\tdef = NULL;\n-\t\tif (!get_oid(s, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, s, &oid)) {\n \t\t\tshow_rev(NORMAL, &oid, s);\n \t\t\treturn 1;\n \t\t}\n@@ -279,7 +280,7 @@ static int try_difference(const char *arg)\n \t\treturn 0;\n \t}\n \n-\tif (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {\n+\tif (!repo_get_oid_committish(the_repository, start, &start_oid) && !repo_get_oid_committish(the_repository, end, &end_oid)) {\n \t\tshow_rev(NORMAL, &end_oid, end);\n \t\tshow_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);\n \t\tif (symmetric) {\n@@ -337,7 +338,7 @@ static int try_parent_shorthands(const char *arg)\n \t\treturn 0;\n \n \t*dotdot = 0;\n-\tif (get_oid_committish(arg, &oid) ||\n+\tif (repo_get_oid_committish(the_repository, arg, &oid) ||\n \t    !(commit = lookup_commit_reference(the_repository, &oid))) {\n \t\t*dotdot = '^';\n \t\treturn 0;\n@@ -868,7 +869,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (skip_prefix(arg, \"--disambiguate=\", &arg)) {\n-\t\t\t\tfor_each_abbrev(arg, show_abbrev, NULL);\n+\t\t\t\trepo_for_each_abbrev(the_repository, arg,\n+\t\t\t\t\t\t     show_abbrev, NULL);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--bisect\")) {\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 8844f906557..25130f1b19e 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -370,7 +370,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t */\n \tif (!force) {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(\"HEAD\", &oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\t\toidclr(&oid);\n \t\tif (check_local_mod(&oid, index_only))\n \t\t\texit(1);\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 358ac3e519a..9e3b8ed27e1 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -312,8 +312,8 @@ static void show_one_commit(struct commit *commit, int no_name)\n \t\t}\n \t\telse\n \t\t\tprintf(\"[%s] \",\n-\t\t\t       find_unique_abbrev(&commit->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV));\n \t}\n \tputs(pretty_str);\n \tstrbuf_release(&pretty);\n@@ -414,7 +414,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))\n+\tif (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -429,7 +429,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))\n+\tif (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -533,7 +533,7 @@ static int show_independent(struct commit **rev,\n static void append_one_rev(const char *av)\n {\n \tstruct object_id revkey;\n-\tif (!get_oid(av, &revkey)) {\n+\tif (!repo_get_oid(the_repository, av, &revkey)) {\n \t\tappend_ref(av, &revkey, 0);\n \t\treturn;\n \t}\n@@ -836,7 +836,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tdie(Q_(\"cannot handle more than %d rev.\",\n \t\t\t       \"cannot handle more than %d revs.\",\n \t\t\t       MAX_REVS), MAX_REVS);\n-\t\tif (get_oid(ref_name[num_rev], &revkey))\n+\t\tif (repo_get_oid(the_repository, ref_name[num_rev], &revkey))\n \t\t\tdie(_(\"'%s' is not a valid ref.\"), ref_name[num_rev]);\n \t\tcommit = lookup_commit_reference(the_repository, &revkey);\n \t\tif (!commit)\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 3af6a53ee97..eb3ad1688ba 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -33,7 +33,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \tif (quiet)\n \t\treturn;\n \n-\thex = find_unique_abbrev(oid, abbrev);\n+\thex = repo_find_unique_abbrev(the_repository, oid, abbrev);\n \tif (hash_only)\n \t\tprintf(\"%s\\n\", hex);\n \telse\n@@ -43,7 +43,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \t\treturn;\n \n \tif (!peel_iterated_oid(oid, &peeled)) {\n-\t\thex = find_unique_abbrev(&peeled, abbrev);\n+\t\thex = repo_find_unique_abbrev(the_repository, &peeled, abbrev);\n \t\tprintf(\"%s %s^{}\\n\", hex, refname);\n \t}\n }\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex c3738154918..c5c8b7b89c7 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -471,7 +471,7 @@ static int sparse_checkout_init(int argc, const char **argv, const char *prefix)\n \t\treturn update_working_directory(NULL);\n \t}\n \n-\tif (get_oid(\"HEAD\", &oid)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n \t\tFILE *fp;\n \n \t\t/* assume we are in a fresh repo, but update the sparse-checkout file */\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 3a4f9fd566d..ed1275829e7 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -201,7 +201,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n \n \trevision = info->revision.buf;\n \n-\tif (get_oid(revision, &info->w_commit))\n+\tif (repo_get_oid(the_repository, revision, &info->w_commit))\n \t\treturn error(_(\"%s is not a valid reference\"), revision);\n \n \tassert_stash_like(info, revision);\n@@ -231,7 +231,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n static int do_clear_stash(void)\n {\n \tstruct object_id obj;\n-\tif (get_oid(ref_stash, &obj))\n+\tif (repo_get_oid(the_repository, ref_stash, &obj))\n \t\treturn 0;\n \n \treturn delete_ref(NULL, ref_stash, &obj, 0);\n@@ -1083,7 +1083,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)\n \tint ret = 0;\n \n \t/* No initial commit. */\n-\tif (get_oid(\"HEAD\", &dummy))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &dummy))\n \t\treturn -1;\n \n \tif (repo_read_index(the_repository) < 0)\n@@ -1355,7 +1355,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b\n \t\tgoto done;\n \t}\n \n-\tif (get_oid(\"HEAD\", &info->b_commit)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &info->b_commit)) {\n \t\tif (!quiet)\n \t\t\tfprintf_ln(stderr, _(\"You do not have \"\n \t\t\t\t\t     \"the initial commit yet\"));\n@@ -1373,8 +1373,9 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b\n \tbranch_ref = resolve_ref_unsafe(\"HEAD\", 0, NULL, &flags);\n \tif (flags & REF_ISSYMREF)\n \t\tskip_prefix(branch_ref, \"refs/heads/\", &branch_name);\n-\thead_short_sha1 = find_unique_abbrev(&head_commit->object.oid,\n-\t\t\t\t\t     DEFAULT_ABBREV);\n+\thead_short_sha1 = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t  &head_commit->object.oid,\n+\t\t\t\t\t\t  DEFAULT_ABBREV);\n \tstrbuf_addf(&msg, \"%s: %s \", branch_name, head_short_sha1);\n \tpp_commit_easy(CMIT_FMT_ONELINE, head_commit, &msg);\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 4c173d8b37a..25c70f415f1 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1174,7 +1174,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)\n \tif (!summary_limit)\n \t\treturn 0;\n \n-\tif (!get_oid(argc ? argv[0] : \"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(the_repository, argc ? argv[0] : \"HEAD\", &head_oid)) {\n \t\tif (argc) {\n \t\t\targv++;\n \t\t\targc--;\n@@ -1187,7 +1187,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)\n \t\t\targc--;\n \t\t}\n \t} else {\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\tdie(_(\"could not fetch a revision for HEAD\"));\n \t}\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex d428c45dc8d..e6cbf6e5a8d 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -137,7 +137,7 @@ static int delete_tags(const char **argv)\n \t\tif (!ref_exists(name))\n \t\t\tprintf(_(\"Deleted tag '%s' (was %s)\\n\"),\n \t\t\t\titem->string + 10,\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \n \t\tfree(oid);\n \t}\n@@ -593,7 +593,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tif (argc > 2)\n \t\tdie(_(\"too many arguments\"));\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"Failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tif (strbuf_check_tag_ref(&ref, tag))\n@@ -634,7 +634,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tref_transaction_free(transaction);\n \tif (force && !is_null_oid(&prev) && !oideq(&prev, &object))\n \t\tprintf(_(\"Updated tag '%s' (was %s)\\n\"), tag,\n-\t\t       find_unique_abbrev(&prev, DEFAULT_ABBREV));\n+\t\t       repo_find_unique_abbrev(the_repository, &prev, DEFAULT_ABBREV));\n \n cleanup:\n \tref_sorting_release(sorting);\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 88de32b7d7e..e0d5178acc5 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -29,7 +29,7 @@ int cmd_unpack_file(int argc, const char **argv, const char *prefix)\n \n \tif (argc != 2 || !strcmp(argv[1], \"-h\"))\n \t\tusage(\"git unpack-file <blob>\");\n-\tif (get_oid(argv[1], &oid))\n+\tif (repo_get_oid(the_repository, argv[1], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[1]);\n \n \tgit_config(git_default_config, NULL);\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex a84e7b47a20..1ba0727ba77 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -116,7 +116,7 @@ static int parse_next_oid(const char **next, const char *end,\n \t\t(*next)++;\n \t\t*next = parse_arg(*next, &arg);\n \t\tif (arg.len) {\n-\t\t\tif (get_oid(arg.buf, oid))\n+\t\t\tif (repo_get_oid(the_repository, arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else {\n \t\t\t/* Without -z, an empty value means all zeros: */\n@@ -134,7 +134,7 @@ static int parse_next_oid(const char **next, const char *end,\n \t\t*next += arg.len;\n \n \t\tif (arg.len) {\n-\t\t\tif (get_oid(arg.buf, oid))\n+\t\t\tif (repo_get_oid(the_repository, arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else if (flags & PARSE_SHA1_ALLOW_EMPTY) {\n \t\t\t/* With -z, treat an empty value as all zeros: */\n@@ -549,7 +549,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\trefname = argv[0];\n \t\tvalue = argv[1];\n \t\toldval = argv[2];\n-\t\tif (get_oid(value, &oid))\n+\t\tif (repo_get_oid(the_repository, value, &oid))\n \t\t\tdie(\"%s: not a valid SHA1\", value);\n \t}\n \n@@ -560,7 +560,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\t\t * must not already exist:\n \t\t\t */\n \t\t\toidclr(&oldoid);\n-\t\telse if (get_oid(oldval, &oldoid))\n+\t\telse if (repo_get_oid(the_repository, oldval, &oldoid))\n \t\t\tdie(\"%s: not a valid old SHA1\", oldval);\n \t}\n \ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 3ebad32b0f1..424b43083cb 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -39,7 +39,7 @@ static int verify_commit(const char *name, unsigned flags)\n \tstruct object_id oid;\n \tstruct object *obj;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn error(\"commit '%s' not found.\", name);\n \n \tobj = parse_object(the_repository, &oid);\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 217566952d8..050fd292515 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -60,7 +60,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \t\tstruct object_id oid;\n \t\tconst char *name = argv[i++];\n \n-\t\tif (get_oid(name, &oid)) {\n+\t\tif (repo_get_oid(the_repository, name, &oid)) {\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n \t\t\tcontinue;\n \t\t}\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 254283aa6f5..16fa30f01c8 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -552,7 +552,7 @@ static void print_preparing_worktree_line(int detach,\n \t\telse\n \t\t\tfprintf_ln(stderr, _(\"Preparing worktree (resetting branch '%s'; was at %s)\"),\n \t\t\t\t  new_branch,\n-\t\t\t\t  find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\t\t  repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \t} else if (new_branch) {\n \t\tfprintf_ln(stderr, _(\"Preparing worktree (new branch '%s')\"), new_branch);\n \t} else {\n@@ -566,7 +566,7 @@ static void print_preparing_worktree_line(int detach,\n \t\t\tif (!commit)\n \t\t\t\tdie(_(\"invalid reference: %s\"), branch);\n \t\t\tfprintf_ln(stderr, _(\"Preparing worktree (detached HEAD %s)\"),\n-\t\t\t\t  find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\t\t  repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \t\t}\n \t\tstrbuf_release(&s);\n \t}\n@@ -756,7 +756,7 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)\n \t\tstrbuf_addstr(&sb, \"(bare)\");\n \telse {\n \t\tstrbuf_addf(&sb, \"%-*s \", abbrev_len,\n-\t\t\t\tfind_unique_abbrev(&wt->head_oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, &wt->head_oid, DEFAULT_ABBREV));\n \t\tif (wt->is_detached)\n \t\t\tstrbuf_addstr(&sb, \"(detached HEAD)\");\n \t\telse if (wt->head_ref) {\n@@ -793,7 +793,7 @@ static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)\n \n \t\tif (path_len > *maxlen)\n \t\t\t*maxlen = path_len;\n-\t\tsha1_len = strlen(find_unique_abbrev(&wt[i]->head_oid, *abbrev));\n+\t\tsha1_len = strlen(repo_find_unique_abbrev(the_repository, &wt[i]->head_oid, *abbrev));\n \t\tif (sha1_len > *abbrev)\n \t\t\t*abbrev = sha1_len;\n \t}\ndiff --git a/cache.h b/cache.h\nindex 12789903e88..d835ac8b4d2 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1211,9 +1211,7 @@ void check_repository_format(struct repository_format *fmt);\n  * reentrant, as it calls into other non-reentrant git code.\n  */\n const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);\n-#define find_unique_abbrev(oid, len) repo_find_unique_abbrev(the_repository, oid, len)\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n-#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n /* set default permissions by passing mode arguments to open(2) */\n int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n@@ -1488,17 +1486,8 @@ enum get_oid_result get_oid_with_context(struct repository *repo, const char *st\n \t\t\t\t\t unsigned flags, struct object_id *oid,\n \t\t\t\t\t struct object_context *oc);\n \n-#define get_oid(str, oid)\t\trepo_get_oid(the_repository, str, oid)\n-#define get_oid_commit(str, oid)\trepo_get_oid_commit(the_repository, str, oid)\n-#define get_oid_committish(str, oid)\trepo_get_oid_committish(the_repository, str, oid)\n-#define get_oid_tree(str, oid)\t\trepo_get_oid_tree(the_repository, str, oid)\n-#define get_oid_treeish(str, oid)\trepo_get_oid_treeish(the_repository, str, oid)\n-#define get_oid_blob(str, oid)\t\trepo_get_oid_blob(the_repository, str, oid)\n-#define get_oid_mb(str, oid) \t\trepo_get_oid_mb(the_repository, str, oid)\n-\n typedef int each_abbrev_fn(const struct object_id *oid, void *);\n int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);\n-#define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)\n \n int set_disambiguate_hint_config(const char *var, const char *value);\n \n@@ -1608,8 +1597,6 @@ int repo_interpret_branch_name(struct repository *r,\n \t\t\t       const char *str, int len,\n \t\t\t       struct strbuf *buf,\n \t\t\t       const struct interpret_branch_name_options *options);\n-#define interpret_branch_name(str, len, buf, options) \\\n-\trepo_interpret_branch_name(the_repository, str, len, buf, options)\n \n int validate_headref(const char *ref);\n \n@@ -1629,8 +1616,6 @@ void *read_object_with_reference(struct repository *r,\n struct object *repo_peel_to_type(struct repository *r,\n \t\t\t\t const char *name, int namelen,\n \t\t\t\t struct object *o, enum object_type);\n-#define peel_to_type(name, namelen, obj, type) \\\n-\trepo_peel_to_type(the_repository, name, namelen, obj, type)\n \n #define IDENT_STRICT\t       1\n #define IDENT_NO_DATE\t       2\ndiff --git a/checkout.c b/checkout.c\nindex 2e39dae684f..1247b882248 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -23,7 +23,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)\n \tmemset(&query, 0, sizeof(struct refspec_item));\n \tquery.src = cb->src_ref;\n \tif (remote_find_tracking(remote, &query) ||\n-\t    get_oid(query.dst, cb->dst_oid)) {\n+\t    repo_get_oid(the_repository, query.dst, cb->dst_oid)) {\n \t\tfree(query.dst);\n \t\treturn 0;\n \t}\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 1a39b5dde09..d84ab878b72 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -948,11 +948,11 @@ static void show_combined_header(struct combine_diff_path *elem,\n \t\t\t \"\", elem->path, line_prefix, c_meta, c_reset);\n \tprintf(\"%s%sindex \", line_prefix, c_meta);\n \tfor (i = 0; i < num_parent; i++) {\n-\t\tabb = find_unique_abbrev(&elem->parent[i].oid,\n-\t\t\t\t\t abbrev);\n+\t\tabb = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t      &elem->parent[i].oid, abbrev);\n \t\tprintf(\"%s%s\", i ? \",\" : \"\", abb);\n \t}\n-\tabb = find_unique_abbrev(&elem->oid, abbrev);\n+\tabb = repo_find_unique_abbrev(the_repository, &elem->oid, abbrev);\n \tprintf(\"..%s%s\\n\", abb, c_reset);\n \n \tif (mode_differs) {\ndiff --git a/commit.c b/commit.c\nindex e433c33bb01..06a7c728e80 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -80,7 +80,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)\n \tstruct object_id oid;\n \tstruct commit *commit;\n \n-\tif (get_oid_committish(name, &oid))\n+\tif (repo_get_oid_committish(the_repository, name, &oid))\n \t\treturn NULL;\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (parse_commit(commit))\n@@ -1271,7 +1271,8 @@ void verify_merge_signature(struct commit *commit, int verbosity,\n \n \tret = check_commit_signature(commit, &signature_check);\n \n-\tfind_unique_abbrev_r(hex, &commit->object.oid, DEFAULT_ABBREV);\n+\trepo_find_unique_abbrev_r(the_repository, hex, &commit->object.oid,\n+\t\t\t\t  DEFAULT_ABBREV);\n \tswitch (signature_check.result) {\n \tcase 'G':\n \t\tif (ret || (check_trust && signature_check.trust_level < TRUST_MARGINAL))\n@@ -1632,10 +1633,11 @@ struct commit *get_merge_parent(const char *name)\n \tstruct object *obj;\n \tstruct commit *commit;\n \tstruct object_id oid;\n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn NULL;\n \tobj = parse_object(the_repository, &oid);\n-\tcommit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);\n+\tcommit = (struct commit *)repo_peel_to_type(the_repository, name, 0,\n+\t\t\t\t\t\t    obj, OBJ_COMMIT);\n \tif (commit && !merge_remote_util(commit))\n \t\tset_merge_remote_desc(commit, name, obj);\n \treturn commit;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nnew file mode 100644\nindex 00000000000..dcdba314fc2\n--- /dev/null\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -0,0 +1,44 @@\n+// Fully migrated \"the_repository\" additions\n+@@\n+@@\n+(\n+// cache.h\n+- get_oid\n++ repo_get_oid\n+|\n+- get_oid_commit\n++ repo_get_oid_commit\n+|\n+- get_oid_committish\n++ repo_get_oid_committish\n+|\n+- get_oid_tree\n++ repo_get_oid_tree\n+|\n+- get_oid_treeish\n++ repo_get_oid_treeish\n+|\n+- get_oid_blob\n++ repo_get_oid_blob\n+|\n+- get_oid_mb\n++ repo_get_oid_mb\n+|\n+- find_unique_abbrev\n++ repo_find_unique_abbrev\n+|\n+- find_unique_abbrev_r\n++ repo_find_unique_abbrev_r\n+|\n+- for_each_abbrev\n++ repo_for_each_abbrev\n+|\n+- interpret_branch_name\n++ repo_interpret_branch_name\n+|\n+- peel_to_type\n++ repo_peel_to_type\n+)\n+  (\n++ the_repository,\n+  ...)\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 8b3f2580e6b..2d200ab83e7 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,44 +5,7 @@\n @@\n @@\n (\n-// cache.h\n-- get_oid\n-+ repo_get_oid\n-|\n-- get_oid_commit\n-+ repo_get_oid_commit\n-|\n-- get_oid_committish\n-+ repo_get_oid_committish\n-|\n-- get_oid_tree\n-+ repo_get_oid_tree\n-|\n-- get_oid_treeish\n-+ repo_get_oid_treeish\n-|\n-- get_oid_blob\n-+ repo_get_oid_blob\n-|\n-- get_oid_mb\n-+ repo_get_oid_mb\n-|\n-- find_unique_abbrev\n-+ repo_find_unique_abbrev\n-|\n-- find_unique_abbrev_r\n-+ repo_find_unique_abbrev_r\n-|\n-- for_each_abbrev\n-+ repo_for_each_abbrev\n-|\n-- interpret_branch_name\n-+ repo_interpret_branch_name\n-|\n-- peel_to_type\n-+ repo_peel_to_type\n // commit-reach.h\n-|\n - get_merge_bases\n + repo_get_merge_bases\n |\ndiff --git a/diff-lib.c b/diff-lib.c\nindex dec040c366c..24470b21612 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -581,7 +581,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)\n \tif (revs->pending.nr == 1) {\n \t\tstruct object_id oid;\n \n-\t\tif (get_oid(\"HEAD\", &oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\t\tdie(_(\"unable to get HEAD\"));\n \n \t\tmb_child[1] = lookup_commit_reference(the_repository, &oid);\ndiff --git a/diff.c b/diff.c\nindex 469e18aed20..3abeca9d46c 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4351,7 +4351,7 @@ static int similarity_index(struct diff_filepair *p)\n static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)\n {\n \tif (startup_info->have_repository)\n-\t\treturn find_unique_abbrev(oid, abbrev);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid, abbrev);\n \telse {\n \t\tchar *hex = oid_to_hex(oid);\n \t\tif (abbrev < 0)\n@@ -4988,7 +4988,7 @@ static int diff_opt_find_object(const struct option *option,\n \tstruct object_id oid;\n \n \tBUG_ON_OPT_NEG(unset);\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"unable to resolve '%s'\"), arg);\n \n \tif (!opt->objfind)\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex f48f44f9cd1..e8e2d4ea0d0 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -605,7 +605,9 @@ static void find_merge_parents(struct merge_parents *result,\n \t\t * util field yet.\n \t\t */\n \t\tobj = parse_object(the_repository, &oid);\n-\t\tparent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);\n+\t\tparent = (struct commit *)repo_peel_to_type(the_repository,\n+\t\t\t\t\t\t\t    NULL, 0, obj,\n+\t\t\t\t\t\t\t    OBJ_COMMIT);\n \t\tif (!parent)\n \t\t\tcontinue;\n \t\tcommit_list_insert(parent, &parents);\ndiff --git a/log-tree.c b/log-tree.c\nindex 1dd5fcbf7be..f36adb947e8 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -233,7 +233,8 @@ static void show_parents(struct commit *commit, int abbrev, FILE *file)\n \tstruct commit_list *p;\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n-\t\tfprintf(file, \" %s\", find_unique_abbrev(&parent->object.oid, abbrev));\n+\t\tfprintf(file, \" %s\",\n+\t\t\trepo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev));\n \t}\n }\n \n@@ -241,7 +242,8 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre\n {\n \tstruct commit_list *p = lookup_decoration(&opt->children, &commit->object);\n \tfor ( ; p; p = p->next) {\n-\t\tfprintf(opt->diffopt.file, \" %s\", find_unique_abbrev(&p->item->object.oid, abbrev));\n+\t\tfprintf(opt->diffopt.file, \" %s\",\n+\t\t\trepo_find_unique_abbrev(the_repository, &p->item->object.oid, abbrev));\n \t}\n }\n \n@@ -644,7 +646,8 @@ void show_log(struct rev_info *opt)\n \n \t\tif (!opt->graph)\n \t\t\tput_revision_mark(opt, commit);\n-\t\tfputs(find_unique_abbrev(&commit->object.oid, abbrev_commit), opt->diffopt.file);\n+\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev_commit),\n+\t\t      opt->diffopt.file);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit, opt->diffopt.file);\n \t\tif (opt->children.name)\n@@ -706,8 +709,8 @@ void show_log(struct rev_info *opt)\n \n \t\tif (!opt->graph)\n \t\t\tput_revision_mark(opt, commit);\n-\t\tfputs(find_unique_abbrev(&commit->object.oid,\n-\t\t\t\t\t abbrev_commit),\n+\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t\t      abbrev_commit),\n \t\t      opt->diffopt.file);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit, opt->diffopt.file);\n@@ -715,7 +718,7 @@ void show_log(struct rev_info *opt)\n \t\t\tshow_children(opt, commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tfprintf(opt->diffopt.file, \" (from %s)\",\n-\t\t\t       find_unique_abbrev(&parent->object.oid, abbrev_commit));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev_commit));\n \t\tfputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), opt->diffopt.file);\n \t\tshow_decorations(opt, commit);\n \t\tif (opt->commit_format == CMIT_FMT_ONELINE) {\ndiff --git a/mailmap.c b/mailmap.c\nindex da2589b0822..ed8289aea58 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -213,7 +213,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)\n \n \tif (!name)\n \t\treturn 0;\n-\tif (get_oid(name, &oid) < 0)\n+\tif (repo_get_oid(the_repository, name, &oid) < 0)\n \t\treturn 0;\n \n \tbuf = read_object_file(&oid, &type, &size);\ndiff --git a/notes-merge.c b/notes-merge.c\nindex b4cc594a790..d290c7478e2 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -566,7 +566,7 @@ int notes_merge(struct notes_merge_options *o,\n \ttrace_printf(\"\\tlocal commit: %.7s\\n\", oid_to_hex(&local_oid));\n \n \t/* Dereference o->remote_ref into remote_oid */\n-\tif (get_oid(o->remote_ref, &remote_oid)) {\n+\tif (repo_get_oid(the_repository, o->remote_ref, &remote_oid)) {\n \t\t/*\n \t\t * Failed to get remote_oid. If o->remote_ref looks like an\n \t\t * unborn ref, perform the merge using an empty notes tree.\ndiff --git a/notes.c b/notes.c\nindex f2805d51bb1..750e18c4004 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -944,7 +944,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob)\n \t\tfor_each_glob_ref(string_list_add_one_ref, glob, list);\n \t} else {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(glob, &oid))\n+\t\tif (repo_get_oid(the_repository, glob, &oid))\n \t\t\twarning(\"notes ref %s is invalid\", glob);\n \t\tif (!unsorted_string_list_has_string(list, glob))\n \t\t\tstring_list_append(list, glob);\n@@ -1021,7 +1021,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,\n \tt->dirty = 0;\n \n \tif (flags & NOTES_INIT_EMPTY || !notes_ref ||\n-\t    get_oid_treeish(notes_ref, &object_oid))\n+\t    repo_get_oid_treeish(the_repository, notes_ref, &object_oid))\n \t\treturn;\n \tif (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))\n \t\tdie(\"Cannot use notes ref %s\", notes_ref);\n@@ -1348,7 +1348,7 @@ void expand_loose_notes_ref(struct strbuf *sb)\n {\n \tstruct object_id object;\n \n-\tif (get_oid(sb->buf, &object)) {\n+\tif (repo_get_oid(the_repository, sb->buf, &object)) {\n \t\t/* fallback to expand_notes_ref */\n \t\texpand_notes_ref(sb);\n \t}\ndiff --git a/object-name.c b/object-name.c\nindex 2dd1a0f56e1..21e8f67489e 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1666,7 +1666,8 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)\n \tstruct interpret_branch_name_options options = {\n \t\t.allowed = allowed\n \t};\n-\tint used = interpret_branch_name(name, len, sb, &options);\n+\tint used = repo_interpret_branch_name(the_repository, name, len, sb,\n+\t\t\t\t\t      &options);\n \n \tif (used < 0)\n \t\tused = 0;\n@@ -1719,7 +1720,7 @@ int get_oidf(struct object_id *oid, const char *fmt, ...)\n \tstrbuf_vaddf(&sb, fmt, ap);\n \tva_end(ap);\n \n-\tret = get_oid(sb.buf, oid);\n+\tret = repo_get_oid(the_repository, sb.buf, oid);\n \tstrbuf_release(&sb);\n \n \treturn ret;\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex d346dbe2100..0f7b40d0c08 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -91,7 +91,7 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)\n \n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(\"malformed object name %s\", arg);\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (!commit)\n@@ -110,7 +110,7 @@ int parse_opt_commit(const struct option *opt, const char *arg, int unset)\n \n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(\"malformed object name %s\", arg);\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (!commit)\n@@ -129,7 +129,7 @@ int parse_opt_object_name(const struct option *opt, const char *arg, int unset)\n \t}\n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"malformed object name '%s'\"), arg);\n \toid_array_append(opt->value, &oid);\n \treturn 0;\n@@ -146,7 +146,7 @@ int parse_opt_object_id(const struct option *opt, const char *arg, int unset)\n \t}\n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"malformed object name '%s'\"), arg);\n \t*target = oid;\n \treturn 0;\ndiff --git a/range-diff.c b/range-diff.c\nindex 4bd65ab7496..5bcf966f6c5 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -94,7 +94,7 @@ static int read_patches(const char *range, struct string_list *list,\n \t\t\t\tstrbuf_reset(&buf);\n \t\t\t}\n \t\t\tCALLOC_ARRAY(util, 1);\n-\t\t\tif (get_oid(p, &util->oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p, &util->oid)) {\n \t\t\t\terror(_(\"could not parse commit '%s'\"), p);\n \t\t\t\tFREE_AND_NULL(util);\n \t\t\t\tstring_list_clear(list, 1);\n@@ -390,7 +390,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \n \tif (!dashes->len)\n \t\tstrbuf_addchars(dashes, '-',\n-\t\t\t\tstrlen(find_unique_abbrev(oid, abbrev)));\n+\t\t\t\tstrlen(repo_find_unique_abbrev(the_repository, oid, abbrev)));\n \n \tif (!b_util) {\n \t\tcolor = color_old;\n@@ -412,7 +412,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \t\tstrbuf_addf(buf, \"%*s:  %s \", patch_no_width, \"-\", dashes->buf);\n \telse\n \t\tstrbuf_addf(buf, \"%*d:  %s \", patch_no_width, a_util->i + 1,\n-\t\t\t    find_unique_abbrev(&a_util->oid, abbrev));\n+\t\t\t    repo_find_unique_abbrev(the_repository, &a_util->oid, abbrev));\n \n \tif (status == '!')\n \t\tstrbuf_addf(buf, \"%s%s\", color_reset, color);\n@@ -424,7 +424,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \t\tstrbuf_addf(buf, \" %*s:  %s\", patch_no_width, \"-\", dashes->buf);\n \telse\n \t\tstrbuf_addf(buf, \" %*d:  %s\", patch_no_width, b_util->i + 1,\n-\t\t\t    find_unique_abbrev(&b_util->oid, abbrev));\n+\t\t\t    repo_find_unique_abbrev(the_repository, &b_util->oid, abbrev));\n \n \tcommit = lookup_commit_reference(the_repository, oid);\n \tif (commit) {\ndiff --git a/read-cache.c b/read-cache.c\nindex 35e5657877c..d6c69164d0f 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2628,7 +2628,7 @@ int repo_index_has_changes(struct repository *repo,\n \n \tif (tree)\n \t\tcmp = tree->object.oid;\n-\tif (tree || !get_oid_tree(\"HEAD\", &cmp)) {\n+\tif (tree || !repo_get_oid_tree(the_repository, \"HEAD\", &cmp)) {\n \t\tstruct diff_options opt;\n \n \t\trepo_diff_setup(repo, &opt);\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7407c593191..c151db0ad2f 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -187,7 +187,7 @@ int todo_list_check(struct todo_list *old_todo, struct todo_list *new_todo)\n \t\tstruct commit *commit = item->commit;\n \t\tif (commit && !*commit_seen_at(&commit_seen, commit)) {\n \t\t\tstrbuf_addf(&missing, \" - %s %.*s\\n\",\n-\t\t\t\t    find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV),\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n \t\t\t\t    item->arg_len,\n \t\t\t\t    todo_item_get_arg(old_todo, item));\n \t\t\t*commit_seen_at(&commit_seen, commit) = 1;\ndiff --git a/ref-filter.c b/ref-filter.c\nindex f8203c6b052..c6cd131e70b 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1075,9 +1075,11 @@ static const char *do_grab_oid(const char *field, const struct object_id *oid,\n \tcase O_FULL:\n \t\treturn oid_to_hex(oid);\n \tcase O_LENGTH:\n-\t\treturn find_unique_abbrev(oid, atom->u.oid.length);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid,\n+\t\t\t\t\t       atom->u.oid.length);\n \tcase O_SHORT:\n-\t\treturn find_unique_abbrev(oid, DEFAULT_ABBREV);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid,\n+\t\t\t\t\t       DEFAULT_ABBREV);\n \tdefault:\n \t\tBUG(\"unknown %%(%s) option\", field);\n \t}\n@@ -2765,7 +2767,7 @@ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)\n \n \tBUG_ON_OPT_NEG(unset);\n \n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\tdie(_(\"malformed object name %s\"), arg);\n \n \tmerge_commit = lookup_commit_reference_gently(the_repository, &oid, 0);\ndiff --git a/remote.c b/remote.c\nindex 60869beebe7..ff9b0238318 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1163,7 +1163,7 @@ static int try_explicit_object_name(const char *name,\n \t\treturn 0;\n \t}\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn -1;\n \n \tif (match) {\n@@ -1251,7 +1251,7 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,\n \tif (!advice_enabled(ADVICE_PUSH_UNQUALIFIED_REF_NAME))\n \t\treturn;\n \n-\tif (get_oid(matched_src_name, &oid))\n+\tif (repo_get_oid(the_repository, matched_src_name, &oid))\n \t\tBUG(\"'%s' is not a valid object, \"\n \t\t    \"match_explicit_lhs() should catch this!\",\n \t\t    matched_src_name);\n@@ -2505,7 +2505,7 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i\n \t\tentry->use_tracking = 1;\n \telse if (!colon[1])\n \t\toidclr(&entry->expect);\n-\telse if (get_oid(colon + 1, &entry->expect))\n+\telse if (repo_get_oid(the_repository, colon + 1, &entry->expect))\n \t\treturn error(_(\"cannot parse expected object name '%s'\"),\n \t\t\t     colon + 1);\n \treturn 0;\ndiff --git a/reset.c b/reset.c\nindex 5ded23611f3..3a9c6dfdd0a 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -38,7 +38,7 @@ static int update_refs(const struct reset_head_opts *opts,\n \tprefix_len = msg.len;\n \n \tif (update_orig_head) {\n-\t\tif (!get_oid(\"ORIG_HEAD\", &oid_old_orig))\n+\t\tif (!repo_get_oid(the_repository, \"ORIG_HEAD\", &oid_old_orig))\n \t\t\told_orig = &oid_old_orig;\n \t\tif (head) {\n \t\t\tif (!reflog_orig_head) {\n@@ -106,7 +106,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)\n \t\tgoto leave_reset_head;\n \t}\n \n-\tif (!get_oid(\"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n \t\thead = &head_oid;\n \t} else if (!oid || !reset_hard) {\n \t\tret = error(_(\"could not determine HEAD revision\"));\ndiff --git a/revision.c b/revision.c\nindex 21f5f572c22..0f775ee2e90 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -324,7 +324,8 @@ static void add_pending_object_with_path(struct rev_info *revs,\n \tif (revs->reflog_info && obj->type == OBJ_COMMIT) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tsize_t namelen = strlen(name);\n-\t\tint len = interpret_branch_name(name, namelen, &buf, &options);\n+\t\tint len = repo_interpret_branch_name(the_repository, name,\n+\t\t\t\t\t\t     namelen, &buf, &options);\n \n \t\tif (0 < len && len < namelen && buf.len)\n \t\t\tstrbuf_addstr(&buf, name + len);\n@@ -354,7 +355,7 @@ void add_head_to_pending(struct rev_info *revs)\n {\n \tstruct object_id oid;\n \tstruct object *obj;\n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\treturn;\n \tobj = parse_object(revs->repo, &oid);\n \tif (!obj)\n@@ -1867,7 +1868,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,\n \t\tflags ^= UNINTERESTING | BOTTOM;\n \t\targ++;\n \t}\n-\tif (get_oid_committish(arg, &oid))\n+\tif (repo_get_oid_committish(the_repository, arg, &oid))\n \t\treturn 0;\n \twhile (1) {\n \t\tit = get_reference(revs, arg, &oid, 0);\n@@ -1948,10 +1949,10 @@ static void prepare_show_merge(struct rev_info *revs)\n \tint i, prune_num = 1; /* counting terminating NULL */\n \tstruct index_state *istate = revs->repo->index;\n \n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\tdie(\"--merge without HEAD?\");\n \thead = lookup_commit_or_die(&oid, \"HEAD\");\n-\tif (get_oid(\"MERGE_HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"MERGE_HEAD\", &oid))\n \t\tdie(\"--merge without MERGE_HEAD?\");\n \tother = lookup_commit_or_die(&oid, \"MERGE_HEAD\");\n \tadd_pending_object(revs, &head->object, \"HEAD\");\ndiff --git a/sequencer.c b/sequencer.c\nindex 1c96a75b1e9..818932a630a 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -419,7 +419,8 @@ struct commit_message {\n \n static const char *short_commit_name(struct commit *commit)\n {\n-\treturn find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t       DEFAULT_ABBREV);\n }\n \n static int get_message(struct commit *commit, struct commit_message *out)\n@@ -561,7 +562,7 @@ static void update_abort_safety_file(void)\n \tif (!file_exists(git_path_seq_dir()))\n \t\treturn;\n \n-\tif (!get_oid(\"HEAD\", &head))\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head))\n \t\twrite_file(git_path_abort_safety_file(), \"%s\", oid_to_hex(&head));\n \telse\n \t\twrite_file(git_path_abort_safety_file(), \"%s\", \"\");\n@@ -1406,7 +1407,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \tstruct commit *current_head;\n \tstruct object_id oid;\n \n-\tif (get_oid(\"HEAD\", &oid)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n \t\tcurrent_head = NULL;\n \t} else {\n \t\tcurrent_head = lookup_commit_reference(r, &oid);\n@@ -1997,7 +1998,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstruct commit *head_commit;\n \t\tconst char *head_message, *body;\n \n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n@@ -2067,7 +2068,7 @@ static void flush_rewritten_pending(void)\n \tFILE *out;\n \n \tif (strbuf_read_file(&buf, rebase_path_rewritten_pending(), (GIT_MAX_HEXSZ + 1) * 2) > 0 &&\n-\t    !get_oid(\"HEAD\", &newoid) &&\n+\t    !repo_get_oid(the_repository, \"HEAD\", &newoid) &&\n \t    (out = fopen_or_warn(rebase_path_rewritten_list(), \"a\"))) {\n \t\tchar *bol = buf.buf, *eol;\n \n@@ -2152,7 +2153,7 @@ static int do_pick_commit(struct repository *r,\n \t\tif (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))\n \t\t\treturn error(_(\"your index file is unmerged.\"));\n \t} else {\n-\t\tunborn = get_oid(\"HEAD\", &head);\n+\t\tunborn = repo_get_oid(the_repository, \"HEAD\", &head);\n \t\t/* Do we want to generate a root commit? */\n \t\tif (is_pick_or_similar(command) && opts->have_squash_onto &&\n \t\t    oideq(&head, &opts->squash_onto)) {\n@@ -2606,7 +2607,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \tend_of_object_name = (char *) bol + strcspn(bol, \" \\t\\n\");\n \tsaved = *end_of_object_name;\n \t*end_of_object_name = '\\0';\n-\tstatus = get_oid(bol, &commit_oid);\n+\tstatus = repo_get_oid(the_repository, bol, &commit_oid);\n \tif (status < 0)\n \t\terror(_(\"could not parse '%s'\"), bol); /* return later */\n \t*end_of_object_name = saved;\n@@ -3022,7 +3023,7 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\t}\n \n \t\tif (read_oneliner(&buf, rebase_path_squash_onto(), 0)) {\n-\t\t\tif (get_oid_committish(buf.buf, &opts->squash_onto) < 0) {\n+\t\t\tif (repo_get_oid_committish(the_repository, buf.buf, &opts->squash_onto) < 0) {\n \t\t\t\tret = error(_(\"unusable squash-onto\"));\n \t\t\t\tgoto done_rebase_i;\n \t\t\t}\n@@ -3223,7 +3224,7 @@ static int rollback_is_safe(void)\n \telse\n \t\tdie_errno(_(\"could not read '%s'\"), git_path_abort_safety_file());\n \n-\tif (get_oid(\"HEAD\", &actual_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &actual_head))\n \t\toidclr(&actual_head);\n \n \treturn oideq(&actual_head, &expected_head);\n@@ -3534,7 +3535,7 @@ static int intend_to_amend(void)\n \tstruct object_id head;\n \tchar *p;\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\treturn error(_(\"cannot read HEAD\"));\n \n \tp = oid_to_hex(&head);\n@@ -3700,7 +3701,7 @@ static int do_label(struct repository *r, const char *name, int len)\n \tif (!transaction) {\n \t\terror(\"%s\", err.buf);\n \t\tret = -1;\n-\t} else if (get_oid(\"HEAD\", &head_oid)) {\n+\t} else if (repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n \t\terror(_(\"could not read HEAD\"));\n \t\tret = -1;\n \t} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,\n@@ -4456,7 +4457,7 @@ void create_autostash(struct repository *r, const char *path)\n \t\tif (capture_command(&stash, &buf, GIT_MAX_HEXSZ))\n \t\t\tdie(_(\"Cannot autostash\"));\n \t\tstrbuf_trim_trailing_newline(&buf);\n-\t\tif (get_oid(buf.buf, &oid))\n+\t\tif (repo_get_oid(the_repository, buf.buf, &oid))\n \t\t\tdie(_(\"Unexpected stash response: '%s'\"),\n \t\t\t    buf.buf);\n \t\tstrbuf_reset(&buf);\n@@ -4581,7 +4582,7 @@ static int stopped_at_head(struct repository *r)\n \tstruct commit *commit;\n \tstruct commit_message message;\n \n-\tif (get_oid(\"HEAD\", &head) ||\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n \t    parse_commit(commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n@@ -4731,7 +4732,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t * otherwise we do not.\n \t\t\t\t */\n \t\t\t\tif (item->command == TODO_REWORD &&\n-\t\t\t\t    !get_oid(\"HEAD\", &oid) &&\n+\t\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n \t\t\t\t    (oideq(&item->commit->object.oid, &oid) ||\n \t\t\t\t     (opts->have_squash_onto &&\n \t\t\t\t      oideq(&opts->squash_onto, &oid))))\n@@ -4820,7 +4821,7 @@ static int pick_commits(struct repository *r,\n \t\t\tstruct object_id head, orig;\n \t\t\tint res;\n \n-\t\t\tif (get_oid(\"HEAD\", &head)) {\n+\t\t\tif (repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\t\t\tres = error(_(\"cannot read HEAD\"));\n cleanup_head_ref:\n \t\t\t\tstrbuf_release(&head_ref);\n@@ -4867,8 +4868,8 @@ static int pick_commits(struct repository *r,\n \t\t\tlog_tree_opt.disable_stdin = 1;\n \n \t\t\tif (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n-\t\t\t    !get_oid(buf.buf, &orig) &&\n-\t\t\t    !get_oid(\"HEAD\", &head)) {\n+\t\t\t    !repo_get_oid(the_repository, buf.buf, &orig) &&\n+\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\t\t\tdiff_tree_oid(&orig, &head, \"\",\n \t\t\t\t\t      &log_tree_opt.diffopt);\n \t\t\t\tlog_tree_diff_flush(&log_tree_opt);\n@@ -4960,7 +4961,7 @@ static int commit_staged_changes(struct repository *r,\n \t\tstruct strbuf rev = STRBUF_INIT;\n \t\tstruct object_id head, to_amend;\n \n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\treturn error(_(\"cannot amend non-existing commit\"));\n \t\tif (!read_oneliner(&rev, rebase_path_amend(), 0))\n \t\t\treturn error(_(\"invalid file: '%s'\"), rebase_path_amend());\n@@ -5185,7 +5186,7 @@ int sequencer_pick_revisions(struct repository *r,\n \t\tif (!strlen(name))\n \t\t\tcontinue;\n \n-\t\tif (!get_oid(name, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n \t\t\tif (!lookup_commit_reference_gently(r, &oid, 1)) {\n \t\t\t\tenum object_type type = oid_object_info(r,\n \t\t\t\t\t\t\t\t\t&oid,\n@@ -5228,7 +5229,7 @@ int sequencer_pick_revisions(struct repository *r,\n \tif (walk_revs_populate_todo(&todo_list, opts) ||\n \t\t\tcreate_seq_dir(r) < 0)\n \t\treturn -1;\n-\tif (get_oid(\"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n \t\treturn error(_(\"can't revert as initial commit\"));\n \tif (save_head(oid_to_hex(&oid)))\n \t\treturn -1;\n@@ -5360,7 +5361,8 @@ static const char *label_oid(struct object_id *oid, const char *label,\n \t\tstrbuf_grow(&state->buf, GIT_MAX_HEXSZ);\n \t\tlabel = p = state->buf.buf;\n \n-\t\tfind_unique_abbrev_r(p, oid, default_abbrev);\n+\t\trepo_find_unique_abbrev_r(the_repository, p, oid,\n+\t\t\t\t\t  default_abbrev);\n \n \t\t/*\n \t\t * We may need to extend the abbreviated hash so that there is\n@@ -6093,7 +6095,8 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla\n \tstruct object_id oid = onto->object.oid;\n \tint res;\n \n-\tfind_unique_abbrev_r(shortonto, &oid, DEFAULT_ABBREV);\n+\trepo_find_unique_abbrev_r(the_repository, shortonto, &oid,\n+\t\t\t\t  DEFAULT_ABBREV);\n \n \tif (buf->len == 0) {\n \t\tstruct todo_item *item = append_new_todo(todo_list);\n@@ -6369,8 +6372,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)\n \t\tif (file_exists(git_path_seq_dir()))\n \t\t\t*whence = FROM_CHERRY_PICK_MULTI;\n \t\tif (file_exists(rebase_path()) &&\n-\t\t    !get_oid(\"REBASE_HEAD\", &rebase_head) &&\n-\t\t    !get_oid(\"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n+\t\t    !repo_get_oid(the_repository, \"REBASE_HEAD\", &rebase_head) &&\n+\t\t    !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n \t\t    oideq(&rebase_head, &cherry_pick_head))\n \t\t\t*whence = FROM_REBASE_PICK;\n \t\telse\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 4dc61b3a78a..336732ed785 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -535,7 +535,7 @@ static int gitmodule_oid_from_commit(const struct object_id *treeish_name,\n \t}\n \n \tstrbuf_addf(rev, \"%s:.gitmodules\", oid_to_hex(treeish_name));\n-\tif (get_oid(rev->buf, gitmodules_oid) >= 0)\n+\tif (repo_get_oid(the_repository, rev->buf, gitmodules_oid) >= 0)\n \t\tret = 1;\n \n \treturn ret;\ndiff --git a/submodule.c b/submodule.c\nindex 3a0dfc417c0..5936553464a 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -65,7 +65,7 @@ int is_writing_gitmodules_ok(void)\n {\n \tstruct object_id oid;\n \treturn file_exists(GITMODULES_FILE) ||\n-\t\t(get_oid(GITMODULES_INDEX, &oid) < 0 && get_oid(GITMODULES_HEAD, &oid) < 0);\n+\t\t(repo_get_oid(the_repository, GITMODULES_INDEX, &oid) < 0 && repo_get_oid(the_repository, GITMODULES_HEAD, &oid) < 0);\n }\n \n /*\n@@ -1625,7 +1625,7 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,\n \t\tif (!task->repo) {\n \t\t\tstrbuf_addf(err, _(\"Could not access submodule '%s' at commit %s\\n\"),\n \t\t\t\t    cs_data->path,\n-\t\t\t\t    find_unique_abbrev(cs_data->super_oid, DEFAULT_ABBREV));\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, cs_data->super_oid, DEFAULT_ABBREV));\n \n \t\t\tfetch_task_release(task);\n \t\t\tfree(task);\n@@ -1636,8 +1636,8 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,\n \t\t\tstrbuf_addf(err,\n \t\t\t\t    _(\"Fetching submodule %s%s at commit %s\\n\"),\n \t\t\t\t    spf->prefix, task->sub->path,\n-\t\t\t\t    find_unique_abbrev(cs_data->super_oid,\n-\t\t\t\t\t\t       DEFAULT_ABBREV));\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, cs_data->super_oid,\n+\t\t\t\t\t\t\t    DEFAULT_ABBREV));\n \n \t\tspf->changed_count++;\n \t\t/*\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex efc82dd80c5..5d1284328d0 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -25,7 +25,8 @@\n \n static const char *short_commit_name(struct commit *commit)\n {\n-\treturn find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t       DEFAULT_ABBREV);\n }\n \n static struct commit *peel_committish(const char *name)\n@@ -33,10 +34,11 @@ static struct commit *peel_committish(const char *name)\n \tstruct object *obj;\n \tstruct object_id oid;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn NULL;\n \tobj = parse_object(the_repository, &oid);\n-\treturn (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);\n+\treturn (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,\n+\t\t\t\t\t\t  OBJ_COMMIT);\n }\n \n static char *get_author(const char *message)\n@@ -119,7 +121,7 @@ int cmd__fast_rebase(int argc, const char **argv)\n \tstrbuf_addf(&branch_name, \"refs/heads/%s\", argv[4]);\n \n \t/* Sanity check */\n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\tdie(_(\"Cannot read HEAD\"));\n \tassert(oideq(&onto->object.oid, &head));\n \ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 4079fdee067..daadf3827aa 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -9,9 +9,9 @@ int cmd__match_trees(int ac, const char **av)\n \n \tsetup_git_directory();\n \n-\tif (get_oid(av[1], &hash1))\n+\tif (repo_get_oid(the_repository, av[1], &hash1))\n \t\tdie(\"cannot parse %s as an object name\", av[1]);\n-\tif (get_oid(av[2], &hash2))\n+\tif (repo_get_oid(the_repository, av[2], &hash2))\n \t\tdie(\"cannot parse %s as an object name\", av[2]);\n \tone = parse_tree_indirect(&hash1);\n \tif (!one)\ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex 0acf99931ee..7b194edde2b 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -49,7 +49,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\tif (!strcmp(\"put\", cmd) && p1 && p2) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -67,7 +67,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\t} else if (!strcmp(\"get\", cmd) && p1) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -80,7 +80,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\t} else if (!strcmp(\"remove\", cmd) && p1) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 2f65c7f6a55..00f0f29a6a6 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -57,7 +57,7 @@ int cmd__reach(int ac, const char **av)\n \t\tif (buf.len < 3)\n \t\t\tcontinue;\n \n-\t\tif (get_oid_committish(buf.buf + 2, &oid))\n+\t\tif (repo_get_oid_committish(the_repository, buf.buf + 2, &oid))\n \t\t\tdie(\"failed to resolve %s\", buf.buf + 2);\n \n \t\torig = parse_object(r, &oid);\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 22a41c40926..91c82d4159d 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -42,7 +42,7 @@ int cmd__submodule_config(int argc, const char **argv)\n \n \t\tif (commit[0] == '\\0')\n \t\t\toidclr(&commit_oid);\n-\t\telse if (get_oid(commit, &commit_oid) < 0)\n+\t\telse if (repo_get_oid(the_repository, commit, &commit_oid) < 0)\n \t\t\tdie_usage(argc, argv, \"Commit not found.\");\n \n \t\tif (lookup_name) {\ndiff --git a/tag.c b/tag.c\nindex dfbcd7fcc24..dfc900e62e0 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -51,7 +51,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\treturn error(\"%s: cannot verify a non-tag object of type %s.\",\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV),\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),\n \t\t\t\ttype_name(type));\n \n \tbuf = read_object_file(oid, &type, &size);\n@@ -59,7 +59,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\treturn error(\"%s: unable to read file.\",\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \n \tret = run_gpg_verify(buf, size, flags);\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 3ea7c2bb5ad..2a1b4497caa 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -1081,7 +1081,7 @@ static int push_refs_with_export(struct transport *transport,\n \t\tstruct object_id oid;\n \n \t\tprivate = apply_refspecs(&data->rs, ref->name);\n-\t\tif (private && !get_oid(private, &oid)) {\n+\t\tif (private && !repo_get_oid(the_repository, private, &oid)) {\n \t\t\tstrbuf_addf(&buf, \"^%s\", private);\n \t\t\tstring_list_append_nodup(&revlist_args,\n \t\t\t\t\t\t strbuf_detach(&buf, NULL));\ndiff --git a/transport.c b/transport.c\nindex 77a61a9d7bb..7488622e77d 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -776,7 +776,8 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count,\n static int measure_abbrev(const struct object_id *oid, int sofar)\n {\n \tchar hex[GIT_MAX_HEXSZ + 1];\n-\tint w = find_unique_abbrev_r(hex, oid, DEFAULT_ABBREV);\n+\tint w = repo_find_unique_abbrev_r(the_repository, hex, oid,\n+\t\t\t\t\t  DEFAULT_ABBREV);\n \n \treturn (w < sofar) ? sofar : w;\n }\ndiff --git a/wt-status.c b/wt-status.c\nindex 3162241a570..c55c51b1924 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1337,7 +1337,7 @@ static void abbrev_oid_in_line(struct strbuf *line)\n \t\t * it after abbreviation.\n \t\t */\n \t\tstrbuf_trim(split[1]);\n-\t\tif (!get_oid(split[1]->buf, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, split[1]->buf, &oid)) {\n \t\t\tstrbuf_reset(split[1]);\n \t\t\tstrbuf_add_unique_abbrev(split[1], &oid,\n \t\t\t\t\t\t DEFAULT_ABBREV);\n@@ -1503,8 +1503,8 @@ static void show_cherry_pick_in_progress(struct wt_status *s,\n \telse\n \t\tstatus_printf_ln(s, color,\n \t\t\t_(\"You are currently cherry-picking commit %s.\"),\n-\t\t\tfind_unique_abbrev(&s->state.cherry_pick_head_oid,\n-\t\t\t\t\t   DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &s->state.cherry_pick_head_oid,\n+\t\t\t\t\t\tDEFAULT_ABBREV));\n \n \tif (s->hints) {\n \t\tif (has_unmerged(s))\n@@ -1533,8 +1533,8 @@ static void show_revert_in_progress(struct wt_status *s,\n \telse\n \t\tstatus_printf_ln(s, color,\n \t\t\t_(\"You are currently reverting commit %s.\"),\n-\t\t\tfind_unique_abbrev(&s->state.revert_head_oid,\n-\t\t\t\t\t   DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &s->state.revert_head_oid,\n+\t\t\t\t\t\tDEFAULT_ABBREV));\n \tif (s->hints) {\n \t\tif (has_unmerged(s))\n \t\t\tstatus_printf_ln(s, color,\n@@ -1676,9 +1676,9 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\tstate->detached_from = xstrdup(from);\n \t} else\n \t\tstate->detached_from =\n-\t\t\txstrdup(find_unique_abbrev(&cb.noid, DEFAULT_ABBREV));\n+\t\t\txstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));\n \toidcpy(&state->detached_oid, &cb.noid);\n-\tstate->detached_at = !get_oid(\"HEAD\", &oid) &&\n+\tstate->detached_at = !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n \t\t\t     oideq(&oid, &state->detached_oid);\n \n \tfree(ref);\n@@ -1769,13 +1769,13 @@ void wt_status_get_state(struct repository *r,\n \t} else if (wt_status_check_rebase(NULL, state)) {\n \t\t;\t\t/* all set */\n \t} else if (refs_ref_exists(get_main_ref_store(r), \"CHERRY_PICK_HEAD\") &&\n-\t\t   !get_oid(\"CHERRY_PICK_HEAD\", &oid)) {\n+\t\t   !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &oid)) {\n \t\tstate->cherry_pick_in_progress = 1;\n \t\toidcpy(&state->cherry_pick_head_oid, &oid);\n \t}\n \twt_status_check_bisect(NULL, state);\n \tif (refs_ref_exists(get_main_ref_store(r), \"REVERT_HEAD\") &&\n-\t    !get_oid(\"REVERT_HEAD\", &oid)) {\n+\t    !repo_get_oid(the_repository, \"REVERT_HEAD\", &oid)) {\n \t\tstate->revert_in_progress = 1;\n \t\toidcpy(&state->revert_head_oid, &oid);\n \t}\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473642","messageId":"patch-07.17-2e9cf3ca378-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 07/17] cocci: apply the \"commit.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:11Z","receivedAt":"2023-03-17T15:36:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"commit.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n blame.c                                       |  4 +-\n builtin/am.c                                  |  7 +-\n builtin/blame.c                               |  6 +-\n builtin/checkout.c                            | 13 +--\n builtin/commit.c                              |  8 +-\n builtin/describe.c                            |  4 +-\n builtin/diff.c                                |  3 +-\n builtin/fast-export.c                         |  4 +-\n builtin/gc.c                                  |  4 +-\n builtin/log.c                                 |  5 +-\n builtin/merge-tree.c                          |  6 +-\n builtin/merge.c                               |  3 +-\n builtin/name-rev.c                            |  4 +-\n builtin/notes.c                               |  2 +-\n builtin/rebase.c                              |  2 +-\n builtin/replace.c                             |  4 +-\n builtin/shortlog.c                            |  5 +-\n builtin/show-branch.c                         |  4 +-\n commit-graph.c                                |  2 +-\n commit-reach.c                                | 16 ++--\n commit.c                                      | 25 +++---\n commit.h                                      | 18 ----\n contrib/coccinelle/the_repository.cocci       | 19 +++++\n .../coccinelle/the_repository.pending.cocci   | 19 -----\n delta-islands.c                               |  5 +-\n fmt-merge-msg.c                               |  5 +-\n fsck.c                                        |  4 +-\n http-push.c                                   |  3 +-\n list-objects.c                                | 18 ++--\n merge-recursive.c                             |  2 +-\n negotiator/default.c                          |  6 +-\n negotiator/skipping.c                         |  2 +-\n notes-merge.c                                 |  5 +-\n notes-utils.c                                 |  2 +-\n object-name.c                                 |  8 +-\n pack-bitmap-write.c                           |  3 +-\n pretty.c                                      |  5 +-\n reflog.c                                      |  2 +-\n revision.c                                    | 12 +--\n sequencer.c                                   | 82 +++++++++++--------\n shallow.c                                     |  4 +-\n t/helper/test-fast-rebase.c                   |  9 +-\n tree.c                                        |  2 +-\n walker.c                                      |  4 +-\n 44 files changed, 196 insertions(+), 174 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex 8bfeaa1c63a..af2b67c0847 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -2429,7 +2429,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,\n \n \t\t\tif (sg_origin[i])\n \t\t\t\tcontinue;\n-\t\t\tif (parse_commit(p))\n+\t\t\tif (repo_parse_commit(the_repository, p))\n \t\t\t\tcontinue;\n \t\t\tporigin = find(sb->repo, p, origin, sb->bloom_data);\n \t\t\tif (!porigin)\n@@ -2592,7 +2592,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt)\n \t\t * so hold onto it in the meantime.\n \t\t */\n \t\tblame_origin_incref(suspect);\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tif (sb->reverse ||\n \t\t    (!(commit->object.flags & UNINTERESTING) &&\n \t\t     !(revs->max_age != -1 && commit->date < revs->max_age)))\ndiff --git a/builtin/am.c b/builtin/am.c\nindex c04038f1f3d..456884852e9 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1329,7 +1329,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)\n \tsize_t ident_len;\n \tstruct ident_split id;\n \n-\tbuffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());\n+\tbuffer = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t      get_commit_output_encoding());\n \n \tident_line = find_commit_header(buffer, \"author\", &ident_len);\n \tif (!ident_line)\n@@ -1361,7 +1362,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)\n \t\tdie(_(\"unable to parse commit %s\"), oid_to_hex(&commit->object.oid));\n \tstate->msg = xstrdup(msg + 2);\n \tstate->msg_len = strlen(state->msg);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n /**\n@@ -1404,7 +1405,7 @@ static void write_index_patch(const struct am_state *state)\n \n \tif (!repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\tstruct commit *commit = lookup_commit_or_die(&head, \"HEAD\");\n-\t\ttree = get_commit_tree(commit);\n+\t\ttree = repo_get_commit_tree(the_repository, commit);\n \t} else\n \t\ttree = lookup_tree(the_repository,\n \t\t\t\t   the_repository->hash_algo->empty_tree);\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 0155062de11..91e04f57cc0 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -199,13 +199,13 @@ static void get_commit_info(struct commit *commit,\n \tconst char *message;\n \n \tencoding = get_log_output_encoding();\n-\tmessage = logmsg_reencode(commit, NULL, encoding);\n+\tmessage = repo_logmsg_reencode(the_repository, commit, NULL, encoding);\n \tget_ac_line(message, \"\\nauthor \",\n \t\t    &ret->author, &ret->author_mail,\n \t\t    &ret->author_time, &ret->author_tz);\n \n \tif (!detailed) {\n-\t\tunuse_commit_buffer(commit, message);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n \t\treturn;\n \t}\n \n@@ -219,7 +219,7 @@ static void get_commit_info(struct commit *commit,\n \telse\n \t\tstrbuf_addf(&ret->summary, \"(%s)\", oid_to_hex(&commit->object.oid));\n \n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n }\n \n /*\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 6216bb6bba3..1d1f33e33e7 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -640,7 +640,7 @@ static void describe_detached_head(const char *msg, struct commit *commit)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \n-\tif (!parse_commit(commit))\n+\tif (!repo_parse_commit(the_repository, commit))\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);\n \tif (print_sha1_ellipsis()) {\n \t\tfprintf(stderr, \"%s %s... %s\\n\", msg,\n@@ -755,7 +755,8 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\tBUG(\"'switch --orphan' should never accept a commit as starting point\");\n \t\tnew_tree = parse_tree_indirect(the_hash_algo->empty_tree);\n \t} else\n-\t\tnew_tree = get_commit_tree(new_branch_info->commit);\n+\t\tnew_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\tnew_branch_info->commit);\n \tif (opts->discard_changes) {\n \t\tret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info);\n \t\tif (ret)\n@@ -817,7 +818,8 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\t */\n \t\t\tif (!old_branch_info->commit)\n \t\t\t\treturn 1;\n-\t\t\told_tree = get_commit_tree(old_branch_info->commit);\n+\t\t\told_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\told_branch_info->commit);\n \n \t\t\tif (repo_index_has_changes(the_repository, old_tree, &sb))\n \t\t\t\tdie(_(\"cannot continue with staged changes in \"\n@@ -1006,7 +1008,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)\n \tstrbuf_addstr(sb, \"  \");\n \tstrbuf_add_unique_abbrev(sb, &commit->object.oid, DEFAULT_ABBREV);\n \tstrbuf_addch(sb, ' ');\n-\tif (!parse_commit(commit))\n+\tif (!repo_parse_commit(the_repository, commit))\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, sb);\n \tstrbuf_addch(sb, '\\n');\n }\n@@ -1206,7 +1208,8 @@ static void setup_new_branch_info_and_source_tree(\n \t\t*source_tree = parse_tree_indirect(rev);\n \t} else {\n \t\tparse_commit_or_die(new_branch_info->commit);\n-\t\t*source_tree = get_commit_tree(new_branch_info->commit);\n+\t\t*source_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t    new_branch_info->commit);\n \t}\n }\n \ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 80d1e31f25a..bda6afc4bd6 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -712,7 +712,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n {\n \tconst char *buffer, *subject, *fmt;\n \n-\tbuffer = get_commit_buffer(commit, NULL);\n+\tbuffer = repo_get_commit_buffer(the_repository, commit, NULL);\n \tfind_commit_subject(buffer, &subject);\n \t/*\n \t * If we amend the 'amend!' commit then we don't want to\n@@ -720,7 +720,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n \t */\n \tfmt = starts_with(subject, \"amend!\") ? \"%b\" : \"%B\";\n \tformat_commit_message(commit, fmt, sb, ctx);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n static int prepare_to_commit(const char *index_file, const char *prefix,\n@@ -1183,7 +1183,7 @@ static const char *read_commit_message(const char *name)\n \tif (!commit)\n \t\tdie(_(\"could not lookup commit %s\"), name);\n \tout_enc = get_commit_output_encoding();\n-\treturn logmsg_reencode(commit, NULL, out_enc);\n+\treturn repo_logmsg_reencode(the_repository, commit, NULL, out_enc);\n }\n \n /*\n@@ -1718,7 +1718,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t\tcurrent_head = NULL;\n \telse {\n \t\tcurrent_head = lookup_commit_or_die(&oid, \"HEAD\");\n-\t\tif (parse_commit(current_head))\n+\t\tif (repo_parse_commit(the_repository, current_head))\n \t\t\tdie(_(\"could not parse HEAD commit\"));\n \t}\n \tverbose = -1; /* unspecified */\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex c85bf9c418b..e880a86f37b 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -261,7 +261,7 @@ static unsigned long finish_depth_computation(\n \t\t\tbest->depth++;\n \t\twhile (parents) {\n \t\t\tstruct commit *p = parents->item;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (!(p->object.flags & SEEN))\n \t\t\t\tcommit_list_insert_by_date(p, list);\n \t\t\tp->object.flags |= c->object.flags;\n@@ -404,7 +404,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)\n \t\t}\n \t\twhile (parents) {\n \t\t\tstruct commit *p = parents->item;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (!(p->object.flags & SEEN))\n \t\t\t\tcommit_list_insert_by_date(p, &list);\n \t\t\tp->object.flags |= c->object.flags;\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 26f1e532c66..1091c377af7 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -548,7 +548,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t\tif (!obj)\n \t\t\tdie(_(\"invalid object '%s' given.\"), name);\n \t\tif (obj->type == OBJ_COMMIT)\n-\t\t\tobj = &get_commit_tree(((struct commit *)obj))->object;\n+\t\t\tobj = &repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t    ((struct commit *)obj))->object;\n \n \t\tif (obj->type == OBJ_TREE) {\n \t\t\tif (sdiff.skip && bitmap_get(sdiff.skip, i))\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 39a890fc005..5fe7c02970e 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -618,7 +618,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,\n \trev->diffopt.output_format = DIFF_FORMAT_CALLBACK;\n \n \tparse_commit_or_die(commit);\n-\tcommit_buffer = get_commit_buffer(commit, NULL);\n+\tcommit_buffer = repo_get_commit_buffer(the_repository, commit, NULL);\n \tauthor = strstr(commit_buffer, \"\\nauthor \");\n \tif (!author)\n \t\tdie(\"could not find author in commit %s\",\n@@ -699,7 +699,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,\n \t\t\t  ? strlen(message) : 0),\n \t       reencoded ? reencoded : message ? message : \"\");\n \tfree(reencoded);\n-\tunuse_commit_buffer(commit, commit_buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, commit_buffer);\n \n \tfor (i = 0, p = commit->parents; p; p = p->next) {\n \t\tstruct object *obj = &p->item->object;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 02455fdcd73..e60decbc56c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -820,7 +820,7 @@ static int dfs_on_ref(const char *refname UNUSED,\n \tcommit = lookup_commit(the_repository, oid);\n \tif (!commit)\n \t\treturn 0;\n-\tif (parse_commit(commit) ||\n+\tif (repo_parse_commit(the_repository, commit) ||\n \t    commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH)\n \t\treturn 0;\n \n@@ -837,7 +837,7 @@ static int dfs_on_ref(const char *refname UNUSED,\n \t\tcommit = pop_commit(&stack);\n \n \t\tfor (parent = commit->parents; parent; parent = parent->next) {\n-\t\t\tif (parse_commit(parent->item) ||\n+\t\t\tif (repo_parse_commit(the_repository, parent->item) ||\n \t\t\t    commit_graph_position(parent->item) != COMMIT_NOT_FROM_GRAPH ||\n \t\t\t    parent->item->object.flags & SEEN)\n \t\t\t\tcontinue;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 5604b4b5f05..f249aca049a 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1314,10 +1314,11 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,\n \tlog_write_email_headers(rev, head, &pp.after_subject, &need_8bit_cte, 0);\n \n \tfor (i = 0; !need_8bit_cte && i < nr; i++) {\n-\t\tconst char *buf = get_commit_buffer(list[i], NULL);\n+\t\tconst char *buf = repo_get_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t list[i], NULL);\n \t\tif (has_non_ascii(buf))\n \t\t\tneed_8bit_cte = 1;\n-\t\tunuse_commit_buffer(list[i], buf);\n+\t\trepo_unuse_commit_buffer(the_repository, list[i], buf);\n \t}\n \n \tif (!branch_name)\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 4e4a9d6ba17..c0acbc6a546 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -443,9 +443,9 @@ static int real_merge(struct merge_tree_options *o,\n \t\t\tdie(_(\"could not lookup commit %s\"), merge_base);\n \n \t\topt.ancestor = merge_base;\n-\t\tbase_tree = get_commit_tree(base_commit);\n-\t\tparent1_tree = get_commit_tree(parent1);\n-\t\tparent2_tree = get_commit_tree(parent2);\n+\t\tbase_tree = repo_get_commit_tree(the_repository, base_commit);\n+\t\tparent1_tree = repo_get_commit_tree(the_repository, parent1);\n+\t\tparent2_tree = repo_get_commit_tree(the_repository, parent2);\n \t\tmerge_incore_nonrecursive(&opt, base_tree, parent1_tree, parent2_tree, &result);\n \t} else {\n \t\t/*\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex c5a9321806d..197e152aba9 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1611,7 +1611,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t * Must first ensure that index matches HEAD before\n \t\t\t * attempting a trivial merge.\n \t\t\t */\n-\t\t\tstruct tree *head_tree = get_commit_tree(head_commit);\n+\t\t\tstruct tree *head_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t      head_commit);\n \t\t\tstruct strbuf sb = STRBUF_INIT;\n \n \t\t\tif (repo_index_has_changes(the_repository, head_tree,\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 35fd89f794d..ad1de023088 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -181,7 +181,7 @@ static void name_rev(struct commit *start_commit,\n \tsize_t parents_to_queue_nr, parents_to_queue_alloc = 0;\n \tstruct rev_name *start_name;\n \n-\tparse_commit(start_commit);\n+\trepo_parse_commit(the_repository, start_commit);\n \tif (commit_is_before_cutoff(start_commit))\n \t\treturn;\n \n@@ -211,7 +211,7 @@ static void name_rev(struct commit *start_commit,\n \t\t\tstruct rev_name *parent_name;\n \t\t\tint generation, distance;\n \n-\t\t\tparse_commit(parent);\n+\t\t\trepo_parse_commit(the_repository, parent);\n \t\t\tif (commit_is_before_cutoff(parent))\n \t\t\t\tcontinue;\n \ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex d98460e5d61..b497eae520e 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -720,7 +720,7 @@ static int merge_commit(struct notes_merge_options *o)\n \t\tdie(_(\"failed to read ref NOTES_MERGE_PARTIAL\"));\n \telse if (!(partial = lookup_commit_reference(the_repository, &oid)))\n \t\tdie(_(\"could not find commit from NOTES_MERGE_PARTIAL.\"));\n-\telse if (parse_commit(partial))\n+\telse if (repo_parse_commit(the_repository, partial))\n \t\tdie(_(\"could not parse commit from NOTES_MERGE_PARTIAL.\"));\n \n \tif (partial->parents)\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 5fd7bfb4860..eba48bffaad 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -853,7 +853,7 @@ static int checkout_up_to_date(struct rebase_options *options)\n static int is_linear_history(struct commit *from, struct commit *to)\n {\n \twhile (to && to != from) {\n-\t\tparse_commit(to);\n+\t\trepo_parse_commit(the_repository, to);\n \t\tif (!to->parents)\n \t\t\treturn 1;\n \t\tif (to->parents->next)\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 33c6cdb79c8..85f0b79c924 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -458,9 +458,9 @@ static int create_graft(int argc, const char **argv, int force, int gentle)\n \tif (!commit)\n \t\treturn error(_(\"could not parse %s\"), old_ref);\n \n-\tbuffer = get_commit_buffer(commit, &size);\n+\tbuffer = repo_get_commit_buffer(the_repository, commit, &size);\n \tstrbuf_add(&buf, buffer, size);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \n \tif (replace_parents(&buf, argc - 1, &argv[1]) < 0) {\n \t\tstrbuf_release(&buf);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 27a87167e19..8afd1ad865e 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -179,7 +179,8 @@ static void insert_records_from_trailers(struct shortlog *log,\n \t * Using format_commit_message(\"%B\") would be simpler here, but\n \t * this saves us copying the message.\n \t */\n-\tcommit_buffer = logmsg_reencode(commit, NULL, ctx->output_encoding);\n+\tcommit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t     ctx->output_encoding);\n \tbody = strstr(commit_buffer, \"\\n\\n\");\n \tif (!body)\n \t\treturn;\n@@ -202,7 +203,7 @@ static void insert_records_from_trailers(struct shortlog *log,\n \ttrailer_iterator_release(&iter);\n \n \tstrbuf_release(&ident);\n-\tunuse_commit_buffer(commit, commit_buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, commit_buffer);\n }\n \n static int shortlog_needs_dedup(const struct shortlog *log)\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 9e3b8ed27e1..d60e536a53b 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -240,7 +240,7 @@ static void join_revs(struct commit_list **list_p,\n \t\t\tparents = parents->next;\n \t\t\tif ((this_flag & flags) == flags)\n \t\t\t\tcontinue;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (mark_seen(p, seen_p) && !still_interesting)\n \t\t\t\textra--;\n \t\t\tp->object.flags |= flags;\n@@ -842,7 +842,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\tif (!commit)\n \t\t\tdie(_(\"cannot find commit %s (%s)\"),\n \t\t\t    ref_name[num_rev], oid_to_hex(&revkey));\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tmark_seen(commit, &seen);\n \n \t\t/* rev#0 uses bit REV_SHIFT, rev#1 uses bit REV_SHIFT+1,\ndiff --git a/commit-graph.c b/commit-graph.c\nindex c11b59f28b3..8273085aa60 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2549,7 +2549,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)\n \n \t\tgraph_commit = lookup_commit(r, &cur_oid);\n \t\todb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));\n-\t\tif (parse_commit_internal(odb_commit, 0, 0)) {\n+\t\tif (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) {\n \t\t\tgraph_report(_(\"failed to parse commit %s from object database for commit-graph\"),\n \t\t\t\t     oid_to_hex(&cur_oid));\n \t\t\tcontinue;\ndiff --git a/commit-reach.c b/commit-reach.c\nindex a4b9eda723f..c88faf7e7b2 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -585,7 +585,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)\n \t\treturn 0;\n \tnew_commit = (struct commit *) o;\n \n-\tif (parse_commit(new_commit) < 0)\n+\tif (repo_parse_commit(the_repository, new_commit) < 0)\n \t\treturn 0;\n \n \tcommit_list_insert(old_commit, &old_commit_list);\n@@ -749,7 +749,7 @@ int can_all_from_reach_with_flag(struct object_array *from,\n \t\t}\n \n \t\tlist[nr_commits] = (struct commit *)from_one;\n-\t\tif (parse_commit(list[nr_commits]) ||\n+\t\tif (repo_parse_commit(the_repository, list[nr_commits]) ||\n \t\t    commit_graph_generation(list[nr_commits]) < min_generation) {\n \t\t\tresult = 0;\n \t\t\tgoto cleanup;\n@@ -784,7 +784,7 @@ int can_all_from_reach_with_flag(struct object_array *from,\n \t\t\t\tif (!(parent->item->object.flags & assign_flag)) {\n \t\t\t\t\tparent->item->object.flags |= assign_flag;\n \n-\t\t\t\t\tif (parse_commit(parent->item) ||\n+\t\t\t\t\tif (repo_parse_commit(the_repository, parent->item) ||\n \t\t\t\t\t    parent->item->date < min_commit_date ||\n \t\t\t\t\t    commit_graph_generation(parent->item) < min_generation)\n \t\t\t\t\t\tcontinue;\n@@ -826,7 +826,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,\n \twhile (from_iter) {\n \t\tadd_object_array(&from_iter->item->object, NULL, &from_objs);\n \n-\t\tif (!parse_commit(from_iter->item)) {\n+\t\tif (!repo_parse_commit(the_repository, from_iter->item)) {\n \t\t\ttimestamp_t generation;\n \t\t\tif (from_iter->item->date < min_commit_date)\n \t\t\t\tmin_commit_date = from_iter->item->date;\n@@ -840,7 +840,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,\n \t}\n \n \twhile (to_iter) {\n-\t\tif (!parse_commit(to_iter->item)) {\n+\t\tif (!repo_parse_commit(the_repository, to_iter->item)) {\n \t\t\ttimestamp_t generation;\n \t\t\tif (to_iter->item->date < min_commit_date)\n \t\t\t\tmin_commit_date = to_iter->item->date;\n@@ -890,7 +890,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\ttimestamp_t generation;\n \t\tstruct commit *c = *item;\n \n-\t\tparse_commit(c);\n+\t\trepo_parse_commit(the_repository, c);\n \t\tgeneration = commit_graph_generation(c);\n \t\tif (generation < min_generation)\n \t\t\tmin_generation = generation;\n@@ -905,7 +905,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\tstruct commit *c = *item;\n \t\tif (!(c->object.flags & PARENT2)) {\n \t\t\tc->object.flags |= PARENT2;\n-\t\t\tparse_commit(c);\n+\t\t\trepo_parse_commit(the_repository, c);\n \n \t\t\tprio_queue_put(&queue, *item);\n \t\t}\n@@ -924,7 +924,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\tfor (parents = current->parents; parents; parents = parents->next) {\n \t\t\tstruct commit *p = parents->item;\n \n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \n \t\t\tif (commit_graph_generation(p) < min_generation)\n \t\t\t\tcontinue;\ndiff --git a/commit.c b/commit.c\nindex 62682f55643..6036376d05a 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -83,7 +83,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)\n \tif (repo_get_oid_committish(the_repository, name, &oid))\n \t\treturn NULL;\n \tcommit = lookup_commit_reference(the_repository, &oid);\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn NULL;\n \treturn commit;\n }\n@@ -382,7 +382,7 @@ struct tree *repo_get_commit_tree(struct repository *r,\n \n struct object_id *get_commit_tree_oid(const struct commit *commit)\n {\n-\tstruct tree *tree = get_commit_tree(commit);\n+\tstruct tree *tree = repo_get_commit_tree(the_repository, commit);\n \treturn tree ? &tree->object.oid : NULL;\n }\n \n@@ -555,7 +555,7 @@ int repo_parse_commit_gently(struct repository *r,\n \n void parse_commit_or_die(struct commit *item)\n {\n-\tif (parse_commit(item))\n+\tif (repo_parse_commit(the_repository, item))\n \t\tdie(\"unable to parse commit %s\",\n \t\t    item ? oid_to_hex(&item->object.oid) : \"(null)\");\n }\n@@ -688,7 +688,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,\n \n \twhile (parents) {\n \t\tstruct commit *commit = parents->item;\n-\t\tif (!parse_commit(commit) && !(commit->object.flags & mark)) {\n+\t\tif (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) {\n \t\t\tcommit->object.flags |= mark;\n \t\t\tcommit_list_insert_by_date(commit, list);\n \t\t}\n@@ -762,7 +762,8 @@ define_commit_slab(author_date_slab, timestamp_t);\n void record_author_date(struct author_date_slab *author_date,\n \t\t\tstruct commit *commit)\n {\n-\tconst char *buffer = get_commit_buffer(commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    NULL);\n \tstruct ident_split ident;\n \tconst char *ident_line;\n \tsize_t ident_len;\n@@ -782,7 +783,7 @@ void record_author_date(struct author_date_slab *author_date,\n \t*(author_date_slab_at(author_date, commit)) = date;\n \n fail_exit:\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n int compare_commits_by_author_date(const void *a_, const void *b_,\n@@ -963,7 +964,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)\n \tcommit = lookup_commit(the_repository, oid);\n \tif (!commit ||\n \t    (commit->object.flags & TMP_MARK) ||\n-\t    parse_commit(commit))\n+\t    repo_parse_commit(the_repository, commit))\n \t\treturn;\n \n \tALLOC_GROW(revs->commit, revs->nr + 1, revs->alloc);\n@@ -1096,10 +1097,11 @@ int parse_signed_commit(const struct commit *commit,\n \t\t\tconst struct git_hash_algo *algop)\n {\n \tunsigned long size;\n-\tconst char *buffer = get_commit_buffer(commit, &size);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    &size);\n \tint ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);\n \n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \treturn ret;\n }\n \n@@ -1318,9 +1320,10 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,\n {\n \tstruct commit_extra_header *extra = NULL;\n \tunsigned long size;\n-\tconst char *buffer = get_commit_buffer(commit, &size);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    &size);\n \textra = read_commit_extra_header_lines(buffer, size, exclude);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \treturn extra;\n }\n \ndiff --git a/commit.h b/commit.h\nindex cc2c5da7bdb..e98ee6e698e 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -109,11 +109,6 @@ static inline int repo_parse_commit_no_graph(struct repository *r,\n \treturn repo_parse_commit_internal(r, commit, 0, 0);\n }\n \n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)\n-#define parse_commit(item) repo_parse_commit(the_repository, item)\n-#endif\n-\n void parse_commit_or_die(struct commit *item);\n \n struct buffer_slab;\n@@ -140,9 +135,6 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,\n const void *repo_get_commit_buffer(struct repository *r,\n \t\t\t\t   const struct commit *,\n \t\t\t\t   unsigned long *size);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define get_commit_buffer(c, s) repo_get_commit_buffer(the_repository, c, s)\n-#endif\n \n /*\n  * Tell the commit subsystem that we are done with a particular commit buffer.\n@@ -153,9 +145,6 @@ const void *repo_get_commit_buffer(struct repository *r,\n void repo_unuse_commit_buffer(struct repository *r,\n \t\t\t      const struct commit *,\n \t\t\t      const void *buffer);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define unuse_commit_buffer(c, b) repo_unuse_commit_buffer(the_repository, c, b)\n-#endif\n \n /*\n  * Free any cached object buffer associated with the commit.\n@@ -163,7 +152,6 @@ void repo_unuse_commit_buffer(struct repository *r,\n void free_commit_buffer(struct parsed_object_pool *pool, struct commit *);\n \n struct tree *repo_get_commit_tree(struct repository *, const struct commit *);\n-#define get_commit_tree(c) repo_get_commit_tree(the_repository, c)\n struct object_id *get_commit_tree_oid(const struct commit *);\n \n /*\n@@ -206,16 +194,10 @@ void free_commit_list(struct commit_list *list);\n struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n \n int has_non_ascii(const char *text);\n-const char *logmsg_reencode(const struct commit *commit,\n-\t\t\t    char **commit_encoding,\n-\t\t\t    const char *output_encoding);\n const char *repo_logmsg_reencode(struct repository *r,\n \t\t\t\t const struct commit *commit,\n \t\t\t\t char **commit_encoding,\n \t\t\t\t const char *output_encoding);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define logmsg_reencode(c, enc, out) repo_logmsg_reencode(the_repository, c, enc, out)\n-#endif\n \n const char *skip_blank_lines(const char *msg);\n \ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 1ab63f0196b..0cdf3f46304 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -54,6 +54,25 @@\n |\n - in_merge_bases_many\n + repo_in_merge_bases_many\n+// commit.h\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n+|\n+- get_commit_buffer\n++ repo_get_commit_buffer\n+|\n+- unuse_commit_buffer\n++ repo_unuse_commit_buffer\n+|\n+- logmsg_reencode\n++ repo_logmsg_reencode\n+|\n+- get_commit_tree\n++ repo_get_commit_tree\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex e9209fc0cc4..bf19e6a2487 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,26 +5,7 @@\n @@\n @@\n (\n-// commit.h\n-- parse_commit_internal\n-+ repo_parse_commit_internal\n-|\n-- parse_commit\n-+ repo_parse_commit\n-|\n-- get_commit_buffer\n-+ repo_get_commit_buffer\n-|\n-- unuse_commit_buffer\n-+ repo_unuse_commit_buffer\n-|\n-- logmsg_reencode\n-+ repo_logmsg_reencode\n-|\n-- get_commit_tree\n-+ repo_get_commit_tree\n // diff.h\n-|\n - diff_setup\n + repo_diff_setup\n // object-store.h\ndiff --git a/delta-islands.c b/delta-islands.c\nindex afdec0a878d..05448851ad3 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -506,8 +506,9 @@ void propagate_island_marks(struct commit *commit)\n \t\tstruct commit_list *p;\n \t\tstruct island_bitmap *root_marks = kh_value(island_marks, pos);\n \n-\t\tparse_commit(commit);\n-\t\tset_island_marks(&get_commit_tree(commit)->object, root_marks);\n+\t\trepo_parse_commit(the_repository, commit);\n+\t\tset_island_marks(&repo_get_commit_tree(the_repository, commit)->object,\n+\t\t\t\t root_marks);\n \t\tfor (p = commit->parents; p; p = p->next)\n \t\t\tset_island_marks(&p->item->object, root_marks);\n \t}\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex e8e2d4ea0d0..a5de91ba22c 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -271,9 +271,10 @@ static void record_person_from_buf(int which, struct string_list *people,\n static void record_person(int which, struct string_list *people,\n \t\t\t  struct commit *commit)\n {\n-\tconst char *buffer = get_commit_buffer(commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    NULL);\n \trecord_person_from_buf(which, people, buffer);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n static int cmp_string_list_util_as_integral(const void *a_, const void *b_)\ndiff --git a/fsck.c b/fsck.c\nindex 2b18717ee80..807a84971a2 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -353,7 +353,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio\n \tint result;\n \tconst char *name;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn -1;\n \n \tname = fsck_get_object_name(options, &commit->object.oid);\n@@ -361,7 +361,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio\n \t\tfsck_put_object_name(options, get_commit_tree_oid(commit),\n \t\t\t\t     \"%s:\", name);\n \n-\tresult = options->walk((struct object *)get_commit_tree(commit),\n+\tresult = options->walk((struct object *) repo_get_commit_tree(the_repository, commit),\n \t\t\t       OBJ_TREE, data, options);\n \tif (result < 0)\n \t\treturn result;\ndiff --git a/http-push.c b/http-push.c\nindex ceab00bd901..45d5cc0972f 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1331,7 +1331,8 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)\n \tint count = 0;\n \n \twhile ((commit = get_revision(revs)) != NULL) {\n-\t\tp = process_tree(get_commit_tree(commit), p);\n+\t\tp = process_tree(repo_get_commit_tree(the_repository, commit),\n+\t\t\t\t p);\n \t\tcommit->object.flags |= LOCAL;\n \t\tif (!(commit->object.flags & UNINTERESTING))\n \t\t\tcount += add_send_request(&commit->object, lock);\ndiff --git a/list-objects.c b/list-objects.c\nindex 7528fe1db2c..5550b3aafeb 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -227,7 +227,8 @@ static void mark_edge_parents_uninteresting(struct commit *commit,\n \t\tstruct commit *parent = parents->item;\n \t\tif (!(parent->object.flags & UNINTERESTING))\n \t\t\tcontinue;\n-\t\tmark_tree_uninteresting(revs->repo, get_commit_tree(parent));\n+\t\tmark_tree_uninteresting(revs->repo,\n+\t\t\t\t\trepo_get_commit_tree(the_repository, parent));\n \t\tif (revs->edge_hint && !(parent->object.flags & SHOWN)) {\n \t\t\tparent->object.flags |= SHOWN;\n \t\t\tshow_edge(parent);\n@@ -244,7 +245,8 @@ static void add_edge_parents(struct commit *commit,\n \n \tfor (parents = commit->parents; parents; parents = parents->next) {\n \t\tstruct commit *parent = parents->item;\n-\t\tstruct tree *tree = get_commit_tree(parent);\n+\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t parent);\n \n \t\tif (!tree)\n \t\t\tcontinue;\n@@ -275,7 +277,8 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \n \t\tfor (list = revs->commits; list; list = list->next) {\n \t\t\tstruct commit *commit = list->item;\n-\t\t\tstruct tree *tree = get_commit_tree(commit);\n+\t\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t commit);\n \n \t\t\tif (commit->object.flags & UNINTERESTING)\n \t\t\t\ttree->object.flags |= UNINTERESTING;\n@@ -291,7 +294,7 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \t\t\tstruct commit *commit = list->item;\n \t\t\tif (commit->object.flags & UNINTERESTING) {\n \t\t\t\tmark_tree_uninteresting(revs->repo,\n-\t\t\t\t\t\t\tget_commit_tree(commit));\n+\t\t\t\t\t\t\trepo_get_commit_tree(the_repository, commit));\n \t\t\t\tif (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {\n \t\t\t\t\tcommit->object.flags |= SHOWN;\n \t\t\t\t\tshow_edge(commit);\n@@ -309,7 +312,7 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \t\t\tif (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))\n \t\t\t\tcontinue;\n \t\t\tmark_tree_uninteresting(revs->repo,\n-\t\t\t\t\t\tget_commit_tree(commit));\n+\t\t\t\t\t\trepo_get_commit_tree(the_repository, commit));\n \t\t\tif (!(obj->flags & SHOWN)) {\n \t\t\t\tobj->flags |= SHOWN;\n \t\t\t\tshow_edge(commit);\n@@ -376,8 +379,9 @@ static void do_traverse(struct traversal_context *ctx)\n \t\t */\n \t\tif (!ctx->revs->tree_objects)\n \t\t\t; /* do not bother loading tree */\n-\t\telse if (get_commit_tree(commit)) {\n-\t\t\tstruct tree *tree = get_commit_tree(commit);\n+\t\telse if (repo_get_commit_tree(the_repository, commit)) {\n+\t\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t commit);\n \t\t\ttree->object.flags |= NOT_USER_GIVEN;\n \t\t\tadd_pending_tree(ctx->revs, tree);\n \t\t} else if (commit->object.parsed) {\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 9771ef540c4..75fa0ef3183 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3797,7 +3797,7 @@ static struct commit *get_ref(struct repository *repo,\n \t\treturn make_virtual_commit(repo, (struct tree*)object, name);\n \tif (object->type != OBJ_COMMIT)\n \t\treturn NULL;\n-\tif (parse_commit((struct commit *)object))\n+\tif (repo_parse_commit(the_repository, (struct commit *)object))\n \t\treturn NULL;\n \treturn (struct commit *)object;\n }\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex b7e79feaf04..658d9dd6b95 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -25,7 +25,7 @@ static void rev_list_push(struct negotiation_state *ns,\n \tif (!(commit->object.flags & mark)) {\n \t\tcommit->object.flags |= mark;\n \n-\t\tif (parse_commit(commit))\n+\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\treturn;\n \n \t\tprio_queue_put(&ns->rev_list, commit);\n@@ -69,7 +69,7 @@ static void mark_common(struct negotiation_state *ns, struct commit *commit,\n \t\t\tif (!ancestors_only && !(o->flags & POPPED))\n \t\t\t\tns->non_common_revs--;\n \t\t\tif (!o->parsed && !dont_parse)\n-\t\t\t\tif (parse_commit(commit))\n+\t\t\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\t\t\treturn;\n \n \t\t\tfor (parents = commit->parents;\n@@ -96,7 +96,7 @@ static const struct object_id *get_rev(struct negotiation_state *ns)\n \t\t\treturn NULL;\n \n \t\tcommit = prio_queue_get(&ns->rev_list);\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tparents = commit->parents;\n \n \t\tcommit->object.flags |= POPPED;\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex 0f5ac48e876..594639b25a0 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -183,7 +183,7 @@ static const struct object_id *get_rev(struct data *data)\n \t\tif (!(commit->object.flags & COMMON) && !entry->ttl)\n \t\t\tto_send = commit;\n \n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tfor (p = commit->parents; p; p = p->next)\n \t\t\tparent_pushed |= push_parent(data, entry, p->item);\n \ndiff --git a/notes-merge.c b/notes-merge.c\nindex fca9422a294..df1a16ac66c 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -678,7 +678,8 @@ int notes_merge_commit(struct notes_merge_options *o,\n \tDIR *dir;\n \tstruct dirent *e;\n \tstruct strbuf path = STRBUF_INIT;\n-\tconst char *buffer = get_commit_buffer(partial_commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository,\n+\t\t\t\t\t\t    partial_commit, NULL);\n \tconst char *msg = strstr(buffer, \"\\n\\n\");\n \tint baselen;\n \n@@ -725,7 +726,7 @@ int notes_merge_commit(struct notes_merge_options *o,\n \n \tcreate_notes_commit(o->repo, partial_tree, partial_commit->parents, msg,\n \t\t\t    strlen(msg), result_oid);\n-\tunuse_commit_buffer(partial_commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, partial_commit, buffer);\n \tif (o->verbosity >= 4)\n \t\tprintf(\"Finalized notes merge commit: %s\\n\",\n \t\t\toid_to_hex(result_oid));\ndiff --git a/notes-utils.c b/notes-utils.c\nindex d7d18e30f5a..0550cfded86 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r,\n \t\tstruct object_id parent_oid;\n \t\tif (!read_ref(t->ref, &parent_oid)) {\n \t\t\tstruct commit *parent = lookup_commit(r, &parent_oid);\n-\t\t\tif (parse_commit(parent))\n+\t\t\tif (repo_parse_commit(the_repository, parent))\n \t\t\t\tdie(\"Failed to find/parse commit %s\", t->ref);\n \t\t\tcommit_list_insert(parent, &parents);\n \t\t}\ndiff --git a/object-name.c b/object-name.c\nindex 21e8f67489e..2926f26251f 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1036,7 +1036,7 @@ static enum get_oid_result get_parent(struct repository *r,\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(r, &oid);\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn MISSING_OBJECT;\n \tif (!idx) {\n \t\toidcpy(result, &commit->object.oid);\n@@ -1070,7 +1070,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,\n \t\treturn MISSING_OBJECT;\n \n \twhile (generation--) {\n-\t\tif (parse_commit(commit) || !commit->parents)\n+\t\tif (repo_parse_commit(the_repository, commit) || !commit->parents)\n \t\t\treturn MISSING_OBJECT;\n \t\tcommit = commit->parents->item;\n \t}\n@@ -1361,10 +1361,10 @@ static int get_oid_oneline(struct repository *r,\n \t\tcommit = pop_most_recent_commit(&list, ONELINE_SEEN);\n \t\tif (!parse_object(r, &commit->object.oid))\n \t\t\tcontinue;\n-\t\tbuf = get_commit_buffer(commit, NULL);\n+\t\tbuf = repo_get_commit_buffer(the_repository, commit, NULL);\n \t\tp = strstr(buf, \"\\n\\n\");\n \t\tmatches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));\n-\t\tunuse_commit_buffer(commit, buf);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, buf);\n \n \t\tif (matches) {\n \t\t\toidcpy(oid, &commit->object.oid);\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex cfa67a510fd..84b61328931 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -425,7 +425,8 @@ static int fill_bitmap_commit(struct bb_commit *ent,\n \t\tif (!found)\n \t\t\treturn -1;\n \t\tbitmap_set(ent->bitmap, pos);\n-\t\tprio_queue_put(tree_queue, get_commit_tree(c));\n+\t\tprio_queue_put(tree_queue,\n+\t\t\t       repo_get_commit_tree(the_repository, c));\n \n \t\tfor (p = c->parents; p; p = p->next) {\n \t\t\tpos = find_object_pos(&p->item->object.oid, &found);\ndiff --git a/pretty.c b/pretty.c\nindex 1e1e21878c8..7e1614f67fe 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2204,7 +2204,8 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \t}\n \n \tencoding = get_log_output_encoding();\n-\tmsg = reencoded = logmsg_reencode(commit, NULL, encoding);\n+\tmsg = reencoded = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t       encoding);\n \n \tif (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))\n \t\tindent = 0;\n@@ -2261,7 +2262,7 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \tif (cmit_fmt_is_mail(pp->fmt) && sb->len <= beginning_of_body)\n \t\tstrbuf_addch(sb, '\\n');\n \n-\tunuse_commit_buffer(commit, reencoded);\n+\trepo_unuse_commit_buffer(the_repository, commit, reencoded);\n }\n \n void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,\ndiff --git a/reflog.c b/reflog.c\nindex 04630f56ec6..6e8362e7a2f 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -186,7 +186,7 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb)\n \t\tstruct commit *commit = pop_commit(&pending);\n \t\tif (commit->object.flags & REACHABLE)\n \t\t\tcontinue;\n-\t\tif (parse_commit(commit))\n+\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\tcontinue;\n \t\tcommit->object.flags |= REACHABLE;\n \t\tif (commit->date < expire_limit) {\ndiff --git a/revision.c b/revision.c\nindex c2b7b2f1073..79e78b6f7e9 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -778,8 +778,8 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,\n static int rev_compare_tree(struct rev_info *revs,\n \t\t\t    struct commit *parent, struct commit *commit, int nth_parent)\n {\n-\tstruct tree *t1 = get_commit_tree(parent);\n-\tstruct tree *t2 = get_commit_tree(commit);\n+\tstruct tree *t1 = repo_get_commit_tree(the_repository, parent);\n+\tstruct tree *t2 = repo_get_commit_tree(the_repository, commit);\n \tint bloom_ret = 1;\n \n \tif (!t1)\n@@ -825,7 +825,7 @@ static int rev_compare_tree(struct rev_info *revs,\n \n static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)\n {\n-\tstruct tree *t1 = get_commit_tree(commit);\n+\tstruct tree *t1 = repo_get_commit_tree(the_repository, commit);\n \n \tif (!t1)\n \t\treturn 0;\n@@ -963,7 +963,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \tif (!revs->prune)\n \t\treturn;\n \n-\tif (!get_commit_tree(commit))\n+\tif (!repo_get_commit_tree(the_repository, commit))\n \t\treturn;\n \n \tif (!commit->parents) {\n@@ -3878,7 +3878,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \t * in it.\n \t */\n \tencoding = get_log_output_encoding();\n-\tmessage = logmsg_reencode(commit, NULL, encoding);\n+\tmessage = repo_logmsg_reencode(the_repository, commit, NULL, encoding);\n \n \t/* Copy the commit to temporary if we are using \"fake\" headers */\n \tif (buf.len)\n@@ -3914,7 +3914,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \t\tretval = grep_buffer(&opt->grep_filter,\n \t\t\t\t     (char *)message, strlen(message));\n \tstrbuf_release(&buf);\n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n \treturn retval;\n }\n \ndiff --git a/sequencer.c b/sequencer.c\nindex d97923883ff..592b3d2875a 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -428,7 +428,8 @@ static int get_message(struct commit *commit, struct commit_message *out)\n \tconst char *abbrev, *subject;\n \tint subject_len;\n \n-\tout->message = logmsg_reencode(commit, NULL, get_commit_output_encoding());\n+\tout->message = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t    get_commit_output_encoding());\n \tabbrev = short_commit_name(commit);\n \n \tsubject_len = find_commit_subject(out->message, &subject);\n@@ -445,7 +446,7 @@ static void free_message(struct commit *commit, struct commit_message *msg)\n \tfree(msg->parent_label);\n \tfree(msg->label);\n \tfree(msg->subject);\n-\tunuse_commit_buffer(commit, msg->message);\n+\trepo_unuse_commit_buffer(the_repository, commit, msg->message);\n }\n \n static void print_advice(struct repository *r, int show_hint,\n@@ -693,8 +694,8 @@ static int do_recursive_merge(struct repository *r,\n \to.show_rename_progress = 1;\n \n \thead_tree = parse_tree_indirect(head);\n-\tnext_tree = next ? get_commit_tree(next) : empty_tree(r);\n-\tbase_tree = base ? get_commit_tree(base) : empty_tree(r);\n+\tnext_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);\n+\tbase_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);\n \n \tfor (i = 0; i < opts->xopts_nr; i++)\n \t\tparse_merge_opt(&o, opts->xopts[i]);\n@@ -772,7 +773,7 @@ static int is_index_unchanged(struct repository *r)\n \t * the commit is invalid, parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n-\tif (parse_commit(head_commit))\n+\tif (repo_parse_commit(the_repository, head_commit))\n \t\treturn -1;\n \n \tif (!(cache_tree_oid = get_cache_tree_oid(istate)))\n@@ -1337,7 +1338,7 @@ void print_commit_summary(struct repository *r,\n \tcommit = lookup_commit(r, oid);\n \tif (!commit)\n \t\tdie(_(\"couldn't look up newly created commit\"));\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\tdie(_(\"could not parse newly created commit\"));\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n@@ -1417,7 +1418,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \t\t\twarning(_(\"HEAD %s is not a commit!\"),\n \t\t\t\toid_to_hex(&oid));\n \t\t}\n-\t\tif (parse_commit(current_head))\n+\t\tif (repo_parse_commit(the_repository, current_head))\n \t\t\treturn error(_(\"could not parse HEAD commit\"));\n \t}\n \t*head = current_head;\n@@ -1460,8 +1461,9 @@ static int try_to_commit(struct repository *r,\n \tif (flags & AMEND_MSG) {\n \t\tconst char *exclude_gpgsig[] = { \"gpgsig\", \"gpgsig-sha256\", NULL };\n \t\tconst char *out_enc = get_commit_output_encoding();\n-\t\tconst char *message = logmsg_reencode(current_head, NULL,\n-\t\t\t\t\t\t      out_enc);\n+\t\tconst char *message = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t   current_head, NULL,\n+\t\t\t\t\t\t\t   out_enc);\n \n \t\tif (!msg) {\n \t\t\tconst char *orig_message = NULL;\n@@ -1472,7 +1474,8 @@ static int try_to_commit(struct repository *r,\n \t\t\thook_commit = \"HEAD\";\n \t\t}\n \t\tauthor = amend_author = get_author(message);\n-\t\tunuse_commit_buffer(current_head, message);\n+\t\trepo_unuse_commit_buffer(the_repository, current_head,\n+\t\t\t\t\t message);\n \t\tif (!author) {\n \t\t\tres = error(_(\"unable to parse commit author\"));\n \t\t\tgoto out;\n@@ -1669,12 +1672,12 @@ static int is_original_commit_empty(struct commit *commit)\n {\n \tconst struct object_id *ptree_oid;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn error(_(\"could not parse commit %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tif (commit->parents) {\n \t\tstruct commit *parent = commit->parents->item;\n-\t\tif (parse_commit(parent))\n+\t\tif (repo_parse_commit(the_repository, parent))\n \t\t\treturn error(_(\"could not parse parent commit %s\"),\n \t\t\t\toid_to_hex(&parent->object.oid));\n \t\tptree_oid = get_commit_tree_oid(parent);\n@@ -2002,13 +2005,14 @@ static int update_squash_messages(struct repository *r,\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n-\t\tif (!(head_message = logmsg_reencode(head_commit, NULL, encoding)))\n+\t\tif (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))\n \t\t\treturn error(_(\"could not read HEAD's commit message\"));\n \n \t\tfind_commit_subject(head_message, &body);\n \t\tif (command == TODO_FIXUP && !flag && write_message(body, strlen(body),\n \t\t\t\t\t\t\trebase_path_fixup_msg(), 0) < 0) {\n-\t\t\tunuse_commit_buffer(head_commit, head_message);\n+\t\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n+\t\t\t\t\t\t head_message);\n \t\t\treturn error(_(\"cannot write '%s'\"), rebase_path_fixup_msg());\n \t\t}\n \t\tstrbuf_addf(&buf, \"%c \", comment_line_char);\n@@ -2023,10 +2027,11 @@ static int update_squash_messages(struct repository *r,\n \t\telse\n \t\t\tstrbuf_addstr(&buf, body);\n \n-\t\tunuse_commit_buffer(head_commit, head_message);\n+\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n+\t\t\t\t\t head_message);\n \t}\n \n-\tif (!(message = logmsg_reencode(commit, NULL, encoding)))\n+\tif (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))\n \t\treturn error(_(\"could not read commit message of %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tfind_commit_subject(message, &body);\n@@ -2041,7 +2046,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstrbuf_add_commented_lines(&buf, body, strlen(body));\n \t} else\n \t\treturn error(_(\"unknown command: %d\"), command);\n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n \n \tif (!res)\n \t\tres = write_message(buf.buf, buf.len, rebase_path_squash_msg(),\n@@ -2215,7 +2220,7 @@ static int do_pick_commit(struct repository *r,\n \t\tmsg_file = NULL;\n \t\tgoto fast_forward_edit;\n \t}\n-\tif (parent && parse_commit(parent) < 0)\n+\tif (parent && repo_parse_commit(the_repository, parent) < 0)\n \t\t/* TRANSLATORS: The first %s will be a \"todo\" command like\n \t\t   \"revert\" or \"pick\", the second %s a SHA1. */\n \t\treturn error(_(\"%s: cannot parse parent commit %s\"),\n@@ -3123,7 +3128,9 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \n \twhile ((commit = get_revision(opts->revs))) {\n \t\tstruct todo_item *item = append_new_todo(todo_list);\n-\t\tconst char *commit_buffer = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t\t commit, NULL,\n+\t\t\t\t\t\t\t\t encoding);\n \t\tconst char *subject;\n \t\tint subject_len;\n \n@@ -3135,7 +3142,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n \t\t\tshort_commit_name(commit), subject_len, subject);\n-\t\tunuse_commit_buffer(commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\t\t\t\t commit_buffer);\n \t}\n \n \tif (!todo_list->nr)\n@@ -3519,10 +3527,13 @@ static int make_patch(struct repository *r,\n \tstrbuf_addf(&buf, \"%s/message\", get_dir(opts));\n \tif (!file_exists(buf.buf)) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *commit_buffer = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t\t commit, NULL,\n+\t\t\t\t\t\t\t\t encoding);\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tres |= write_message(subject, strlen(subject), buf.buf, 1);\n-\t\tunuse_commit_buffer(commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\t\t\t\t commit_buffer);\n \t}\n \tstrbuf_release(&buf);\n \trelease_revisions(&log_tree_opt);\n@@ -3989,7 +4000,9 @@ static int do_merge(struct repository *r,\n \n \tif (commit) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *message = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *message = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t   commit, NULL,\n+\t\t\t\t\t\t\t   encoding);\n \t\tconst char *body;\n \t\tint len;\n \n@@ -4002,7 +4015,7 @@ static int do_merge(struct repository *r,\n \t\tfind_commit_subject(message, &body);\n \t\tlen = strlen(body);\n \t\tret = write_message(body, len, git_path_merge_msg(r), 0);\n-\t\tunuse_commit_buffer(commit, message);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n \t\tif (ret) {\n \t\t\terror_errno(_(\"could not write '%s'\"),\n \t\t\t\t    git_path_merge_msg(r));\n@@ -4585,7 +4598,7 @@ static int stopped_at_head(struct repository *r)\n \n \tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n-\t    parse_commit(commit) || get_message(commit, &message))\n+\t    repo_parse_commit(the_repository, commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n \telse {\n \t\tfprintf(stderr, _(\"Stopped at %s\\n\"), message.label);\n@@ -5042,13 +5055,15 @@ static int commit_staged_changes(struct repository *r,\n \t\t\t\tconst char *encoding = get_commit_output_encoding();\n \n \t\t\t\tif (parse_head(r, &commit) ||\n-\t\t\t\t    !(p = logmsg_reencode(commit, NULL, encoding)) ||\n+\t\t\t\t    !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||\n \t\t\t\t    write_message(p, strlen(p), path, 0)) {\n-\t\t\t\t\tunuse_commit_buffer(commit, p);\n+\t\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t\t commit, p);\n \t\t\t\t\treturn error(_(\"could not write file: \"\n \t\t\t\t\t\t       \"'%s'\"), path);\n \t\t\t\t}\n-\t\t\t\tunuse_commit_buffer(commit, p);\n+\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t commit, p);\n \t\t\t}\n \t\t}\n \n@@ -5925,7 +5940,7 @@ static int skip_unnecessary_picks(struct repository *r,\n \t\t\tcontinue;\n \t\tif (item->command != TODO_PICK)\n \t\t\tbreak;\n-\t\tif (parse_commit(item->commit)) {\n+\t\tif (repo_parse_commit(the_repository, item->commit)) {\n \t\t\treturn error(_(\"could not parse commit '%s'\"),\n \t\t\t\toid_to_hex(&item->commit->object.oid));\n \t\t}\n@@ -6258,12 +6273,15 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)\n \t\t\treturn error(_(\"the script was already rearranged.\"));\n \t\t}\n \n-\t\tparse_commit(item->commit);\n-\t\tcommit_buffer = logmsg_reencode(item->commit, NULL, \"UTF-8\");\n+\t\trepo_parse_commit(the_repository, item->commit);\n+\t\tcommit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t     item->commit, NULL,\n+\t\t\t\t\t\t     \"UTF-8\");\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tformat_subject(&buf, subject, \" \");\n \t\tsubject = subjects[i] = strbuf_detach(&buf, &subject_len);\n-\t\tunuse_commit_buffer(item->commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, item->commit,\n+\t\t\t\t\t commit_buffer);\n \t\tif (skip_fixupish(subject, &p)) {\n \t\t\tstruct commit *commit2;\n \ndiff --git a/shallow.c b/shallow.c\nindex 0fcdfd7d35a..1a2b159fd4e 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -247,7 +247,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,\n \t\tstruct commit *c = p->item;\n \t\tstruct commit_list *parent;\n \n-\t\tif (parse_commit(c))\n+\t\tif (repo_parse_commit(the_repository, c))\n \t\t\tdie(\"unable to parse commit %s\",\n \t\t\t    oid_to_hex(&c->object.oid));\n \n@@ -583,7 +583,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,\n \t\tif (c->object.flags & BOTTOM)\n \t\t\tcontinue;\n \n-\t\tif (parse_commit(c))\n+\t\tif (repo_parse_commit(the_repository, c))\n \t\t\tdie(\"unable to parse commit %s\",\n \t\t\t    oid_to_hex(&c->object.oid));\n \ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 5d1284328d0..214612846ab 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -65,7 +65,8 @@ static struct commit *create_commit(struct tree *tree,\n \tstruct commit_extra_header *extra;\n \tstruct strbuf msg = STRBUF_INIT;\n \tconst char *out_enc = get_commit_output_encoding();\n-\tconst char *message = logmsg_reencode(based_on, NULL, out_enc);\n+\tconst char *message = repo_logmsg_reencode(the_repository, based_on,\n+\t\t\t\t\t\t   NULL, out_enc);\n \tconst char *orig_message = NULL;\n \tconst char *exclude_gpgsig[] = { \"gpgsig\", NULL };\n \n@@ -156,7 +157,7 @@ int cmd__fast_rebase(int argc, const char **argv)\n \tmemset(&result, 0, sizeof(result));\n \tmerge_opt.show_rename_progress = 1;\n \tmerge_opt.branch1 = \"HEAD\";\n-\thead_tree = get_commit_tree(onto);\n+\thead_tree = repo_get_commit_tree(the_repository, onto);\n \tresult.tree = head_tree;\n \tlast_commit = onto;\n \twhile ((commit = get_revision(&revs))) {\n@@ -167,8 +168,8 @@ int cmd__fast_rebase(int argc, const char **argv)\n \t\tassert(commit->parents && !commit->parents->next);\n \t\tbase = commit->parents->item;\n \n-\t\tnext_tree = get_commit_tree(commit);\n-\t\tbase_tree = get_commit_tree(base);\n+\t\tnext_tree = repo_get_commit_tree(the_repository, commit);\n+\t\tbase_tree = repo_get_commit_tree(the_repository, base);\n \n \t\tmerge_opt.branch2 = short_commit_name(commit);\n \t\tmerge_opt.ancestor = xstrfmt(\"parent of %s\", merge_opt.branch2);\ndiff --git a/tree.c b/tree.c\nindex 410e3b477e5..f0742f4167b 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -58,7 +58,7 @@ int read_tree_at(struct repository *r,\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\n \n-\t\t\tif (parse_commit(commit))\n+\t\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\t\tdie(\"Invalid commit %s in submodule path %s%s\",\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\ndiff --git a/walker.c b/walker.c\nindex 99d0e0eae04..98d65a559b4 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -79,7 +79,7 @@ static int process_commit(struct walker *walker, struct commit *commit)\n {\n \tstruct commit_list *parents;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn -1;\n \n \twhile (complete && complete->item->date >= commit->date) {\n@@ -93,7 +93,7 @@ static int process_commit(struct walker *walker, struct commit *commit)\n \n \twalker_say(walker, \"walk %s\\n\", oid_to_hex(&commit->object.oid));\n \n-\tif (process(walker, &get_commit_tree(commit)->object))\n+\tif (process(walker, &repo_get_commit_tree(the_repository, commit)->object))\n \t\treturn -1;\n \n \tfor (parents = commit->parents; parents; parents = parents->next) {\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473643","messageId":"patch-11.17-8cfc1c18878-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 11/17] cocci: apply the \"packfile.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:15Z","receivedAt":"2023-03-17T15:36:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"packfile.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/gc.c                                    | 2 +-\n commit-graph.c                                  | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n packfile.h                                      | 1 -\n 5 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e60decbc56c..bef26020f99 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -284,7 +284,7 @@ static uint64_t total_ram(void)\n \n static uint64_t estimate_repack_memory(struct packed_git *pack)\n {\n-\tunsigned long nr_objects = approximate_object_count();\n+\tunsigned long nr_objects = repo_approximate_object_count(the_repository);\n \tsize_t os_cache, heap;\n \n \tif (!pack || !nr_objects)\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 8273085aa60..268410e913c 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2360,7 +2360,7 @@ int write_commit_graph(struct object_directory *odb,\n \t\t\treplace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE;\n \t}\n \n-\tctx->approx_nr_objects = approximate_object_count();\n+\tctx->approx_nr_objects = repo_approximate_object_count(the_repository);\n \n \tif (ctx->append && ctx->r->objects->commit_graph) {\n \t\tstruct commit_graph *g = ctx->r->objects->commit_graph;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex ff4c56114f1..a325361f961 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -91,6 +91,10 @@\n |\n - format_commit_message\n + repo_format_commit_message\n+// packfile.h\n+|\n+- approximate_object_count\n++ repo_approximate_object_count\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 375850e773c..9b426e49e66 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// packfile.h\n-- approximate_object_count\n-+ repo_approximate_object_count\n // promisor-remote.h\n-|\n - promisor_remote_reinit\n + repo_promisor_remote_reinit\n |\ndiff --git a/packfile.h b/packfile.h\nindex a3f6723857b..6ec16567971 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -65,7 +65,6 @@ struct packed_git *get_all_packs(struct repository *r);\n  * for speed.\n  */\n unsigned long repo_approximate_object_count(struct repository *r);\n-#define approximate_object_count() repo_approximate_object_count(the_repository)\n \n struct packed_git *find_sha1_pack(const unsigned char *sha1,\n \t\t\t\t  struct packed_git *packs);\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473644","messageId":"patch-12.17-abd237009f9-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 12/17] cocci: apply the \"promisor-remote.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:16Z","receivedAt":"2023-03-17T15:36:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"promisor-remote.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/cat-file.c                              |  2 +-\n builtin/fetch.c                                 |  4 ++--\n builtin/gc.c                                    |  2 +-\n builtin/index-pack.c                            |  2 +-\n builtin/pack-objects.c                          |  2 +-\n builtin/repack.c                                |  2 +-\n cache-tree.c                                    |  4 ++--\n connected.c                                     |  4 ++--\n contrib/coccinelle/the_repository.cocci         | 10 ++++++++++\n contrib/coccinelle/the_repository.pending.cocci | 10 ----------\n diff.c                                          |  2 +-\n diffcore-break.c                                |  2 +-\n diffcore-rename.c                               |  4 ++--\n list-objects-filter-options.c                   |  7 ++++---\n merge-ort.c                                     |  2 +-\n packfile.c                                      |  2 +-\n promisor-remote.h                               | 15 ---------------\n unpack-trees.c                                  |  2 +-\n 18 files changed, 32 insertions(+), 46 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex caf2d258619..b72dd91bd1f 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -792,7 +792,7 @@ static int batch_objects(struct batch_options *opt)\n \t\tif (!memcmp(&data.info, &empty, sizeof(empty)))\n \t\t\tdata.skip_object_info = 1;\n \n-\t\tif (has_promisor_remote())\n+\t\tif (repo_has_promisor_remote(the_repository))\n \t\t\twarning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n \n \t\tread_replace_refs = 0;\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 784e344d2bb..0020015ca42 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2008,7 +2008,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * If no prior partial clone/fetch and the current fetch DID NOT\n \t * request a partial-fetch, do a normal fetch.\n \t */\n-\tif (!has_promisor_remote() && !filter_options.choice)\n+\tif (!repo_has_promisor_remote(the_repository) && !filter_options.choice)\n \t\treturn;\n \n \t/*\n@@ -2264,7 +2264,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \t\t\tprintf(\"%s\\n\", oid_to_hex(oid));\n \t\toidset_clear(&acked_commits);\n \t} else if (remote) {\n-\t\tif (filter_options.choice || has_promisor_remote())\n+\t\tif (filter_options.choice || repo_has_promisor_remote(the_repository))\n \t\t\tfetch_one_setup_partial(remote);\n \t\tresult = fetch_one(remote, argc, argv, prune_tags_ok, stdin_refspecs);\n \t} else {\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex bef26020f99..a1a2ae4da29 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -699,7 +699,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \t\t\tstrvec_push(&prune, prune_expire);\n \t\t\tif (quiet)\n \t\t\t\tstrvec_push(&prune, \"--no-progress\");\n-\t\t\tif (has_promisor_remote())\n+\t\t\tif (repo_has_promisor_remote(the_repository))\n \t\t\t\tstrvec_push(&prune,\n \t\t\t\t\t    \"--exclude-promisor-objects\");\n \t\t\tprune_cmd.git_cmd = 1;\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 4cf69ee1d97..de47f3f6441 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1390,7 +1390,7 @@ static void fix_unresolved_deltas(struct hashfile *f)\n \t\tsorted_by_pos[i] = &ref_deltas[i];\n \tQSORT(sorted_by_pos, nr_ref_deltas, delta_pos_compare);\n \n-\tif (has_promisor_remote()) {\n+\tif (repo_has_promisor_remote(the_repository)) {\n \t\t/*\n \t\t * Prefetch the delta bases.\n \t\t */\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 3c9b35642cb..2f2c02589b3 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -2078,7 +2078,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)\n \n \tif (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,\n \t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {\n-\t\tif (has_promisor_remote()) {\n+\t\tif (repo_has_promisor_remote(the_repository)) {\n \t\t\tprefetch_to_pack(object_index);\n \t\t\tif (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,\n \t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex f6493795318..25658fe732b 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -901,7 +901,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\tstrvec_push(&cmd.args, \"--reflog\");\n \t\tstrvec_push(&cmd.args, \"--indexed-objects\");\n \t}\n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\tstrvec_push(&cmd.args, \"--exclude-promisor-objects\");\n \tif (!write_midx) {\n \t\tif (write_bitmaps > 0)\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 59610117d0b..ab2cc1edf29 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -240,7 +240,7 @@ int cache_tree_fully_valid(struct cache_tree *it)\n \n static int must_check_existence(const struct cache_entry *ce)\n {\n-\treturn !(has_promisor_remote() && ce_skip_worktree(ce));\n+\treturn !(repo_has_promisor_remote(the_repository) && ce_skip_worktree(ce));\n }\n \n static int update_one(struct cache_tree *it,\n@@ -470,7 +470,7 @@ int cache_tree_update(struct index_state *istate, int flags)\n \tif (!istate->cache_tree)\n \t\tistate->cache_tree = cache_tree();\n \n-\tif (!(flags & WRITE_TREE_MISSING_OK) && has_promisor_remote())\n+\tif (!(flags & WRITE_TREE_MISSING_OK) && repo_has_promisor_remote(the_repository))\n \t\tprefetch_cache_entries(istate, must_check_existence);\n \n \ttrace_performance_enter();\ndiff --git a/connected.c b/connected.c\nindex b90fd61790c..5853fd7cbfd 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -54,7 +54,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n \t\tstrbuf_release(&idx_file);\n \t}\n \n-\tif (has_promisor_remote()) {\n+\tif (repo_has_promisor_remote(the_repository)) {\n \t\t/*\n \t\t * For partial clones, we don't want to have to do a regular\n \t\t * connectivity check because we have to enumerate and exclude\n@@ -97,7 +97,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n \tstrvec_push(&rev_list.args,\"rev-list\");\n \tstrvec_push(&rev_list.args, \"--objects\");\n \tstrvec_push(&rev_list.args, \"--stdin\");\n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\tstrvec_push(&rev_list.args, \"--exclude-promisor-objects\");\n \tif (!opt->is_deepening_fetch) {\n \t\tstrvec_push(&rev_list.args, \"--not\");\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex a325361f961..d5b644a8687 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -95,6 +95,16 @@\n |\n - approximate_object_count\n + repo_approximate_object_count\n+// promisor-remote.h\n+|\n+- promisor_remote_reinit\n++ repo_promisor_remote_reinit\n+|\n+- promisor_remote_find\n++ repo_promisor_remote_find\n+|\n+- has_promisor_remote\n++ repo_has_promisor_remote\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 9b426e49e66..e17a60198c5 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,17 +5,7 @@\n @@\n @@\n (\n-// promisor-remote.h\n-- promisor_remote_reinit\n-+ repo_promisor_remote_reinit\n-|\n-- promisor_remote_find\n-+ repo_promisor_remote_find\n-|\n-- has_promisor_remote\n-+ repo_has_promisor_remote\n // refs.h\n-|\n - dwim_ref\n + repo_dwim_ref\n // rerere.h\ndiff --git a/diff.c b/diff.c\nindex 3abeca9d46c..5278343f95a 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -6860,7 +6860,7 @@ void diffcore_std(struct diff_options *options)\n \t * If no prefetching occurs, diffcore_rename() will prefetch if it\n \t * decides that it needs inexact rename detection.\n \t */\n-\tif (options->repo == the_repository && has_promisor_remote() &&\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&\n \t    (options->output_format & output_formats_to_prefetch ||\n \t     options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))\n \t\tdiff_queued_diff_prefetch(options->repo);\ndiff --git a/diffcore-break.c b/diffcore-break.c\nindex 0d4a14964d0..5462420bbbe 100644\n--- a/diffcore-break.c\n+++ b/diffcore-break.c\n@@ -65,7 +65,7 @@ static int should_break(struct repository *r,\n \t    oideq(&src->oid, &dst->oid))\n \t\treturn 0; /* they are the same */\n \n-\tif (r == the_repository && has_promisor_remote()) {\n+\tif (r == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\toptions.missing_object_cb = diff_queued_diff_prefetch;\n \t\toptions.missing_object_data = r;\n \t}\ndiff --git a/diffcore-rename.c b/diffcore-rename.c\nindex c0422d9e709..a97b1322b51 100644\n--- a/diffcore-rename.c\n+++ b/diffcore-rename.c\n@@ -981,7 +981,7 @@ static int find_basename_matches(struct diff_options *options,\n \t\t\tstrintmap_set(&dests, base, i);\n \t}\n \n-\tif (options->repo == the_repository && has_promisor_remote()) {\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\tdpf_options.missing_object_cb = basename_prefetch;\n \t\tdpf_options.missing_object_data = &prefetch_options;\n \t}\n@@ -1567,7 +1567,7 @@ void diffcore_rename_extended(struct diff_options *options,\n \n \t/* Finish setting up dpf_options */\n \tprefetch_options.skip_unmodified = skip_unmodified;\n-\tif (options->repo == the_repository && has_promisor_remote()) {\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\tdpf_options.missing_object_cb = inexact_prefetch;\n \t\tdpf_options.missing_object_data = &prefetch_options;\n \t}\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex ee01bcd2cc3..ccfeabc4778 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -341,7 +341,7 @@ void partial_clone_register(\n \tchar *filter_name;\n \n \t/* Check if it is already registered */\n-\tif ((promisor_remote = promisor_remote_find(remote))) {\n+\tif ((promisor_remote = repo_promisor_remote_find(the_repository, remote))) {\n \t\tif (promisor_remote->partial_clone_filter)\n \t\t\t/*\n \t\t\t * Remote is already registered and a filter is already\n@@ -369,14 +369,15 @@ void partial_clone_register(\n \tfree(filter_name);\n \n \t/* Make sure the config info are reset */\n-\tpromisor_remote_reinit();\n+\trepo_promisor_remote_reinit(the_repository);\n }\n \n void partial_clone_get_default_filter_spec(\n \tstruct list_objects_filter_options *filter_options,\n \tconst char *remote)\n {\n-\tstruct promisor_remote *promisor = promisor_remote_find(remote);\n+\tstruct promisor_remote *promisor = repo_promisor_remote_find(the_repository,\n+\t\t\t\t\t\t\t\t     remote);\n \tstruct strbuf errbuf = STRBUF_INIT;\n \n \t/*\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 979e8b057b1..ba3f5607bbb 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -4216,7 +4216,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,\n \tstruct string_list_item *e;\n \tstruct oid_array to_fetch = OID_ARRAY_INIT;\n \n-\tif (opt->repo != the_repository || !has_promisor_remote())\n+\tif (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))\n \t\treturn;\n \n \tfor (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {\ndiff --git a/packfile.c b/packfile.c\nindex 79e21ab18e7..4aee73d545f 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -2263,7 +2263,7 @@ int is_promisor_object(const struct object_id *oid)\n \tstatic int promisor_objects_prepared;\n \n \tif (!promisor_objects_prepared) {\n-\t\tif (has_promisor_remote()) {\n+\t\tif (repo_has_promisor_remote(the_repository)) {\n \t\t\tfor_each_packed_object(add_promisor_object,\n \t\t\t\t\t       &promisor_objects,\n \t\t\t\t\t       FOR_EACH_OBJECT_PROMISOR_ONLY |\ndiff --git a/promisor-remote.h b/promisor-remote.h\nindex df36eb08efc..2cb9eda9ea4 100644\n--- a/promisor-remote.h\n+++ b/promisor-remote.h\n@@ -18,24 +18,9 @@ struct promisor_remote {\n };\n \n void repo_promisor_remote_reinit(struct repository *r);\n-static inline void promisor_remote_reinit(void)\n-{\n-\trepo_promisor_remote_reinit(the_repository);\n-}\n-\n void promisor_remote_clear(struct promisor_remote_config *config);\n-\n struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);\n-static inline struct promisor_remote *promisor_remote_find(const char *remote_name)\n-{\n-\treturn repo_promisor_remote_find(the_repository, remote_name);\n-}\n-\n int repo_has_promisor_remote(struct repository *r);\n-static inline int has_promisor_remote(void)\n-{\n-\treturn repo_has_promisor_remote(the_repository);\n-}\n \n /*\n  * Fetches all requested objects from all promisor remotes, trying them one at\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 3d05e45a279..b82ad7e45d0 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -458,7 +458,7 @@ static int check_updates(struct unpack_trees_options *o,\n \tif (should_update_submodules())\n \t\tload_gitmodules_file(index, &state);\n \n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\t/*\n \t\t * Prefetch the objects that are to be checked out in the loop\n \t\t * below.\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473645","messageId":"patch-14.17-fb281b1ecdd-20230317T152725Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 14/17] cocci: apply the \"rerere.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:18Z","receivedAt":"2023-03-17T15:36:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"rerere.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/stash.c                                 | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n rerere.h                                        | 3 ---\n 4 files changed, 5 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 364273f1012..2017c278df2 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -601,7 +601,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,\n \t\tret = error(_(\"could not write index\"));\n \n \tif (ret) {\n-\t\trerere(0);\n+\t\trepo_rerere(the_repository, 0);\n \n \t\tif (index)\n \t\t\tfprintf_ln(stderr, _(\"Index was not unstashed.\"));\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex b20a3e70845..1d1ac7d4fc5 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -109,6 +109,10 @@\n |\n - dwim_ref\n + repo_dwim_ref\n+// rerere.h\n+|\n+- rerere\n++ repo_rerere\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 8bf30798a04..1190a3312bd 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// rerere.h\n-- rerere\n-+ repo_rerere\n // revision.h\n-|\n - init_revisions\n + repo_init_revisions\n )\ndiff --git a/rerere.h b/rerere.h\nindex c32d79c3bd8..876c316321e 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -24,9 +24,6 @@ struct rerere_id {\n };\n \n int setup_rerere(struct repository *,struct string_list *, int);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define rerere(flags) repo_rerere(the_repository, flags)\n-#endif\n int repo_rerere(struct repository *, int);\n /*\n  * Given the conflict ID and the name of a \"file\" used for replaying\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473646","messageId":"patch-09.17-893684f135b-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 09/17] cocci: apply the \"object-store.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:13Z","receivedAt":"2023-03-17T15:36:51Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"object-store.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n apply.c                                       |  9 +++++---\n archive.c                                     |  2 +-\n bisect.c                                      |  5 ++--\n blame.c                                       | 11 +++++----\n builtin/cat-file.c                            | 23 +++++++++++--------\n builtin/clone.c                               |  6 ++---\n builtin/difftool.c                            |  3 ++-\n builtin/fast-export.c                         |  5 ++--\n builtin/fast-import.c                         |  7 +++---\n builtin/fetch.c                               | 12 +++++-----\n builtin/grep.c                                |  6 +++--\n builtin/index-pack.c                          |  9 +++++---\n builtin/log.c                                 |  2 +-\n builtin/merge-tree.c                          |  9 +++++---\n builtin/mktag.c                               |  3 ++-\n builtin/notes.c                               |  7 +++---\n builtin/pack-objects.c                        | 22 ++++++++++++------\n builtin/receive-pack.c                        |  2 +-\n builtin/remote.c                              |  2 +-\n builtin/show-ref.c                            |  2 +-\n builtin/tag.c                                 |  4 ++--\n builtin/unpack-file.c                         |  2 +-\n builtin/unpack-objects.c                      |  5 ++--\n bulk-checkin.c                                |  2 +-\n bundle.c                                      |  2 +-\n cache-tree.c                                  |  8 +++----\n combine-diff.c                                |  2 +-\n commit.c                                      |  3 ++-\n contrib/coccinelle/the_repository.cocci       | 10 ++++++++\n .../coccinelle/the_repository.pending.cocci   | 10 --------\n dir.c                                         |  2 +-\n entry.c                                       |  3 ++-\n fetch-pack.c                                  |  8 +++----\n fmt-merge-msg.c                               |  3 ++-\n fsck.c                                        |  2 +-\n http-push.c                                   | 11 +++++----\n http-walker.c                                 |  4 ++--\n list-objects.c                                |  2 +-\n mailmap.c                                     |  2 +-\n match-trees.c                                 |  4 ++--\n merge-blobs.c                                 |  6 +++--\n merge-ort.c                                   |  2 +-\n merge-recursive.c                             |  5 ++--\n notes-cache.c                                 |  2 +-\n notes-merge.c                                 |  2 +-\n notes.c                                       | 12 ++++++----\n object-file.c                                 |  2 +-\n object-store.h                                |  7 ------\n read-cache.c                                  |  5 ++--\n reflog.c                                      |  5 ++--\n remote.c                                      |  2 +-\n rerere.c                                      |  5 ++--\n send-pack.c                                   |  6 ++---\n shallow.c                                     |  6 ++---\n submodule-config.c                            |  3 ++-\n tag.c                                         |  5 ++--\n tree.c                                        |  3 ++-\n upload-pack.c                                 |  8 +++----\n walker.c                                      |  2 +-\n xdiff-interface.c                             |  2 +-\n 60 files changed, 184 insertions(+), 142 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 57f45cedd2b..eb71586a372 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3201,7 +3201,8 @@ static int apply_binary(struct apply_state *state,\n \t\tunsigned long size;\n \t\tchar *result;\n \n-\t\tresult = read_object_file(&oid, &type, &size);\n+\t\tresult = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t\t       &size);\n \t\tif (!result)\n \t\t\treturn error(_(\"the necessary postimage %s for \"\n \t\t\t\t       \"'%s' cannot be read\"),\n@@ -3264,7 +3265,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns\n \t\tunsigned long sz;\n \t\tchar *result;\n \n-\t\tresult = read_object_file(oid, &type, &sz);\n+\t\tresult = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t       &sz);\n \t\tif (!result)\n \t\t\treturn -1;\n \t\t/* XXX read_sha1_file NUL-terminates */\n@@ -3492,7 +3494,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)\n \n \tclear_image(image);\n \n-\timage->buf = read_object_file(result_id, &type, &size);\n+\timage->buf = repo_read_object_file(the_repository, result_id, &type,\n+\t\t\t\t\t   &size);\n \tif (!image->buf || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(result_id));\n \timage->len = size;\ndiff --git a/archive.c b/archive.c\nindex 732e2100544..0b48de00634 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -84,7 +84,7 @@ static void *object_file_to_archive(const struct archiver_args *args,\n \t\t\t       (args->tree ? &args->tree->object.oid : NULL), oid);\n \n \tpath += args->baselen;\n-\tbuffer = read_object_file(oid, type, sizep);\n+\tbuffer = repo_read_object_file(the_repository, oid, type, sizep);\n \tif (buffer && S_ISREG(mode)) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tsize_t size = 0;\ndiff --git a/bisect.c b/bisect.c\nindex 3088516e174..db7aa2032e1 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -148,8 +148,9 @@ static void show_list(const char *debug, int counted, int nr,\n \t\tunsigned commit_flags = commit->object.flags;\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tchar *buf = read_object_file(&commit->object.oid, &type,\n-\t\t\t\t\t     &size);\n+\t\tchar *buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &commit->object.oid, &type,\n+\t\t\t\t\t\t  &size);\n \t\tconst char *subject_start;\n \t\tint subject_len;\n \ndiff --git a/blame.c b/blame.c\nindex af2b67c0847..7009a3379c5 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -1028,8 +1028,9 @@ static void fill_origin_blob(struct diff_options *opt,\n \t\t\t\t    &o->blob_oid, 1, &file->ptr, &file_size))\n \t\t\t;\n \t\telse\n-\t\t\tfile->ptr = read_object_file(&o->blob_oid, &type,\n-\t\t\t\t\t\t     &file_size);\n+\t\t\tfile->ptr = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t  &o->blob_oid, &type,\n+\t\t\t\t\t\t\t  &file_size);\n \t\tfile->size = file_size;\n \n \t\tif (!file->ptr)\n@@ -2838,8 +2839,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,\n \t\t\t\t    &sb->final_buf_size))\n \t\t\t;\n \t\telse\n-\t\t\tsb->final_buf = read_object_file(&o->blob_oid, &type,\n-\t\t\t\t\t\t\t &sb->final_buf_size);\n+\t\t\tsb->final_buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t      &o->blob_oid,\n+\t\t\t\t\t\t\t      &type,\n+\t\t\t\t\t\t\t      &sb->final_buf_size);\n \n \t\tif (!sb->final_buf)\n \t\t\tdie(_(\"cannot read blob %s for path %s\"),\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex cc17635e765..caf2d258619 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -60,7 +60,7 @@ static int filter_object(const char *path, unsigned mode,\n {\n \tenum object_type type;\n \n-\t*buf = read_object_file(oid, &type, size);\n+\t*buf = repo_read_object_file(the_repository, oid, &type, size);\n \tif (!*buf)\n \t\treturn error(_(\"cannot read object %s '%s'\"),\n \t\t\t     oid_to_hex(oid), path);\n@@ -152,7 +152,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\tgoto cleanup;\n \n \tcase 'e':\n-\t\treturn !has_object_file(&oid);\n+\t\treturn !repo_has_object_file(the_repository, &oid);\n \n \tcase 'w':\n \n@@ -187,7 +187,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\t\tret = stream_blob(&oid);\n \t\t\tgoto cleanup;\n \t\t}\n-\t\tbuf = read_object_file(&oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t\t    &size);\n \t\tif (!buf)\n \t\t\tdie(\"Cannot read object %s\", obj_name);\n \n@@ -207,8 +208,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\tif (exp_type_id == OBJ_BLOB) {\n \t\t\tstruct object_id blob_oid;\n \t\t\tif (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {\n-\t\t\t\tchar *buffer = read_object_file(&oid, &type,\n-\t\t\t\t\t\t\t\t&size);\n+\t\t\t\tchar *buffer = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t\t     &oid,\n+\t\t\t\t\t\t\t\t     &type,\n+\t\t\t\t\t\t\t\t     &size);\n \t\t\t\tconst char *target;\n \t\t\t\tif (!skip_prefix(buffer, \"object \", &target) ||\n \t\t\t\t    get_oid_hex(target, &blob_oid))\n@@ -383,9 +386,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d\n \t\t\t\tif (!textconv_object(the_repository,\n \t\t\t\t\t\t     data->rest, 0100644, oid,\n \t\t\t\t\t\t     1, &contents, &size))\n-\t\t\t\t\tcontents = read_object_file(oid,\n-\t\t\t\t\t\t\t\t    &type,\n-\t\t\t\t\t\t\t\t    &size);\n+\t\t\t\t\tcontents = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t\t\t oid,\n+\t\t\t\t\t\t\t\t\t &type,\n+\t\t\t\t\t\t\t\t\t &size);\n \t\t\t\tif (!contents)\n \t\t\t\t\tdie(\"could not convert '%s' %s\",\n \t\t\t\t\t    oid_to_hex(oid), data->rest);\n@@ -402,7 +406,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d\n \t\tunsigned long size;\n \t\tvoid *contents;\n \n-\t\tcontents = read_object_file(oid, &type, &size);\n+\t\tcontents = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t &size);\n \n \t\tif (use_mailmap) {\n \t\t\tsize_t s = size;\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 65b5b7db6de..4de4640ed45 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -547,9 +547,9 @@ static void write_followtags(const struct ref *refs, const char *msg)\n \t\t\tcontinue;\n \t\tif (ends_with(ref->name, \"^{}\"))\n \t\t\tcontinue;\n-\t\tif (!has_object_file_with_flags(&ref->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK |\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,\n+\t\t\t\t\t\t     OBJECT_INFO_QUICK |\n+\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\tcontinue;\n \t\tupdate_ref(msg, ref->name, &ref->old_oid, NULL, 0,\n \t\t\t   UPDATE_REFS_DIE_ON_ERR);\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex dbbfb19f192..30daa83bc6b 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -295,7 +295,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)\n \t} else {\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tdata = read_object_file(oid, &type, &size);\n+\t\tdata = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t     &size);\n \t\tif (!data)\n \t\t\tdie(_(\"could not read object %s for symlink %s\"),\n \t\t\t\toid_to_hex(oid), path);\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 5fe7c02970e..6515bd2ad8b 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -296,7 +296,7 @@ static void export_blob(const struct object_id *oid)\n \t\tobject = (struct object *)lookup_blob(the_repository, oid);\n \t\teaten = 0;\n \t} else {\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf)\n \t\t\tdie(\"could not read blob %s\", oid_to_hex(oid));\n \t\tif (check_object_signature(the_repository, oid, buf, size,\n@@ -766,7 +766,8 @@ static void handle_tag(const char *name, struct tag *tag)\n \t\treturn;\n \t}\n \n-\tbuf = read_object_file(&tag->object.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &tag->object.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\tdie(\"could not read tag %s\", oid_to_hex(&tag->object.oid));\n \tmessage = memmem(buf, size, \"\\n\\n\", 2);\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 2098c0c5a37..20654341782 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1265,7 +1265,7 @@ static void load_tree(struct tree_entry *root)\n \t\t\tdie(\"Can't load tree %s\", oid_to_hex(oid));\n \t} else {\n \t\tenum object_type type;\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf || type != OBJ_TREE)\n \t\t\tdie(\"Can't load tree %s\", oid_to_hex(oid));\n \t}\n@@ -2936,7 +2936,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)\n \tchar *buf;\n \n \tif (!oe || oe->pack_id == MAX_PACK_ID) {\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t} else {\n \t\ttype = oe->type;\n \t\tbuf = gfi_unpack_entry(oe, &size);\n@@ -3044,7 +3044,8 @@ static struct object_entry *dereference(struct object_entry *oe,\n \t\tbuf = gfi_unpack_entry(oe, &size);\n \t} else {\n \t\tenum object_type unused;\n-\t\tbuf = read_object_file(oid, &unused, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &unused,\n+\t\t\t\t\t    &size);\n \t}\n \tif (!buf)\n \t\tdie(\"Can't load object %s\", oid_to_hex(oid));\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex db8815032fc..784e344d2bb 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -407,9 +407,9 @@ static void find_non_local_tags(const struct ref *refs,\n \t\t */\n \t\tif (ends_with(ref->name, \"^{}\")) {\n \t\t\tif (item &&\n-\t\t\t    !has_object_file_with_flags(&ref->old_oid, quick_flags) &&\n+\t\t\t    !repo_has_object_file_with_flags(the_repository, &ref->old_oid, quick_flags) &&\n \t\t\t    !oidset_contains(&fetch_oids, &ref->old_oid) &&\n-\t\t\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t\t\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t\t\t    !oidset_contains(&fetch_oids, &item->oid))\n \t\t\t\tclear_item(item);\n \t\t\titem = NULL;\n@@ -423,7 +423,7 @@ static void find_non_local_tags(const struct ref *refs,\n \t\t * fetch.\n \t\t */\n \t\tif (item &&\n-\t\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t\t    !oidset_contains(&fetch_oids, &item->oid))\n \t\t\tclear_item(item);\n \n@@ -444,7 +444,7 @@ static void find_non_local_tags(const struct ref *refs,\n \t * checked to see if it needs fetching.\n \t */\n \tif (item &&\n-\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t    !oidset_contains(&fetch_oids, &item->oid))\n \t\tclear_item(item);\n \n@@ -1320,8 +1320,8 @@ static int check_exist_and_connected(struct ref *ref_map)\n \t * we need all direct targets to exist.\n \t */\n \tfor (r = rm; r; r = r->next) {\n-\t\tif (!has_object_file_with_flags(&r->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, &r->old_oid,\n+\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\treturn -1;\n \t}\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex f7821c5fbba..18561b10029 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -560,7 +560,8 @@ static int grep_cache(struct grep_opt *opt,\n \t\t\tvoid *data;\n \t\t\tunsigned long size;\n \n-\t\t\tdata = read_object_file(&ce->oid, &type, &size);\n+\t\t\tdata = repo_read_object_file(the_repository, &ce->oid,\n+\t\t\t\t\t\t     &type, &size);\n \t\t\tinit_tree_desc(&tree, data, size);\n \n \t\t\thit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);\n@@ -650,7 +651,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,\n \t\t\tvoid *data;\n \t\t\tunsigned long size;\n \n-\t\t\tdata = read_object_file(&entry.oid, &type, &size);\n+\t\t\tdata = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t     &entry.oid, &type, &size);\n \t\t\tif (!data)\n \t\t\t\tdie(_(\"unable to read tree (%s)\"),\n \t\t\t\t    oid_to_hex(&entry.oid));\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 6648f2daef5..4cf69ee1d97 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -801,7 +801,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \tif (startup_info->have_repository) {\n \t\tread_lock();\n \t\tcollision_test_needed =\n-\t\t\thas_object_file_with_flags(oid, OBJECT_INFO_QUICK);\n+\t\t\trepo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t\t\tOBJECT_INFO_QUICK);\n \t\tread_unlock();\n \t}\n \n@@ -821,7 +822,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \t\t\tdie(_(\"cannot read existing object info %s\"), oid_to_hex(oid));\n \t\tif (has_type != type || has_size != size)\n \t\t\tdie(_(\"SHA1 COLLISION FOUND WITH %s !\"), oid_to_hex(oid));\n-\t\thas_data = read_object_file(oid, &has_type, &has_size);\n+\t\thas_data = repo_read_object_file(the_repository, oid,\n+\t\t\t\t\t\t &has_type, &has_size);\n \t\tread_unlock();\n \t\tif (!data)\n \t\t\tdata = new_data = get_data_from_pack(obj_entry);\n@@ -1414,7 +1416,8 @@ static void fix_unresolved_deltas(struct hashfile *f)\n \n \t\tif (objects[d->obj_no].real_type != OBJ_REF_DELTA)\n \t\t\tcontinue;\n-\t\tdata = read_object_file(&d->oid, &type, &size);\n+\t\tdata = repo_read_object_file(the_repository, &d->oid, &type,\n+\t\t\t\t\t     &size);\n \t\tif (!data)\n \t\t\tcontinue;\n \ndiff --git a/builtin/log.c b/builtin/log.c\nindex b76a1c82d8f..3dde77bde27 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -675,7 +675,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)\n {\n \tunsigned long size;\n \tenum object_type type;\n-\tchar *buf = read_object_file(oid, &type, &size);\n+\tchar *buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tint offset = 0;\n \n \tif (!buf)\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex c0acbc6a546..d628ad1da9f 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -69,7 +69,9 @@ static void *result(struct merge_list *entry, unsigned long *size)\n \tconst char *path = entry->path;\n \n \tif (!entry->stage)\n-\t\treturn read_object_file(&entry->blob->object.oid, &type, size);\n+\t\treturn repo_read_object_file(the_repository,\n+\t\t\t\t\t     &entry->blob->object.oid, &type,\n+\t\t\t\t\t     size);\n \tbase = NULL;\n \tif (entry->stage == 1) {\n \t\tbase = entry->blob;\n@@ -92,8 +94,9 @@ static void *origin(struct merge_list *entry, unsigned long *size)\n \tenum object_type type;\n \twhile (entry) {\n \t\tif (entry->stage == 2)\n-\t\t\treturn read_object_file(&entry->blob->object.oid,\n-\t\t\t\t\t\t&type, size);\n+\t\t\treturn repo_read_object_file(the_repository,\n+\t\t\t\t\t\t     &entry->blob->object.oid,\n+\t\t\t\t\t\t     &type, size);\n \t\tentry = entry->link;\n \t}\n \treturn NULL;\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 5d22909122d..141a2d45693 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -51,7 +51,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)\n \tvoid *buffer;\n \tconst struct object_id *repl;\n \n-\tbuffer = read_object_file(tagged_oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, tagged_oid, &type,\n+\t\t\t\t       &size);\n \tif (!buffer)\n \t\tdie(_(\"could not read tagged object '%s'\"),\n \t\t    oid_to_hex(tagged_oid));\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex b497eae520e..ba1daa4ff0f 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -124,7 +124,7 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)\n {\n \tunsigned long size;\n \tenum object_type type;\n-\tchar *buf = read_object_file(oid, &type, &size);\n+\tchar *buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (buf) {\n \t\tif (size)\n \t\t\twrite_or_die(fd, buf, size);\n@@ -259,7 +259,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)\n \n \tif (repo_get_oid(the_repository, arg, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), arg);\n-\tif (!(buf = read_object_file(&object, &type, &len)))\n+\tif (!(buf = repo_read_object_file(the_repository, &object, &type, &len)))\n \t\tdie(_(\"failed to read object '%s'.\"), arg);\n \tif (type != OBJ_BLOB) {\n \t\tfree(buf);\n@@ -616,7 +616,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)\n \t\t/* Append buf to previous note contents */\n \t\tunsigned long size;\n \t\tenum object_type type;\n-\t\tchar *prev_buf = read_object_file(note, &type, &size);\n+\t\tchar *prev_buf = repo_read_object_file(the_repository, note,\n+\t\t\t\t\t\t       &type, &size);\n \n \t\tstrbuf_grow(&d.buf, size + 1);\n \t\tif (d.buf.len && prev_buf && size)\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 74a167a180c..3c9b35642cb 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -288,11 +288,13 @@ static void *get_delta(struct object_entry *entry)\n \tvoid *buf, *base_buf, *delta_buf;\n \tenum object_type type;\n \n-\tbuf = read_object_file(&entry->idx.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &entry->idx.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\tdie(_(\"unable to read %s\"), oid_to_hex(&entry->idx.oid));\n-\tbase_buf = read_object_file(&DELTA(entry)->idx.oid, &type,\n-\t\t\t\t    &base_size);\n+\tbase_buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t &DELTA(entry)->idx.oid, &type,\n+\t\t\t\t\t &base_size);\n \tif (!base_buf)\n \t\tdie(\"unable to read %s\",\n \t\t    oid_to_hex(&DELTA(entry)->idx.oid));\n@@ -454,7 +456,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent\n \t\t\t\t       &size, NULL)) != NULL)\n \t\t\tbuf = NULL;\n \t\telse {\n-\t\t\tbuf = read_object_file(&entry->idx.oid, &type, &size);\n+\t\t\tbuf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t    &entry->idx.oid, &type,\n+\t\t\t\t\t\t    &size);\n \t\t\tif (!buf)\n \t\t\t\tdie(_(\"unable to read %s\"),\n \t\t\t\t    oid_to_hex(&entry->idx.oid));\n@@ -1665,7 +1669,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)\n \t/* Did not find one.  Either we got a bogus request or\n \t * we need to read and perhaps cache.\n \t */\n-\tdata = read_object_file(oid, &type, &size);\n+\tdata = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!data)\n \t\treturn NULL;\n \tif (type != OBJ_TREE) {\n@@ -2525,7 +2529,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,\n \t/* Load data if not already done */\n \tif (!trg->data) {\n \t\tpacking_data_lock(&to_pack);\n-\t\ttrg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);\n+\t\ttrg->data = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &trg_entry->idx.oid, &type,\n+\t\t\t\t\t\t  &sz);\n \t\tpacking_data_unlock(&to_pack);\n \t\tif (!trg->data)\n \t\t\tdie(_(\"object %s cannot be read\"),\n@@ -2538,7 +2544,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,\n \t}\n \tif (!src->data) {\n \t\tpacking_data_lock(&to_pack);\n-\t\tsrc->data = read_object_file(&src_entry->idx.oid, &type, &sz);\n+\t\tsrc->data = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &src_entry->idx.oid, &type,\n+\t\t\t\t\t\t  &sz);\n \t\tpacking_data_unlock(&to_pack);\n \t\tif (!src->data) {\n \t\t\tif (src_entry->preferred_base) {\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 6d4fc1368a4..5609206499c 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1494,7 +1494,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)\n \t\t}\n \t}\n \n-\tif (!is_null_oid(new_oid) && !has_object_file(new_oid)) {\n+\tif (!is_null_oid(new_oid) && !repo_has_object_file(the_repository, new_oid)) {\n \t\terror(\"unpack should have generated %s, \"\n \t\t      \"but I can't find it!\", oid_to_hex(new_oid));\n \t\tret = \"bad pack\";\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 729f6f3643a..a6b100dce7f 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -443,7 +443,7 @@ static int get_push_ref_states(const struct ref *remote_refs,\n \t\t\tinfo->status = PUSH_STATUS_UPTODATE;\n \t\telse if (is_null_oid(&ref->old_oid))\n \t\t\tinfo->status = PUSH_STATUS_CREATE;\n-\t\telse if (has_object_file(&ref->old_oid) &&\n+\t\telse if (repo_has_object_file(the_repository, &ref->old_oid) &&\n \t\t\t ref_newer(&ref->new_oid, &ref->old_oid))\n \t\t\tinfo->status = PUSH_STATUS_FASTFORWARD;\n \t\telse\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex eb3ad1688ba..b294ae41641 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -26,7 +26,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \tconst char *hex;\n \tstruct object_id peeled;\n \n-\tif (!has_object_file(oid))\n+\tif (!repo_has_object_file(the_repository, oid))\n \t\tdie(\"git show-ref: bad ref %s (%s)\", refname,\n \t\t    oid_to_hex(oid));\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex e6cbf6e5a8d..cd97a141faf 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -215,7 +215,7 @@ static void write_tag_body(int fd, const struct object_id *oid)\n \tstruct strbuf payload = STRBUF_INIT;\n \tstruct strbuf signature = STRBUF_INIT;\n \n-\torig = buf = read_object_file(oid, &type, &size);\n+\torig = buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn;\n \tif (parse_signature(buf, size, &payload, &signature)) {\n@@ -366,7 +366,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)\n \t\tstrbuf_addstr(sb, \"object of unknown type\");\n \t\tbreak;\n \tcase OBJ_COMMIT:\n-\t\tif ((buf = read_object_file(oid, &type, &size))) {\n+\t\tif ((buf = repo_read_object_file(the_repository, oid, &type, &size))) {\n \t\t\tsubject_len = find_commit_subject(buf, &subject_start);\n \t\t\tstrbuf_insert(sb, sb->len, subject_start, subject_len);\n \t\t} else {\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex e0d5178acc5..9d5c1524197 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -10,7 +10,7 @@ static char *create_temp_file(struct object_id *oid)\n \tunsigned long size;\n \tint fd;\n \n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(oid));\n \ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 43789b8ef29..c0720961743 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -442,7 +442,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \t\tdelta_data = get_data(delta_size);\n \t\tif (!delta_data)\n \t\t\treturn;\n-\t\tif (has_object_file(&base_oid))\n+\t\tif (repo_has_object_file(the_repository, &base_oid))\n \t\t\t; /* Ok we have this one */\n \t\telse if (resolve_against_held(nr, &base_oid,\n \t\t\t\t\t      delta_data, delta_size))\n@@ -508,7 +508,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \tif (resolve_against_held(nr, &base_oid, delta_data, delta_size))\n \t\treturn;\n \n-\tbase = read_object_file(&base_oid, &type, &base_size);\n+\tbase = repo_read_object_file(the_repository, &base_oid, &type,\n+\t\t\t\t     &base_size);\n \tif (!base) {\n \t\terror(\"failed to read delta-pack base object %s\",\n \t\t      oid_to_hex(&base_oid));\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 855b68ec23b..b44b94e8663 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -124,7 +124,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id\n \tint i;\n \n \t/* The object may already exist in the repository */\n-\tif (has_object_file(oid))\n+\tif (repo_has_object_file(the_repository, oid))\n \t\treturn 1;\n \n \t/* Might want to keep the list sorted */\ndiff --git a/bundle.c b/bundle.c\nindex 6ab6cd7378d..9b57bade7a6 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -293,7 +293,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)\n \tif (revs->max_age == -1 && revs->min_age == -1)\n \t\tgoto out;\n \n-\tbuf = read_object_file(&tag->oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &tag->oid, &type, &size);\n \tif (!buf)\n \t\tgoto out;\n \tline = memmem(buf, size, \"\\ntagger \", 8);\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 88c2c04f87f..59610117d0b 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -229,7 +229,7 @@ int cache_tree_fully_valid(struct cache_tree *it)\n \tint i;\n \tif (!it)\n \t\treturn 0;\n-\tif (it->entry_count < 0 || !has_object_file(&it->oid))\n+\tif (it->entry_count < 0 || !repo_has_object_file(the_repository, &it->oid))\n \t\treturn 0;\n \tfor (i = 0; i < it->subtree_nr; i++) {\n \t\tif (!cache_tree_fully_valid(it->down[i]->cache_tree))\n@@ -280,7 +280,7 @@ static int update_one(struct cache_tree *it,\n \t\t}\n \t}\n \n-\tif (0 <= it->entry_count && has_object_file(&it->oid))\n+\tif (0 <= it->entry_count && repo_has_object_file(the_repository, &it->oid))\n \t\treturn it->entry_count;\n \n \t/*\n@@ -386,7 +386,7 @@ static int update_one(struct cache_tree *it,\n \t\tce_missing_ok = mode == S_IFGITLINK || missing_ok ||\n \t\t\t!must_check_existence(ce);\n \t\tif (is_null_oid(oid) ||\n-\t\t    (!ce_missing_ok && !has_object_file(oid))) {\n+\t\t    (!ce_missing_ok && !repo_has_object_file(the_repository, oid))) {\n \t\t\tstrbuf_release(&buffer);\n \t\t\tif (expected_missing)\n \t\t\t\treturn -1;\n@@ -434,7 +434,7 @@ static int update_one(struct cache_tree *it,\n \t\tstruct object_id oid;\n \t\thash_object_file(the_hash_algo, buffer.buf, buffer.len,\n \t\t\t\t OBJ_TREE, &oid);\n-\t\tif (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (repo_has_object_file_with_flags(the_repository, &oid, OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\toidcpy(&it->oid, &oid);\n \t\telse\n \t\t\tto_invalidate = 1;\ndiff --git a/combine-diff.c b/combine-diff.c\nindex d84ab878b72..20f8a03924f 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r,\n \t\t*size = fill_textconv(r, textconv, df, &blob);\n \t\tfree_filespec(df);\n \t} else {\n-\t\tblob = read_object_file(oid, &type, size);\n+\t\tblob = repo_read_object_file(the_repository, oid, &type, size);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"object '%s' is not a blob!\", oid_to_hex(oid));\n \t}\ndiff --git a/commit.c b/commit.c\nindex 6036376d05a..dd22e76c3e1 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -1212,7 +1212,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header\n \tdesc = merge_remote_util(parent);\n \tif (!desc || !desc->obj)\n \t\treturn;\n-\tbuf = read_object_file(&desc->obj->oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &desc->obj->oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf || type != OBJ_TAG)\n \t\tgoto free_return;\n \tif (!parse_signature(buf, size, &payload, &signature))\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 3c0bd8781e7..fa159aba5b5 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -77,6 +77,16 @@\n |\n - diff_setup\n + repo_diff_setup\n+// object-store.h\n+|\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 00461ee86b3..69e9694111e 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,17 +5,7 @@\n @@\n @@\n (\n-// object-store.h\n-- read_object_file\n-+ repo_read_object_file\n-|\n-- has_object_file\n-+ repo_has_object_file\n-|\n-- has_object_file_with_flags\n-+ repo_has_object_file_with_flags\n // pretty.h\n-|\n - format_commit_message\n + repo_format_commit_message\n // packfile.h\ndiff --git a/dir.c b/dir.c\nindex 4e99f0c868f..6615afe8f13 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -267,7 +267,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,\n \t*size_out = 0;\n \t*data_out = NULL;\n \n-\tdata = read_object_file(oid, &type, &sz);\n+\tdata = repo_read_object_file(the_repository, oid, &type, &sz);\n \tif (!data || type != OBJ_BLOB) {\n \t\tfree(data);\n \t\treturn -1;\ndiff --git a/entry.c b/entry.c\nindex 971ab268714..7c50220a782 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -86,7 +86,8 @@ void *read_blob_entry(const struct cache_entry *ce, size_t *size)\n {\n \tenum object_type type;\n \tunsigned long ul;\n-\tvoid *blob_data = read_object_file(&ce->oid, &type, &ul);\n+\tvoid *blob_data = repo_read_object_file(the_repository, &ce->oid,\n+\t\t\t\t\t\t&type, &ul);\n \n \t*size = ul;\n \tif (blob_data) {\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 04016d1e325..8c497b48219 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -762,9 +762,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,\n \t\tif (!commit) {\n \t\t\tstruct object *o;\n \n-\t\t\tif (!has_object_file_with_flags(&ref->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK |\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\t\tif (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,\n+\t\t\t\t\t\t\t     OBJECT_INFO_QUICK |\n+\t\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\t\tcontinue;\n \t\t\to = parse_object(the_repository, &ref->old_oid);\n \t\t\tif (!o || o->type != OBJ_COMMIT)\n@@ -1963,7 +1963,7 @@ static void update_shallow(struct fetch_pack_args *args,\n \t\tstruct oid_array extra = OID_ARRAY_INIT;\n \t\tstruct object_id *oid = si->shallow->oid;\n \t\tfor (i = 0; i < si->shallow->nr; i++)\n-\t\t\tif (has_object_file(&oid[i]))\n+\t\t\tif (repo_has_object_file(the_repository, &oid[i]))\n \t\t\t\toid_array_append(&extra, &oid[i]);\n \t\tif (extra.nr) {\n \t\t\tsetup_alternate_shallow(&shallow_lock,\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex a5de91ba22c..e9c6623647d 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -520,7 +520,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)\n \t\tstruct object_id *oid = origins.items[i].util;\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tchar *buf = read_object_file(oid, &type, &size);\n+\t\tchar *buf = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t  &size);\n \t\tchar *origbuf = buf;\n \t\tunsigned long len = size;\n \t\tstruct signature_check sigc = { NULL };\ndiff --git a/fsck.c b/fsck.c\nindex 807a84971a2..0343fb7a887 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1332,7 +1332,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,\n \t\tif (oidset_contains(blobs_done, oid))\n \t\t\tcontinue;\n \n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf) {\n \t\t\tif (is_promisor_object(oid))\n \t\t\t\tcontinue;\ndiff --git a/http-push.c b/http-push.c\nindex 45d5cc0972f..6776f3f2758 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -362,7 +362,8 @@ static void start_put(struct transfer_request *request)\n \tssize_t size;\n \tgit_zstream stream;\n \n-\tunpacked = read_object_file(&request->obj->oid, &type, &len);\n+\tunpacked = repo_read_object_file(the_repository, &request->obj->oid,\n+\t\t\t\t\t &type, &len);\n \thdrlen = format_object_header(hdr, sizeof(hdr), type, len);\n \n \t/* Set it up */\n@@ -1427,7 +1428,7 @@ static void one_remote_ref(const char *refname)\n \t * Fetch a copy of the object if it doesn't exist locally - it\n \t * may be required for updating server info later.\n \t */\n-\tif (repo->can_update_info_refs && !has_object_file(&ref->old_oid)) {\n+\tif (repo->can_update_info_refs && !repo_has_object_file(the_repository, &ref->old_oid)) {\n \t\tobj = lookup_unknown_object(the_repository, &ref->old_oid);\n \t\tfprintf(stderr,\t\"  fetch %s for %s\\n\",\n \t\t\toid_to_hex(&ref->old_oid), refname);\n@@ -1628,14 +1629,14 @@ static int delete_remote_branch(const char *pattern, int force)\n \t\t\treturn error(\"Remote HEAD symrefs too deep\");\n \t\tif (is_null_oid(&head_oid))\n \t\t\treturn error(\"Unable to resolve remote HEAD\");\n-\t\tif (!has_object_file(&head_oid))\n+\t\tif (!repo_has_object_file(the_repository, &head_oid))\n \t\t\treturn error(\"Remote HEAD resolves to object %s\\nwhich does not exist locally, perhaps you need to fetch?\", oid_to_hex(&head_oid));\n \n \t\t/* Remote branch must resolve to a known object */\n \t\tif (is_null_oid(&remote_ref->old_oid))\n \t\t\treturn error(\"Unable to resolve remote branch %s\",\n \t\t\t\t     remote_ref->name);\n-\t\tif (!has_object_file(&remote_ref->old_oid))\n+\t\tif (!repo_has_object_file(the_repository, &remote_ref->old_oid))\n \t\t\treturn 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));\n \n \t\t/* Remote branch must be an ancestor of remote HEAD */\n@@ -1855,7 +1856,7 @@ int cmd_main(int argc, const char **argv)\n \t\tif (!force_all &&\n \t\t    !is_null_oid(&ref->old_oid) &&\n \t\t    !ref->force) {\n-\t\t\tif (!has_object_file(&ref->old_oid) ||\n+\t\t\tif (!repo_has_object_file(the_repository, &ref->old_oid) ||\n \t\t\t    !ref_newer(&ref->peer_ref->new_oid,\n \t\t\t\t       &ref->old_oid)) {\n \t\t\t\t/*\ndiff --git a/http-walker.c b/http-walker.c\nindex b8f0f98ae14..da1b6b64210 100644\n--- a/http-walker.c\n+++ b/http-walker.c\n@@ -135,7 +135,7 @@ static int fill_active_slot(struct walker *walker)\n \tlist_for_each_safe(pos, tmp, head) {\n \t\tobj_req = list_entry(pos, struct object_request, node);\n \t\tif (obj_req->state == WAITING) {\n-\t\t\tif (has_object_file(&obj_req->oid))\n+\t\t\tif (repo_has_object_file(the_repository, &obj_req->oid))\n \t\t\t\tobj_req->state = COMPLETE;\n \t\t\telse {\n \t\t\t\tstart_object_request(walker, obj_req);\n@@ -492,7 +492,7 @@ static int fetch_object(struct walker *walker, unsigned char *hash)\n \tif (!obj_req)\n \t\treturn error(\"Couldn't find request for %s in the queue\", hex);\n \n-\tif (has_object_file(&obj_req->oid)) {\n+\tif (repo_has_object_file(the_repository, &obj_req->oid)) {\n \t\tif (obj_req->req)\n \t\t\tabort_http_object_request(obj_req->req);\n \t\tabort_object_request(obj_req);\ndiff --git a/list-objects.c b/list-objects.c\nindex 5550b3aafeb..ccad7304dfa 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -64,7 +64,7 @@ static void process_blob(struct traversal_context *ctx,\n \t * of missing objects.\n \t */\n \tif (ctx->revs->exclude_promisor_objects &&\n-\t    !has_object_file(&obj->oid) &&\n+\t    !repo_has_object_file(the_repository, &obj->oid) &&\n \t    is_promisor_object(&obj->oid))\n \t\treturn;\n \ndiff --git a/mailmap.c b/mailmap.c\nindex ed8289aea58..f68f664bb1b 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -216,7 +216,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)\n \tif (repo_get_oid(the_repository, name, &oid) < 0)\n \t\treturn 0;\n \n-\tbuf = read_object_file(&oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &oid, &type, &size);\n \tif (!buf)\n \t\treturn error(\"unable to read mailmap object at %s\", name);\n \tif (type != OBJ_BLOB)\ndiff --git a/match-trees.c b/match-trees.c\nindex 49398e599fe..dfc4093425e 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -55,7 +55,7 @@ static void *fill_tree_desc_strict(struct tree_desc *desc,\n \tenum object_type type;\n \tunsigned long size;\n \n-\tbuffer = read_object_file(hash, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, hash, &type, &size);\n \tif (!buffer)\n \t\tdie(\"unable to read tree (%s)\", oid_to_hex(hash));\n \tif (type != OBJ_TREE)\n@@ -188,7 +188,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,\n \tif (*subpath)\n \t\tsubpath++;\n \n-\tbuf = read_object_file(oid1, &type, &sz);\n+\tbuf = repo_read_object_file(the_repository, oid1, &type, &sz);\n \tif (!buf)\n \t\tdie(\"cannot read tree %s\", oid_to_hex(oid1));\n \tinit_tree_desc(&desc, buf, sz);\ndiff --git a/merge-blobs.c b/merge-blobs.c\nindex 8138090f81c..f13246406c2 100644\n--- a/merge-blobs.c\n+++ b/merge-blobs.c\n@@ -12,7 +12,8 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)\n \tunsigned long size;\n \tenum object_type type;\n \n-\tbuf = read_object_file(&obj->object.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &obj->object.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\treturn -1;\n \tif (type != OBJ_BLOB) {\n@@ -78,7 +79,8 @@ void *merge_blobs(struct index_state *istate, const char *path,\n \t\t\treturn NULL;\n \t\tif (!our)\n \t\t\tour = their;\n-\t\treturn read_object_file(&our->object.oid, &type, size);\n+\t\treturn repo_read_object_file(the_repository, &our->object.oid,\n+\t\t\t\t\t     &type, size);\n \t}\n \n \tif (fill_mmfile_blob(&f1, our) < 0)\ndiff --git a/merge-ort.c b/merge-ort.c\nindex e9f8bd15982..979e8b057b1 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -3505,7 +3505,7 @@ static int read_oid_strbuf(struct merge_options *opt,\n \tvoid *buf;\n \tenum object_type type;\n \tunsigned long size;\n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn err(opt, _(\"cannot read object %s\"), oid_to_hex(oid));\n \tif (type != OBJ_BLOB) {\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 75fa0ef3183..d83ce19bb1f 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -951,7 +951,8 @@ static int update_file_flags(struct merge_options *opt,\n \t\t\tgoto update_index;\n \t\t}\n \n-\t\tbuf = read_object_file(&contents->oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, &contents->oid,\n+\t\t\t\t\t    &type, &size);\n \t\tif (!buf) {\n \t\t\tret = err(opt, _(\"cannot read object %s '%s'\"),\n \t\t\t\t  oid_to_hex(&contents->oid), path);\n@@ -3021,7 +3022,7 @@ static int read_oid_strbuf(struct merge_options *opt,\n \tvoid *buf;\n \tenum object_type type;\n \tunsigned long size;\n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn err(opt, _(\"cannot read object %s\"), oid_to_hex(oid));\n \tif (type != OBJ_BLOB) {\ndiff --git a/notes-cache.c b/notes-cache.c\nindex 9dfd251a815..38466091360 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -81,7 +81,7 @@ char *notes_cache_get(struct notes_cache *c, struct object_id *key_oid,\n \tvalue_oid = get_note(&c->tree, key_oid);\n \tif (!value_oid)\n \t\treturn NULL;\n-\tvalue = read_object_file(value_oid, &type, &size);\n+\tvalue = repo_read_object_file(the_repository, value_oid, &type, &size);\n \n \t*outsize = size;\n \treturn value;\ndiff --git a/notes-merge.c b/notes-merge.c\nindex df1a16ac66c..8a09cd9f77c 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -326,7 +326,7 @@ static void write_note_to_worktree(const struct object_id *obj,\n {\n \tenum object_type type;\n \tunsigned long size;\n-\tvoid *buf = read_object_file(note, &type, &size);\n+\tvoid *buf = repo_read_object_file(the_repository, note, &type, &size);\n \n \tif (!buf)\n \t\tdie(\"cannot read note %s for object %s\",\ndiff --git a/notes.c b/notes.c\nindex 750e18c4004..e4dab62cad3 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -786,7 +786,7 @@ static int prune_notes_helper(const struct object_id *object_oid,\n \tstruct note_delete_list **l = (struct note_delete_list **) cb_data;\n \tstruct note_delete_list *n;\n \n-\tif (has_object_file(object_oid))\n+\tif (repo_has_object_file(the_repository, object_oid))\n \t\treturn 0; /* nothing to do for this note */\n \n \t/* failed to find object => prune this note */\n@@ -807,13 +807,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,\n \n \t/* read in both note blob objects */\n \tif (!is_null_oid(new_oid))\n-\t\tnew_msg = read_object_file(new_oid, &new_type, &new_len);\n+\t\tnew_msg = repo_read_object_file(the_repository, new_oid,\n+\t\t\t\t\t\t&new_type, &new_len);\n \tif (!new_msg || !new_len || new_type != OBJ_BLOB) {\n \t\tfree(new_msg);\n \t\treturn 0;\n \t}\n \tif (!is_null_oid(cur_oid))\n-\t\tcur_msg = read_object_file(cur_oid, &cur_type, &cur_len);\n+\t\tcur_msg = repo_read_object_file(the_repository, cur_oid,\n+\t\t\t\t\t\t&cur_type, &cur_len);\n \tif (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {\n \t\tfree(cur_msg);\n \t\tfree(new_msg);\n@@ -869,7 +871,7 @@ static int string_list_add_note_lines(struct string_list *list,\n \t\treturn 0;\n \n \t/* read_sha1_file NUL-terminates */\n-\tdata = read_object_file(oid, &t, &len);\n+\tdata = repo_read_object_file(the_repository, oid, &t, &len);\n \tif (t != OBJ_BLOB || !data || !len) {\n \t\tfree(data);\n \t\treturn t != OBJ_BLOB || !data;\n@@ -1264,7 +1266,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid\n \tif (!oid)\n \t\treturn;\n \n-\tif (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {\n+\tif (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {\n \t\tfree(msg);\n \t\treturn;\n \t}\ndiff --git a/object-file.c b/object-file.c\nindex 939865c1ae0..141cf85f25b 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -1678,7 +1678,7 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,\n \tstruct cached_object *co;\n \n \thash_object_file(the_hash_algo, buf, len, type, oid);\n-\tif (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||\n+\tif (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||\n \t    find_cached_object(oid))\n \t\treturn 0;\n \tALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);\ndiff --git a/object-store.h b/object-store.h\nindex 1a713d89d7c..b47849d4e7e 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -245,9 +245,6 @@ void *repo_read_object_file(struct repository *r,\n \t\t\t    const struct object_id *oid,\n \t\t\t    enum object_type *type,\n \t\t\t    unsigned long *size);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)\n-#endif\n \n /* Read and unpack an object file into memory, write memory to an object file */\n int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);\n@@ -324,10 +321,6 @@ int has_object(struct repository *r, const struct object_id *oid,\n int repo_has_object_file(struct repository *r, const struct object_id *oid);\n int repo_has_object_file_with_flags(struct repository *r,\n \t\t\t\t    const struct object_id *oid, int flags);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define has_object_file(oid) repo_has_object_file(the_repository, oid)\n-#define has_object_file_with_flags(oid, flags) repo_has_object_file_with_flags(the_repository, oid, flags)\n-#endif\n \n /*\n  * Return true iff an alternate object database has a loose object\ndiff --git a/read-cache.c b/read-cache.c\nindex d6c69164d0f..1548e886684 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -263,7 +263,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)\n \tif (strbuf_readlink(&sb, ce->name, expected_size))\n \t\treturn -1;\n \n-\tbuffer = read_object_file(&ce->oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);\n \tif (buffer) {\n \t\tif (size == sb.len)\n \t\t\tmatch = memcmp(buffer, sb.buf, size);\n@@ -3553,7 +3553,8 @@ void *read_blob_data_from_index(struct index_state *istate,\n \t}\n \tif (pos < 0)\n \t\treturn NULL;\n-\tdata = read_object_file(&istate->cache[pos]->oid, &type, &sz);\n+\tdata = repo_read_object_file(the_repository, &istate->cache[pos]->oid,\n+\t\t\t\t     &type, &sz);\n \tif (!data || type != OBJ_BLOB) {\n \t\tfree(data);\n \t\treturn NULL;\ndiff --git a/reflog.c b/reflog.c\nindex 6e8362e7a2f..510663e1e51 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -28,7 +28,8 @@ static int tree_is_complete(const struct object_id *oid)\n \tif (!tree->buffer) {\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tvoid *data = read_object_file(oid, &type, &size);\n+\t\tvoid *data = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t   &size);\n \t\tif (!data) {\n \t\t\ttree->object.flags |= INCOMPLETE;\n \t\t\treturn 0;\n@@ -39,7 +40,7 @@ static int tree_is_complete(const struct object_id *oid)\n \tinit_tree_desc(&desc, tree->buffer, tree->size);\n \tcomplete = 1;\n \twhile (tree_entry(&desc, &entry)) {\n-\t\tif (!has_object_file(&entry.oid) ||\n+\t\tif (!repo_has_object_file(the_repository, &entry.oid) ||\n \t\t    (S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {\n \t\t\ttree->object.flags |= INCOMPLETE;\n \t\t\tcomplete = 0;\ndiff --git a/remote.c b/remote.c\nindex 71b1ae2db05..12f6bea6252 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1759,7 +1759,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,\n \t\tif (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {\n \t\t\tif (starts_with(ref->name, \"refs/tags/\"))\n \t\t\t\treject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;\n-\t\t\telse if (!has_object_file(&ref->old_oid))\n+\t\t\telse if (!repo_has_object_file(the_repository, &ref->old_oid))\n \t\t\t\treject_reason = REF_STATUS_REJECT_FETCH_FIRST;\n \t\t\telse if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) ||\n \t\t\t\t !lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))\ndiff --git a/rerere.c b/rerere.c\nindex 876ab435da9..dfbc1d555ec 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -965,8 +965,9 @@ static int handle_cache(struct index_state *istate,\n \t\t\tbreak;\n \t\ti = ce_stage(ce) - 1;\n \t\tif (!mmfile[i].ptr) {\n-\t\t\tmmfile[i].ptr = read_object_file(&ce->oid, &type,\n-\t\t\t\t\t\t\t &size);\n+\t\t\tmmfile[i].ptr = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t      &ce->oid, &type,\n+\t\t\t\t\t\t\t      &size);\n \t\t\tmmfile[i].size = size;\n \t\t}\n \t}\ndiff --git a/send-pack.c b/send-pack.c\nindex f2e19838c9c..8f8b3d986c7 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -42,9 +42,9 @@ int option_parse_push_signed(const struct option *opt,\n static void feed_object(const struct object_id *oid, FILE *fh, int negative)\n {\n \tif (negative &&\n-\t    !has_object_file_with_flags(oid,\n-\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT |\n-\t\t\t\t\tOBJECT_INFO_QUICK))\n+\t    !repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT |\n+\t\t\t\t\t     OBJECT_INFO_QUICK))\n \t\treturn;\n \n \tif (negative)\ndiff --git a/shallow.c b/shallow.c\nindex 1a2b159fd4e..07278467e47 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -301,7 +301,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)\n \tif (graft->nr_parent != -1)\n \t\treturn 0;\n \tif (data->flags & QUICK) {\n-\t\tif (!has_object_file(&graft->oid))\n+\t\tif (!repo_has_object_file(the_repository, &graft->oid))\n \t\t\treturn 0;\n \t} else if (data->flags & SEEN_ONLY) {\n \t\tstruct commit *c = lookup_commit(the_repository, &graft->oid);\n@@ -466,7 +466,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)\n \tALLOC_ARRAY(info->ours, sa->nr);\n \tALLOC_ARRAY(info->theirs, sa->nr);\n \tfor (i = 0; i < sa->nr; i++) {\n-\t\tif (has_object_file(sa->oid + i)) {\n+\t\tif (repo_has_object_file(the_repository, sa->oid + i)) {\n \t\t\tstruct commit_graft *graft;\n \t\t\tgraft = lookup_commit_graft(the_repository,\n \t\t\t\t\t\t    &sa->oid[i]);\n@@ -494,7 +494,7 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)\n \tfor (i = dst = 0; i < info->nr_theirs; i++) {\n \t\tif (i != dst)\n \t\t\tinfo->theirs[dst] = info->theirs[i];\n-\t\tif (has_object_file(oid + info->theirs[i]))\n+\t\tif (repo_has_object_file(the_repository, oid + info->theirs[i]))\n \t\t\tdst++;\n \t}\n \tinfo->nr_theirs = dst;\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 336732ed785..4245bc5975c 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -588,7 +588,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \tif (submodule)\n \t\tgoto out;\n \n-\tconfig = read_object_file(&oid, &type, &config_size);\n+\tconfig = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t       &config_size);\n \tif (!config || type != OBJ_BLOB)\n \t\tgoto out;\n \ndiff --git a/tag.c b/tag.c\nindex dfc900e62e0..d62084842f2 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -54,7 +54,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),\n \t\t\t\ttype_name(type));\n \n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn error(\"%s: unable to read file.\",\n \t\t\t\tname_to_report ?\n@@ -216,7 +216,8 @@ int parse_tag(struct tag *item)\n \n \tif (item->object.parsed)\n \t\treturn 0;\n-\tdata = read_object_file(&item->object.oid, &type, &size);\n+\tdata = repo_read_object_file(the_repository, &item->object.oid, &type,\n+\t\t\t\t     &size);\n \tif (!data)\n \t\treturn error(\"Could not read %s\",\n \t\t\t     oid_to_hex(&item->object.oid));\ndiff --git a/tree.c b/tree.c\nindex f0742f4167b..1b403c4b5ce 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -129,7 +129,8 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)\n \n \tif (item->object.parsed)\n \t\treturn 0;\n-\tbuffer = read_object_file(&item->object.oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, &item->object.oid,\n+\t\t\t\t       &type, &size);\n \tif (!buffer)\n \t\treturn quiet_on_missing ? -1 :\n \t\t\terror(\"Could not read %s\",\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 551f22ffa5d..4ef27ed47fb 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -499,8 +499,8 @@ static int got_oid(struct upload_pack_data *data,\n {\n \tif (get_oid_hex(hex, oid))\n \t\tdie(\"git upload-pack: expected SHA1 object, got '%s'\", hex);\n-\tif (!has_object_file_with_flags(oid,\n-\t\t\t\t\tOBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\tif (!repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t     OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\treturn -1;\n \treturn do_got_oid(data, oid);\n }\n@@ -1600,8 +1600,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common\n \tfor (i = 0; i < data->haves.nr; i++) {\n \t\tconst struct object_id *oid = &data->haves.oid[i];\n \n-\t\tif (!has_object_file_with_flags(oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t\t     OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\tcontinue;\n \n \t\toid_array_append(common, oid);\ndiff --git a/walker.c b/walker.c\nindex 98d65a559b4..8418066e509 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -145,7 +145,7 @@ static int process(struct walker *walker, struct object *obj)\n \t\treturn 0;\n \tobj->flags |= SEEN;\n \n-\tif (has_object_file(&obj->oid)) {\n+\tif (repo_has_object_file(the_repository, &obj->oid)) {\n \t\t/* We already have it, so we should scan it now. */\n \t\tobj->flags |= TO_SCAN;\n \t}\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex e87950de32e..c6f244116ce 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -183,7 +183,7 @@ void read_mmblob(mmfile_t *ptr, const struct object_id *oid)\n \t\treturn;\n \t}\n \n-\tptr->ptr = read_object_file(oid, &type, &size);\n+\tptr->ptr = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!ptr->ptr || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(oid));\n \tptr->size = size;\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473647","messageId":"patch-13.17-aae743233ab-20230317T152724Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 13/17] cocci: apply the \"refs.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:17Z","receivedAt":"2023-03-17T15:36:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"refs.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n archive.c                                       | 5 +++--\n branch.c                                        | 3 ++-\n builtin/checkout.c                              | 6 ++++--\n builtin/fast-export.c                           | 3 ++-\n builtin/log.c                                   | 3 ++-\n builtin/merge.c                                 | 3 ++-\n builtin/reset.c                                 | 3 ++-\n builtin/rev-parse.c                             | 4 +++-\n builtin/show-branch.c                           | 3 ++-\n builtin/stash.c                                 | 3 ++-\n bundle.c                                        | 3 ++-\n commit.c                                        | 3 ++-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n refs.h                                          | 6 ------\n remote.c                                        | 5 +++--\n wt-status.c                                     | 3 ++-\n 17 files changed, 37 insertions(+), 27 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex d43687a5c44..716a18567bc 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -456,10 +456,11 @@ static void parse_treeish_arg(const char **argv,\n \t\tconst char *colon = strchrnul(name, ':');\n \t\tint refnamelen = colon - name;\n \n-\t\tif (!dwim_ref(name, refnamelen, &oid, &ref, 0))\n+\t\tif (!repo_dwim_ref(the_repository, name, refnamelen, &oid, &ref, 0))\n \t\t\tdie(_(\"no such ref: %.*s\"), refnamelen, name);\n \t} else {\n-\t\tdwim_ref(name, strlen(name), &oid, &ref, 0);\n+\t\trepo_dwim_ref(the_repository, name, strlen(name), &oid, &ref,\n+\t\t\t      0);\n \t}\n \n \tif (repo_get_oid(the_repository, name, &oid))\ndiff --git a/branch.c b/branch.c\nindex 2efb5fbaa5f..a01e465b114 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -541,7 +541,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\tdie(_(\"not a valid object name: '%s'\"), start_name);\n \t}\n \n-\tswitch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {\n+\tswitch (repo_dwim_ref(the_repository, start_name, strlen(start_name),\n+\t\t\t      &oid, &real_ref, 0)) {\n \tcase 0:\n \t\t/* Not branching from any existing branch */\n \t\tif (explicit_tracking)\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 1d1f33e33e7..cb7cd315b34 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -703,7 +703,8 @@ static void setup_branch_path(struct branch_info *branch)\n \t * If this is a ref, resolve it; otherwise, look up the OID for our\n \t * expression.  Failure here is okay.\n \t */\n-\tif (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0))\n+\tif (!repo_dwim_ref(the_repository, branch->name, strlen(branch->name),\n+\t\t\t   &branch->oid, &branch->refname, 0))\n \t\trepo_get_oid_committish(the_repository, branch->name, &branch->oid);\n \n \tstrbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);\n@@ -1424,7 +1425,8 @@ static void die_expecting_a_branch(const struct branch_info *branch_info)\n \tchar *to_free;\n \tint code;\n \n-\tif (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) {\n+\tif (repo_dwim_ref(the_repository, branch_info->name,\n+\t\t\t  strlen(branch_info->name), &oid, &to_free, 0) == 1) {\n \t\tconst char *ref = to_free;\n \n \t\tif (skip_prefix(ref, \"refs/tags/\", &ref))\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 6515bd2ad8b..550f078a8ed 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -918,7 +918,8 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\tif (e->flags & UNINTERESTING)\n \t\t\tcontinue;\n \n-\t\tif (dwim_ref(e->name, strlen(e->name), &oid, &full_name, 0) != 1)\n+\t\tif (repo_dwim_ref(the_repository, e->name, strlen(e->name),\n+\t\t\t\t  &oid, &full_name, 0) != 1)\n \t\t\tcontinue;\n \n \t\tif (refspecs.nr) {\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 3dde77bde27..acf3faecd81 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1204,7 +1204,8 @@ static char *find_branch_name(struct rev_info *rev)\n \t\treturn NULL;\n \tref = rev->cmdline.rev[positive].name;\n \ttip_oid = &rev->cmdline.rev[positive].item->oid;\n-\tif (dwim_ref(ref, strlen(ref), &branch_oid, &full_ref, 0) &&\n+\tif (repo_dwim_ref(the_repository, ref, strlen(ref), &branch_oid,\n+\t\t\t  &full_ref, 0) &&\n \t    skip_prefix(full_ref, \"refs/heads/\", &v) &&\n \t    oideq(tip_oid, &branch_oid))\n \t\tbranch = xstrdup(v);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 197e152aba9..69666546ca2 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -517,7 +517,8 @@ static void merge_name(const char *remote, struct strbuf *msg)\n \tif (!remote_head)\n \t\tdie(_(\"'%s' does not point to a commit\"), remote);\n \n-\tif (dwim_ref(remote, strlen(remote), &branch_head, &found_ref, 0) > 0) {\n+\tif (repo_dwim_ref(the_repository, remote, strlen(remote), &branch_head,\n+\t\t\t  &found_ref, 0) > 0) {\n \t\tif (starts_with(found_ref, \"refs/heads/\")) {\n \t\t\tstrbuf_addf(msg, \"%s\\t\\tbranch '%s' of .\\n\",\n \t\t\t\t    oid_to_hex(&branch_head), remote);\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 75b447ffdc6..b65f379440b 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -465,7 +465,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\tchar *ref = NULL;\n \t\t\tint err;\n \n-\t\t\tdwim_ref(rev, strlen(rev), &dummy, &ref, 0);\n+\t\t\trepo_dwim_ref(the_repository, rev, strlen(rev),\n+\t\t\t\t      &dummy, &ref, 0);\n \t\t\tif (ref && !starts_with(ref, \"refs/\"))\n \t\t\t\tFREE_AND_NULL(ref);\n \ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 5685cf0ea7d..663f282c5f7 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -136,7 +136,9 @@ static void show_rev(int type, const struct object_id *oid, const char *name)\n \t\t\tstruct object_id discard;\n \t\t\tchar *full;\n \n-\t\t\tswitch (dwim_ref(name, strlen(name), &discard, &full, 0)) {\n+\t\t\tswitch (repo_dwim_ref(the_repository, name,\n+\t\t\t\t\t      strlen(name), &discard, &full,\n+\t\t\t\t\t      0)) {\n \t\t\tcase 0:\n \t\t\t\t/*\n \t\t\t\t * Not found -- not a ref.  We could\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex d60e536a53b..af680485d58 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -746,7 +746,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tdie(Q_(\"only %d entry can be shown at one time.\",\n \t\t\t       \"only %d entries can be shown at one time.\",\n \t\t\t       MAX_REVS), MAX_REVS);\n-\t\tif (!dwim_ref(*av, strlen(*av), &oid, &ref, 0))\n+\t\tif (!repo_dwim_ref(the_repository, *av, strlen(*av), &oid,\n+\t\t\t\t   &ref, 0))\n \t\t\tdie(_(\"no such ref %s\"), *av);\n \n \t\t/* Has the base been specified? */\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 6c062e52048..364273f1012 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -211,7 +211,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n \tend_of_rev = strchrnul(revision, '@');\n \tstrbuf_add(&symbolic, revision, end_of_rev - revision);\n \n-\tret = dwim_ref(symbolic.buf, symbolic.len, &dummy, &expanded_ref, 0);\n+\tret = repo_dwim_ref(the_repository, symbolic.buf, symbolic.len,\n+\t\t\t    &dummy, &expanded_ref, 0);\n \tstrbuf_release(&symbolic);\n \tswitch (ret) {\n \tcase 0: /* Not found, but valid ref */\ndiff --git a/bundle.c b/bundle.c\nindex 9b57bade7a6..dca96e51ee0 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -382,7 +382,8 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n \n \t\tif (e->item->flags & UNINTERESTING)\n \t\t\tcontinue;\n-\t\tif (dwim_ref(e->name, strlen(e->name), &oid, &ref, 0) != 1)\n+\t\tif (repo_dwim_ref(the_repository, e->name, strlen(e->name),\n+\t\t\t\t  &oid, &ref, 0) != 1)\n \t\t\tgoto skip_write_ref;\n \t\tif (read_ref_full(e->name, RESOLVE_REF_READING, &oid, &flag))\n \t\t\tflag = 0;\ndiff --git a/commit.c b/commit.c\nindex dd22e76c3e1..0e2fc7dbab8 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -996,7 +996,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)\n \tstruct commit *ret = NULL;\n \tchar *full_refname;\n \n-\tswitch (dwim_ref(refname, strlen(refname), &oid, &full_refname, 0)) {\n+\tswitch (repo_dwim_ref(the_repository, refname, strlen(refname), &oid,\n+\t\t\t      &full_refname, 0)) {\n \tcase 0:\n \t\tdie(\"No such ref: '%s'\", refname);\n \tcase 1:\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex d5b644a8687..b20a3e70845 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -105,6 +105,10 @@\n |\n - has_promisor_remote\n + repo_has_promisor_remote\n+// refs.h\n+|\n+- dwim_ref\n++ repo_dwim_ref\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex e17a60198c5..8bf30798a04 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// refs.h\n-- dwim_ref\n-+ repo_dwim_ref\n // rerere.h\n-|\n - rerere\n + repo_rerere\n // revision.h\ndiff --git a/refs.h b/refs.h\nindex 935cdd1ece3..2998244b615 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -159,12 +159,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id\n int repo_dwim_ref(struct repository *r, const char *str, int len,\n \t\t  struct object_id *oid, char **ref, int nonfatal_dangling_mark);\n int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);\n-static inline int dwim_ref(const char *str, int len, struct object_id *oid,\n-\t\t\t   char **ref, int nonfatal_dangling_mark)\n-{\n-\treturn repo_dwim_ref(the_repository, str, len, oid, ref,\n-\t\t\t     nonfatal_dangling_mark);\n-}\n int dwim_log(const char *str, int len, struct object_id *oid, char **ref);\n \n /*\ndiff --git a/remote.c b/remote.c\nindex 12f6bea6252..a03b03e467e 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1808,8 +1808,9 @@ static void set_merge(struct remote_state *remote_state, struct branch *ret)\n \t\tif (!remote_find_tracking(remote, ret->merge[i]) ||\n \t\t    strcmp(ret->remote_name, \".\"))\n \t\t\tcontinue;\n-\t\tif (dwim_ref(ret->merge_name[i], strlen(ret->merge_name[i]),\n-\t\t\t     &oid, &ref, 0) == 1)\n+\t\tif (repo_dwim_ref(the_repository, ret->merge_name[i],\n+\t\t\t\t  strlen(ret->merge_name[i]), &oid, &ref,\n+\t\t\t\t  0) == 1)\n \t\t\tret->merge[i]->dst = ref;\n \t\telse\n \t\t\tret->merge[i]->dst = xstrdup(ret->merge_name[i]);\ndiff --git a/wt-status.c b/wt-status.c\nindex c55c51b1924..dcd1d0cee4c 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1664,7 +1664,8 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\treturn;\n \t}\n \n-\tif (dwim_ref(cb.buf.buf, cb.buf.len, &oid, &ref, 1) == 1 &&\n+\tif (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,\n+\t\t\t  1) == 1 &&\n \t    /* oid is a commit? match without further lookup */\n \t    (oideq(&cb.noid, &oid) ||\n \t     /* perhaps oid is a tag, try to dereference to a commit */\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473648","messageId":"patch-15.17-c8ff241844a-20230317T152725Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 15/17] cocci: apply the \"revision.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:19Z","receivedAt":"2023-03-17T15:36:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"revision.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-interactive.c                               |  2 +-\n builtin/bisect.c                                |  4 ++--\n builtin/stash.c                                 |  6 +++---\n builtin/submodule--helper.c                     |  2 +-\n contrib/coccinelle/the_repository.cocci         |  4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 14 --------------\n range-diff.c                                    |  2 +-\n revision.h                                      |  3 ---\n 8 files changed, 12 insertions(+), 25 deletions(-)\n delete mode 100644 contrib/coccinelle/the_repository.pending.cocci\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 00a0f6f96f3..33f41d65a47 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -551,7 +551,7 @@ static int get_modified_files(struct repository *r,\n \t\topt.def = is_initial ?\n \t\t\tempty_tree_oid_hex() : oid_to_hex(&head_oid);\n \n-\t\tinit_revisions(&rev, NULL);\n+\t\trepo_init_revisions(the_repository, &rev, NULL);\n \t\tsetup_revisions(0, NULL, &rev, &opt);\n \n \t\trev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 34ba7b18f69..0f35361bd16 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -568,7 +568,7 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)\n \t * sets up a revision walk.\n \t */\n \treset_revision_walk();\n-\tinit_revisions(revs, NULL);\n+\trepo_init_revisions(the_repository, revs, NULL);\n \tsetup_revisions(0, NULL, revs, NULL);\n \tfor_each_glob_ref_in(add_bisect_ref, bad, \"refs/bisect/\", &cb);\n \tcb.object_flags = UNINTERESTING;\n@@ -1095,7 +1095,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, int argc,\n \t\t\tstruct rev_info revs;\n \t\t\tstruct commit *commit;\n \n-\t\t\tinit_revisions(&revs, NULL);\n+\t\t\trepo_init_revisions(the_repository, &revs, NULL);\n \t\t\tsetup_revisions(2, argv + i - 1, &revs, NULL);\n \n \t\t\tif (prepare_revision_walk(&revs))\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 2017c278df2..888ffa07288 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -901,7 +901,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)\n \n \tinit_diff_ui_defaults();\n \tgit_config(git_diff_ui_config, NULL);\n-\tinit_revisions(&rev, prefix);\n+\trepo_init_revisions(the_repository, &rev, prefix);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_show_usage,\n \t\t\t     PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |\n@@ -1090,7 +1090,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)\n \tif (repo_read_index(the_repository) < 0)\n \t\treturn -1;\n \n-\tinit_revisions(&rev, NULL);\n+\trepo_init_revisions(the_repository, &rev, NULL);\n \tcopy_pathspec(&rev.prune_data, ps);\n \n \trev.diffopt.flags.quick = 1;\n@@ -1277,7 +1277,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps\n \tstruct strbuf diff_output = STRBUF_INIT;\n \tstruct index_state istate = INDEX_STATE_INIT(the_repository);\n \n-\tinit_revisions(&rev, NULL);\n+\trepo_init_revisions(the_repository, &rev, NULL);\n \tcopy_pathspec(&rev.prune_data, ps);\n \n \tset_alternate_index_output(stash_index_path.buf);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 25c70f415f1..32b8e498172 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,\n \t\tstrvec_pushv(&diff_args, info->argv);\n \n \tgit_config(git_diff_basic_config, NULL);\n-\tinit_revisions(&rev, info->prefix);\n+\trepo_init_revisions(the_repository, &rev, info->prefix);\n \trev.abbrev = 0;\n \tprecompose_argv_prefix(diff_args.nr, diff_args.v, NULL);\n \tsetup_revisions(diff_args.nr, diff_args.v, &rev, &opt);\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 1d1ac7d4fc5..765ad689678 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -113,6 +113,10 @@\n |\n - rerere\n + repo_rerere\n+// revision.h\n+|\n+- init_revisions\n++ repo_init_revisions\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\ndeleted file mode 100644\nindex 1190a3312bd..00000000000\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ /dev/null\n@@ -1,14 +0,0 @@\n-// This file is used for the ongoing refactoring of\n-// bringing the index or repository struct in all of\n-// our code base.\n-\n-@@\n-@@\n-(\n-// revision.h\n-- init_revisions\n-+ repo_init_revisions\n-)\n-  (\n-+ the_repository,\n-  ...)\ndiff --git a/range-diff.c b/range-diff.c\nindex 15d0bc35a87..ff5d19f8add 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -588,7 +588,7 @@ int is_range_diff_range(const char *arg)\n \tint i, positive = 0, negative = 0;\n \tstruct rev_info revs;\n \n-\tinit_revisions(&revs, NULL);\n+\trepo_init_revisions(the_repository, &revs, NULL);\n \tif (setup_revisions(3, argv, &revs, NULL) == 1) {\n \t\tfor (i = 0; i < revs.pending.nr; i++)\n \t\t\tif (revs.pending.objects[i].item->flags & UNINTERESTING)\ndiff --git a/revision.h b/revision.h\nindex 30febad09a1..eeb91677d07 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -415,9 +415,6 @@ struct rev_info {\n void repo_init_revisions(struct repository *r,\n \t\t\t struct rev_info *revs,\n \t\t\t const char *prefix);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)\n-#endif\n \n /**\n  * Parse revision information, filling in the `rev_info` structure, and\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473649","messageId":"patch-16.17-86e24add191-20230317T152725Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 16/17] post-cocci: adjust comments for recent repo_* migration","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:20Z","receivedAt":"2023-03-17T15:36:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits we changed many calls to macros that were\nproviding a \"the_repository\" argument to invoke corresponding repo_*()\nfunction instead. Let's follow-up and adjust references to those in\ncomments, which coccinelle didn't (and inherently can't) catch.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/branch.c   | 2 +-\n builtin/shortlog.c | 2 +-\n cache.h            | 4 ++--\n commit.h           | 4 ++--\n diff.h             | 2 +-\n object-file.c      | 2 +-\n object-store.h     | 4 ++--\n pretty.c           | 2 +-\n refs.c             | 2 +-\n sequencer.c        | 6 +++---\n strbuf.h           | 6 +++---\n 11 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex bbcfb34b3c6..45910039e6b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -156,7 +156,7 @@ static int branch_merged(int kind, const char *name,\n \t/*\n \t * After the safety valve is fully redefined to \"check with\n \t * upstream, if any, otherwise with HEAD\", we should just\n-\t * return the result of the in_merge_bases() above without\n+\t * return the result of the repo_in_merge_bases() above without\n \t * any of the following code, but during the transition period,\n \t * a gentle reminder is in order.\n \t */\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 62f91b8b932..f287a6acd03 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -176,7 +176,7 @@ static void insert_records_from_trailers(struct shortlog *log,\n \t\treturn;\n \n \t/*\n-\t * Using format_commit_message(\"%B\") would be simpler here, but\n+\t * Using repo_format_commit_message(\"%B\") would be simpler here, but\n \t * this saves us copying the message.\n \t */\n \tcommit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,\ndiff --git a/cache.h b/cache.h\nindex d835ac8b4d2..555354e1961 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -443,7 +443,7 @@ void validate_cache_entries(const struct index_state *istate);\n /*\n  * Bulk prefetch all missing cache entries that are not GITLINKs and that match\n  * the given predicate. This function should only be called if\n- * has_promisor_remote() returns true.\n+ * repo_has_promisor_remote() returns true.\n  */\n typedef int (*must_prefetch_predicate)(const struct cache_entry *);\n void prefetch_cache_entries(const struct index_state *istate,\n@@ -1201,7 +1201,7 @@ void check_repository_format(struct repository_format *fmt);\n  * terminated.\n  *\n  * The non-`_r` version returns a static buffer which remains valid until 4\n- * more calls to find_unique_abbrev are made.\n+ * more calls to repo_find_unique_abbrev are made.\n  *\n  * The `_r` variant writes to a buffer supplied by the caller, which must be at\n  * least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes\ndiff --git a/commit.h b/commit.h\nindex e98ee6e698e..d4adf111019 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -130,7 +130,7 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,\n /*\n  * Get the commit's object contents, either from cache or by reading the object\n  * from disk. The resulting memory should not be modified, and must be given\n- * to unuse_commit_buffer when the caller is done.\n+ * to repo_unuse_commit_buffer when the caller is done.\n  */\n const void *repo_get_commit_buffer(struct repository *r,\n \t\t\t\t   const struct commit *,\n@@ -139,7 +139,7 @@ const void *repo_get_commit_buffer(struct repository *r,\n /*\n  * Tell the commit subsystem that we are done with a particular commit buffer.\n  * The commit and buffer should be the input and return value, respectively,\n- * from an earlier call to get_commit_buffer.  The buffer may or may not be\n+ * from an earlier call to repo_get_commit_buffer.  The buffer may or may not be\n  * freed by this call; callers should not access the memory afterwards.\n  */\n void repo_unuse_commit_buffer(struct repository *r,\ndiff --git a/diff.h b/diff.h\nindex 8b510eb579d..0aa36e81261 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -614,7 +614,7 @@ void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);\n #define DIFF_STATUS_FILTER_BROKEN\t'B'\n \n /*\n- * This is different from find_unique_abbrev() in that\n+ * This is different from repo_find_unique_abbrev() in that\n  * it stuffs the result with dots for alignment.\n  */\n const char *diff_aligned_abbrev(const struct object_id *sha1, int);\ndiff --git a/object-file.c b/object-file.c\nindex 141cf85f25b..47c52681640 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -267,7 +267,7 @@ int hash_algo_by_length(int len)\n \n /*\n  * This is meant to hold a *small* number of objects that you would\n- * want read_object_file() to be able to return, but yet you do not want\n+ * want repo_read_object_file() to be able to return, but yet you do not want\n  * to write them into the object store (e.g. a browse-only\n  * application).\n  */\ndiff --git a/object-store.h b/object-store.h\nindex b47849d4e7e..9217ae83064 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -216,7 +216,7 @@ struct raw_object_store {\n \t/*\n \t * A fast, rough count of the number of objects in the repository.\n \t * These two fields are not meant for direct access. Use\n-\t * approximate_object_count() instead.\n+\t * repo_approximate_object_count() instead.\n \t */\n \tunsigned long approximate_object_count;\n \tunsigned approximate_object_count_valid : 1;\n@@ -343,7 +343,7 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect);\n \n /*\n  * Enabling the object read lock allows multiple threads to safely call the\n- * following functions in parallel: repo_read_object_file(), read_object_file(),\n+ * following functions in parallel: repo_read_object_file(),\n  * read_object_with_reference(), oid_object_info() and oid_object_info_extended().\n  *\n  * obj_read_lock() and obj_read_unlock() may also be used to protect other\ndiff --git a/pretty.c b/pretty.c\nindex 076d1c363e7..23ac06b93f3 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -719,7 +719,7 @@ const char *repo_logmsg_reencode(struct repository *r,\n \t\t * Otherwise, we still want to munge the encoding header in the\n \t\t * result, which will be done by modifying the buffer. If we\n \t\t * are using a fresh copy, we can reuse it. But if we are using\n-\t\t * the cached copy from get_commit_buffer, we need to duplicate it\n+\t\t * the cached copy from repo_get_commit_buffer, we need to duplicate it\n \t\t * to avoid munging the cached copy.\n \t\t */\n \t\tif (msg == get_cached_commit_buffer(r, commit, NULL))\ndiff --git a/refs.c b/refs.c\nindex aeae31c972f..cd7537bce64 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -1821,7 +1821,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,\n \t\t\treturn NULL;\n \n \t\t/*\n-\t\t * dwim_ref() uses REF_ISBROKEN to distinguish between\n+\t\t * repo_dwim_ref() uses REF_ISBROKEN to distinguish between\n \t\t * missing refs and refs that were present but invalid,\n \t\t * to complain about the latter to stderr.\n \t\t *\ndiff --git a/sequencer.c b/sequencer.c\nindex aa3ebb47d98..fb5a540fa04 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -768,9 +768,9 @@ static int is_index_unchanged(struct repository *r)\n \t/*\n \t * If head_commit is NULL, check_commit, called from\n \t * lookup_commit, would have indicated that head_commit is not\n-\t * a commit object already.  parse_commit() will return failure\n+\t * a commit object already.  repo_parse_commit() will return failure\n \t * without further complaints in such a case.  Otherwise, if\n-\t * the commit is invalid, parse_commit() will complain.  So\n+\t * the commit is invalid, repo_parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n \tif (repo_parse_commit(the_repository, head_commit))\n@@ -5365,7 +5365,7 @@ static const char *label_oid(struct object_id *oid, const char *label,\n \t * For \"uninteresting\" commits, i.e. commits that are not to be\n \t * rebased, and which can therefore not be labeled, we use a unique\n \t * abbreviation of the commit name. This is slightly more complicated\n-\t * than calling find_unique_abbrev() because we also need to make\n+\t * than calling repo_find_unique_abbrev() because we also need to make\n \t * sure that the abbreviation does not conflict with any other\n \t * label.\n \t *\ndiff --git a/strbuf.h b/strbuf.h\nindex f6dbb9681ee..b980f9edc6d 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -631,7 +631,7 @@ void strbuf_add_separated_string_list(struct strbuf *str,\n void strbuf_list_free(struct strbuf **list);\n \n /**\n- * Add the abbreviation, as generated by find_unique_abbrev, of `sha1` to\n+ * Add the abbreviation, as generated by repo_find_unique_abbrev(), of `sha1` to\n  * the strbuf `sb`.\n  */\n struct repository;\n@@ -706,14 +706,14 @@ static inline void strbuf_complete_line(struct strbuf *sb)\n \n /*\n  * Copy \"name\" to \"sb\", expanding any special @-marks as handled by\n- * interpret_branch_name(). The result is a non-qualified branch name\n+ * repo_interpret_branch_name(). The result is a non-qualified branch name\n  * (so \"foo\" or \"origin/master\" instead of \"refs/heads/foo\" or\n  * \"refs/remotes/origin/master\").\n  *\n  * Note that the resulting name may not be a syntactically valid refname.\n  *\n  * If \"allowed\" is non-zero, restrict the set of allowed expansions. See\n- * interpret_branch_name() for details.\n+ * repo_interpret_branch_name() for details.\n  */\n void strbuf_branchname(struct strbuf *sb, const char *name,\n \t\t       unsigned allowed);\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473650","messageId":"patch-17.17-6f86a34bf8b-20230317T152725Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH 17/17] libs: use \"struct repository *\" argument, not \"the_repository\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-17T15:35:21Z","receivedAt":"2023-03-17T15:37:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As can easily be seen from grepping in our sources, we had these uses\nof \"the_repository\" in various library code in cases where the\nfunction in question was already getting a \"struct repository *\"\nargument. Let's use that argument instead.\n\nOut of these changes only the changes to \"cache-tree.c\",\n\"commit-reach.c\", \"shallow.c\" and \"upload-pack.c\" would have cleanly\napplied before the migration away from the \"repo_*()\" wrapper macros\nin the preceding commits.\n\nThe rest aren't new, as we'd previously implicitly refer to\n\"the_repository\", but it's now more obvious that we were doing the\nwrong thing all along, and should have used the parameter instead.\n\nThe change to change \"get_index_format_default(the_repository)\" in\n\"read-cache.c\" to use the \"r\" variable instead should arguably have\nbeen part of [1], or in the subsequent cleanup in [2]. Let's do it\nhere, as can be seen from the initial code in [3] it's not important\nthat we use \"the_repository\" there, but would prefer to always use the\ncurrent repository.\n\nThis change excludes the \"the_repository\" use in \"upload-pack.c\"'s\nupload_pack_advertise(), as the in-flight [4] makes that change.\n\n1. ee1f0c242ef (read-cache: add index.skipHash config option,\n   2023-01-06)\n2. 6269f8eaad0 (treewide: always have a valid \"index_state.repo\"\n   member, 2023-01-17)\n3. 7211b9e7534 (repo-settings: consolidate some config settings,\n   2019-08-13)\n4. <Y/hbUsGPVNAxTdmS@coredump.intra.peff.net>\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-interactive.c |   2 +-\n branch.c          |   8 ++--\n builtin/replace.c |   2 +-\n cache-tree.c      |   4 +-\n combine-diff.c    |   2 +-\n commit-graph.c    |   2 +-\n commit-reach.c    |   2 +-\n merge-recursive.c |   2 +-\n notes-cache.c     |   2 +-\n notes-utils.c     |   2 +-\n object-name.c     |   8 ++--\n read-cache.c      |   4 +-\n reset.c           |   2 +-\n sequencer.c       | 102 ++++++++++++++++++++++------------------------\n shallow.c         |   2 +-\n tree.c            |   2 +-\n wt-status.c       |  10 ++---\n 17 files changed, 76 insertions(+), 82 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 33f41d65a47..02bf6fc15cb 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -551,7 +551,7 @@ static int get_modified_files(struct repository *r,\n \t\topt.def = is_initial ?\n \t\t\tempty_tree_oid_hex() : oid_to_hex(&head_oid);\n \n-\t\trepo_init_revisions(the_repository, &rev, NULL);\n+\t\trepo_init_revisions(r, &rev, NULL);\n \t\tsetup_revisions(0, NULL, &rev, &opt);\n \n \t\trev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\ndiff --git a/branch.c b/branch.c\nindex a01e465b114..2b266e6fcb9 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -531,7 +531,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\texplicit_tracking = 1;\n \n \treal_ref = NULL;\n-\tif (repo_get_oid_mb(the_repository, start_name, &oid)) {\n+\tif (repo_get_oid_mb(r, start_name, &oid)) {\n \t\tif (explicit_tracking) {\n \t\t\tint code = die_message(_(upstream_missing), start_name);\n \t\t\tadvise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,\n@@ -541,8 +541,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\tdie(_(\"not a valid object name: '%s'\"), start_name);\n \t}\n \n-\tswitch (repo_dwim_ref(the_repository, start_name, strlen(start_name),\n-\t\t\t      &oid, &real_ref, 0)) {\n+\tswitch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,\n+\t\t\t      &real_ref, 0)) {\n \tcase 0:\n \t\t/* Not branching from any existing branch */\n \t\tif (explicit_tracking)\n@@ -773,7 +773,7 @@ void create_branches_recursively(struct repository *r, const char *name,\n \t\t\t    name);\n \t}\n \n-\tcreate_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,\n+\tcreate_branch(r, name, start_commitish, force, 0, reflog, quiet,\n \t\t      BRANCH_TRACK_NEVER, dry_run);\n \tif (dry_run)\n \t\treturn;\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 85f0b79c924..bd67107a7c7 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -54,7 +54,7 @@ static int show_reference(struct repository *r, const char *refname,\n \t\t\tstruct object_id object;\n \t\t\tenum object_type obj_type, repl_type;\n \n-\t\t\tif (repo_get_oid(the_repository, refname, &object))\n+\t\t\tif (repo_get_oid(r, refname, &object))\n \t\t\t\treturn error(_(\"failed to resolve '%s' as a valid ref\"), refname);\n \n \t\t\tobj_type = oid_object_info(r, &object, NULL);\ndiff --git a/cache-tree.c b/cache-tree.c\nindex ab2cc1edf29..b0e490b5aa4 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -814,14 +814,14 @@ void prime_cache_tree(struct repository *r,\n {\n \tstruct strbuf tree_path = STRBUF_INIT;\n \n-\ttrace2_region_enter(\"cache-tree\", \"prime_cache_tree\", the_repository);\n+\ttrace2_region_enter(\"cache-tree\", \"prime_cache_tree\", r);\n \tcache_tree_free(&istate->cache_tree);\n \tistate->cache_tree = cache_tree();\n \n \tprime_cache_tree_rec(r, istate->cache_tree, tree, &tree_path);\n \tstrbuf_release(&tree_path);\n \tistate->cache_changed |= CACHE_TREE_CHANGED;\n-\ttrace2_region_leave(\"cache-tree\", \"prime_cache_tree\", the_repository);\n+\ttrace2_region_leave(\"cache-tree\", \"prime_cache_tree\", r);\n }\n \n /*\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 20f8a03924f..fa5967a5be6 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r,\n \t\t*size = fill_textconv(r, textconv, df, &blob);\n \t\tfree_filespec(df);\n \t} else {\n-\t\tblob = repo_read_object_file(the_repository, oid, &type, size);\n+\t\tblob = repo_read_object_file(r, oid, &type, size);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"object '%s' is not a blob!\", oid_to_hex(oid));\n \t}\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 268410e913c..035816f4d8c 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2549,7 +2549,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)\n \n \t\tgraph_commit = lookup_commit(r, &cur_oid);\n \t\todb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));\n-\t\tif (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) {\n+\t\tif (repo_parse_commit_internal(r, odb_commit, 0, 0)) {\n \t\t\tgraph_report(_(\"failed to parse commit %s from object database for commit-graph\"),\n \t\t\t\t     oid_to_hex(&cur_oid));\n \t\t\tcontinue;\ndiff --git a/commit-reach.c b/commit-reach.c\nindex c88faf7e7b2..01eb11b5957 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -448,7 +448,7 @@ int repo_is_descendant_of(struct repository *r,\n \tif (!with_commit)\n \t\treturn 1;\n \n-\tif (generation_numbers_enabled(the_repository)) {\n+\tif (generation_numbers_enabled(r)) {\n \t\tstruct commit_list *from_list = NULL;\n \t\tint result;\n \t\tcommit_list_insert(commit, &from_list);\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex d83ce19bb1f..20aa18e2203 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3798,7 +3798,7 @@ static struct commit *get_ref(struct repository *repo,\n \t\treturn make_virtual_commit(repo, (struct tree*)object, name);\n \tif (object->type != OBJ_COMMIT)\n \t\treturn NULL;\n-\tif (repo_parse_commit(the_repository, (struct commit *)object))\n+\tif (repo_parse_commit(repo, (struct commit *)object))\n \t\treturn NULL;\n \treturn (struct commit *)object;\n }\ndiff --git a/notes-cache.c b/notes-cache.c\nindex e5e9092d367..1a6e214ea79 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -23,7 +23,7 @@ static int notes_cache_match_validity(struct repository *r,\n \t\treturn 0;\n \n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\trepo_format_commit_message(the_repository, commit, \"%s\", &msg,\n+\trepo_format_commit_message(r, commit, \"%s\", &msg,\n \t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \ndiff --git a/notes-utils.c b/notes-utils.c\nindex 0550cfded86..4be0aaa6de9 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r,\n \t\tstruct object_id parent_oid;\n \t\tif (!read_ref(t->ref, &parent_oid)) {\n \t\t\tstruct commit *parent = lookup_commit(r, &parent_oid);\n-\t\t\tif (repo_parse_commit(the_repository, parent))\n+\t\t\tif (repo_parse_commit(r, parent))\n \t\t\t\tdie(\"Failed to find/parse commit %s\", t->ref);\n \t\t\tcommit_list_insert(parent, &parents);\n \t\t}\ndiff --git a/object-name.c b/object-name.c\nindex df31f192ce3..c7bc311dcef 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1038,7 +1038,7 @@ static enum get_oid_result get_parent(struct repository *r,\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(r, &oid);\n-\tif (repo_parse_commit(the_repository, commit))\n+\tif (repo_parse_commit(r, commit))\n \t\treturn MISSING_OBJECT;\n \tif (!idx) {\n \t\toidcpy(result, &commit->object.oid);\n@@ -1072,7 +1072,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,\n \t\treturn MISSING_OBJECT;\n \n \twhile (generation--) {\n-\t\tif (repo_parse_commit(the_repository, commit) || !commit->parents)\n+\t\tif (repo_parse_commit(r, commit) || !commit->parents)\n \t\t\treturn MISSING_OBJECT;\n \t\tcommit = commit->parents->item;\n \t}\n@@ -1363,10 +1363,10 @@ static int get_oid_oneline(struct repository *r,\n \t\tcommit = pop_most_recent_commit(&list, ONELINE_SEEN);\n \t\tif (!parse_object(r, &commit->object.oid))\n \t\t\tcontinue;\n-\t\tbuf = repo_get_commit_buffer(the_repository, commit, NULL);\n+\t\tbuf = repo_get_commit_buffer(r, commit, NULL);\n \t\tp = strstr(buf, \"\\n\\n\");\n \t\tmatches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));\n-\t\trepo_unuse_commit_buffer(the_repository, commit, buf);\n+\t\trepo_unuse_commit_buffer(r, commit, buf);\n \n \t\tif (matches) {\n \t\t\toidcpy(oid, &commit->object.oid);\ndiff --git a/read-cache.c b/read-cache.c\nindex 1548e886684..892fede6b41 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2628,7 +2628,7 @@ int repo_index_has_changes(struct repository *repo,\n \n \tif (tree)\n \t\tcmp = tree->object.oid;\n-\tif (tree || !repo_get_oid_tree(the_repository, \"HEAD\", &cmp)) {\n+\tif (tree || !repo_get_oid_tree(repo, \"HEAD\", &cmp)) {\n \t\tstruct diff_options opt;\n \n \t\trepo_diff_setup(repo, &opt);\n@@ -2947,7 +2947,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,\n \t}\n \n \tif (!istate->version)\n-\t\tistate->version = get_index_format_default(the_repository);\n+\t\tistate->version = get_index_format_default(r);\n \n \t/* demote version 3 to version 2 when the latter suffices */\n \tif (istate->version == 3 || istate->version == 2)\ndiff --git a/reset.c b/reset.c\nindex 3a9c6dfdd0a..65f8138c78b 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -106,7 +106,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)\n \t\tgoto leave_reset_head;\n \t}\n \n-\tif (!repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(r, \"HEAD\", &head_oid)) {\n \t\thead = &head_oid;\n \t} else if (!oid || !reset_hard) {\n \t\tret = error(_(\"could not determine HEAD revision\"));\ndiff --git a/sequencer.c b/sequencer.c\nindex fb5a540fa04..f8f4e72112c 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -694,8 +694,8 @@ static int do_recursive_merge(struct repository *r,\n \to.show_rename_progress = 1;\n \n \thead_tree = parse_tree_indirect(head);\n-\tnext_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);\n-\tbase_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);\n+\tnext_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);\n+\tbase_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);\n \n \tfor (i = 0; i < opts->xopts_nr; i++)\n \t\tparse_merge_opt(&o, opts->xopts[i]);\n@@ -773,7 +773,7 @@ static int is_index_unchanged(struct repository *r)\n \t * the commit is invalid, repo_parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n-\tif (repo_parse_commit(the_repository, head_commit))\n+\tif (repo_parse_commit(r, head_commit))\n \t\treturn -1;\n \n \tif (!(cache_tree_oid = get_cache_tree_oid(istate)))\n@@ -1338,15 +1338,15 @@ void print_commit_summary(struct repository *r,\n \tcommit = lookup_commit(r, oid);\n \tif (!commit)\n \t\tdie(_(\"couldn't look up newly created commit\"));\n-\tif (repo_parse_commit(the_repository, commit))\n+\tif (repo_parse_commit(r, commit))\n \t\tdie(_(\"could not parse newly created commit\"));\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n \n-\trepo_format_commit_message(the_repository, commit, \"%an <%ae>\",\n-\t\t\t\t   &author_ident, &pctx);\n-\trepo_format_commit_message(the_repository, commit, \"%cn <%ce>\",\n-\t\t\t\t   &committer_ident, &pctx);\n+\trepo_format_commit_message(r, commit, \"%an <%ae>\", &author_ident,\n+\t\t\t\t   &pctx);\n+\trepo_format_commit_message(r, commit, \"%cn <%ce>\", &committer_ident,\n+\t\t\t\t   &pctx);\n \tif (strbuf_cmp(&author_ident, &committer_ident)) {\n \t\tstrbuf_addstr(&format, \"\\n Author: \");\n \t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n@@ -1354,8 +1354,7 @@ void print_commit_summary(struct repository *r,\n \tif (flags & SUMMARY_SHOW_AUTHOR_DATE) {\n \t\tstruct strbuf date = STRBUF_INIT;\n \n-\t\trepo_format_commit_message(the_repository, commit, \"%ad\",\n-\t\t\t\t\t   &date, &pctx);\n+\t\trepo_format_commit_message(r, commit, \"%ad\", &date, &pctx);\n \t\tstrbuf_addstr(&format, \"\\n Date: \");\n \t\tstrbuf_addbuf_percentquote(&format, &date);\n \t\tstrbuf_release(&date);\n@@ -1385,7 +1384,7 @@ void print_commit_summary(struct repository *r,\n \trev.diffopt.detect_rename = DIFF_DETECT_RENAME;\n \tdiff_setup_done(&rev.diffopt);\n \n-\trefs = get_main_ref_store(the_repository);\n+\trefs = get_main_ref_store(r);\n \thead = refs_resolve_ref_unsafe(refs, \"HEAD\", 0, NULL, NULL);\n \tif (!head)\n \t\tdie(_(\"unable to resolve HEAD after creating commit\"));\n@@ -1411,7 +1410,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \tstruct commit *current_head;\n \tstruct object_id oid;\n \n-\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n+\tif (repo_get_oid(r, \"HEAD\", &oid)) {\n \t\tcurrent_head = NULL;\n \t} else {\n \t\tcurrent_head = lookup_commit_reference(r, &oid);\n@@ -1421,7 +1420,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \t\t\twarning(_(\"HEAD %s is not a commit!\"),\n \t\t\t\toid_to_hex(&oid));\n \t\t}\n-\t\tif (repo_parse_commit(the_repository, current_head))\n+\t\tif (repo_parse_commit(r, current_head))\n \t\t\treturn error(_(\"could not parse HEAD commit\"));\n \t}\n \t*head = current_head;\n@@ -1464,9 +1463,8 @@ static int try_to_commit(struct repository *r,\n \tif (flags & AMEND_MSG) {\n \t\tconst char *exclude_gpgsig[] = { \"gpgsig\", \"gpgsig-sha256\", NULL };\n \t\tconst char *out_enc = get_commit_output_encoding();\n-\t\tconst char *message = repo_logmsg_reencode(the_repository,\n-\t\t\t\t\t\t\t   current_head, NULL,\n-\t\t\t\t\t\t\t   out_enc);\n+\t\tconst char *message = repo_logmsg_reencode(r, current_head,\n+\t\t\t\t\t\t\t   NULL, out_enc);\n \n \t\tif (!msg) {\n \t\t\tconst char *orig_message = NULL;\n@@ -1477,7 +1475,7 @@ static int try_to_commit(struct repository *r,\n \t\t\thook_commit = \"HEAD\";\n \t\t}\n \t\tauthor = amend_author = get_author(message);\n-\t\trepo_unuse_commit_buffer(the_repository, current_head,\n+\t\trepo_unuse_commit_buffer(r, current_head,\n \t\t\t\t\t message);\n \t\tif (!author) {\n \t\t\tres = error(_(\"unable to parse commit author\"));\n@@ -2004,18 +2002,18 @@ static int update_squash_messages(struct repository *r,\n \t\tstruct commit *head_commit;\n \t\tconst char *head_message, *body;\n \n-\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n+\t\tif (repo_get_oid(r, \"HEAD\", &head))\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n-\t\tif (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))\n+\t\tif (!(head_message = repo_logmsg_reencode(r, head_commit, NULL,\n+\t\t\t\t\t\t\t  encoding)))\n \t\t\treturn error(_(\"could not read HEAD's commit message\"));\n \n \t\tfind_commit_subject(head_message, &body);\n \t\tif (command == TODO_FIXUP && !flag && write_message(body, strlen(body),\n \t\t\t\t\t\t\trebase_path_fixup_msg(), 0) < 0) {\n-\t\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n-\t\t\t\t\t\t head_message);\n+\t\t\trepo_unuse_commit_buffer(r, head_commit, head_message);\n \t\t\treturn error(_(\"cannot write '%s'\"), rebase_path_fixup_msg());\n \t\t}\n \t\tstrbuf_addf(&buf, \"%c \", comment_line_char);\n@@ -2030,11 +2028,10 @@ static int update_squash_messages(struct repository *r,\n \t\telse\n \t\t\tstrbuf_addstr(&buf, body);\n \n-\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n-\t\t\t\t\t head_message);\n+\t\trepo_unuse_commit_buffer(r, head_commit, head_message);\n \t}\n \n-\tif (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))\n+\tif (!(message = repo_logmsg_reencode(r, commit, NULL, encoding)))\n \t\treturn error(_(\"could not read commit message of %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tfind_commit_subject(message, &body);\n@@ -2049,7 +2046,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstrbuf_add_commented_lines(&buf, body, strlen(body));\n \t} else\n \t\treturn error(_(\"unknown command: %d\"), command);\n-\trepo_unuse_commit_buffer(the_repository, commit, message);\n+\trepo_unuse_commit_buffer(r, commit, message);\n \n \tif (!res)\n \t\tres = write_message(buf.buf, buf.len, rebase_path_squash_msg(),\n@@ -2162,7 +2159,7 @@ static int do_pick_commit(struct repository *r,\n \t\tif (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))\n \t\t\treturn error(_(\"your index file is unmerged.\"));\n \t} else {\n-\t\tunborn = repo_get_oid(the_repository, \"HEAD\", &head);\n+\t\tunborn = repo_get_oid(r, \"HEAD\", &head);\n \t\t/* Do we want to generate a root commit? */\n \t\tif (is_pick_or_similar(command) && opts->have_squash_onto &&\n \t\t    oideq(&head, &opts->squash_onto)) {\n@@ -2224,7 +2221,7 @@ static int do_pick_commit(struct repository *r,\n \t\tmsg_file = NULL;\n \t\tgoto fast_forward_edit;\n \t}\n-\tif (parent && repo_parse_commit(the_repository, parent) < 0)\n+\tif (parent && repo_parse_commit(r, parent) < 0)\n \t\t/* TRANSLATORS: The first %s will be a \"todo\" command like\n \t\t   \"revert\" or \"pick\", the second %s a SHA1. */\n \t\treturn error(_(\"%s: cannot parse parent commit %s\"),\n@@ -2616,7 +2613,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \tend_of_object_name = (char *) bol + strcspn(bol, \" \\t\\n\");\n \tsaved = *end_of_object_name;\n \t*end_of_object_name = '\\0';\n-\tstatus = repo_get_oid(the_repository, bol, &commit_oid);\n+\tstatus = repo_get_oid(r, bol, &commit_oid);\n \tif (status < 0)\n \t\terror(_(\"could not parse '%s'\"), bol); /* return later */\n \t*end_of_object_name = saved;\n@@ -3531,12 +3528,12 @@ static int make_patch(struct repository *r,\n \tstrbuf_addf(&buf, \"%s/message\", get_dir(opts));\n \tif (!file_exists(buf.buf)) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(r,\n \t\t\t\t\t\t\t\t commit, NULL,\n \t\t\t\t\t\t\t\t encoding);\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tres |= write_message(subject, strlen(subject), buf.buf, 1);\n-\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\trepo_unuse_commit_buffer(r, commit,\n \t\t\t\t\t commit_buffer);\n \t}\n \tstrbuf_release(&buf);\n@@ -3716,7 +3713,7 @@ static int do_label(struct repository *r, const char *name, int len)\n \tif (!transaction) {\n \t\terror(\"%s\", err.buf);\n \t\tret = -1;\n-\t} else if (repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n+\t} else if (repo_get_oid(r, \"HEAD\", &head_oid)) {\n \t\terror(_(\"could not read HEAD\"));\n \t\tret = -1;\n \t} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,\n@@ -4004,8 +4001,7 @@ static int do_merge(struct repository *r,\n \n \tif (commit) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *message = repo_logmsg_reencode(the_repository,\n-\t\t\t\t\t\t\t   commit, NULL,\n+\t\tconst char *message = repo_logmsg_reencode(r, commit, NULL,\n \t\t\t\t\t\t\t   encoding);\n \t\tconst char *body;\n \t\tint len;\n@@ -4019,7 +4015,7 @@ static int do_merge(struct repository *r,\n \t\tfind_commit_subject(message, &body);\n \t\tlen = strlen(body);\n \t\tret = write_message(body, len, git_path_merge_msg(r), 0);\n-\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n+\t\trepo_unuse_commit_buffer(r, commit, message);\n \t\tif (ret) {\n \t\t\terror_errno(_(\"could not write '%s'\"),\n \t\t\t\t    git_path_merge_msg(r));\n@@ -4119,8 +4115,7 @@ static int do_merge(struct repository *r,\n \t}\n \n \tmerge_commit = to_merge->item;\n-\tbases = repo_get_merge_bases(the_repository, head_commit,\n-\t\t\t\t     merge_commit);\n+\tbases = repo_get_merge_bases(r, head_commit, merge_commit);\n \tif (bases && oideq(&merge_commit->object.oid,\n \t\t\t   &bases->item->object.oid)) {\n \t\tret = 0;\n@@ -4475,7 +4470,7 @@ void create_autostash(struct repository *r, const char *path)\n \t\tif (capture_command(&stash, &buf, GIT_MAX_HEXSZ))\n \t\t\tdie(_(\"Cannot autostash\"));\n \t\tstrbuf_trim_trailing_newline(&buf);\n-\t\tif (repo_get_oid(the_repository, buf.buf, &oid))\n+\t\tif (repo_get_oid(r, buf.buf, &oid))\n \t\t\tdie(_(\"Unexpected stash response: '%s'\"),\n \t\t\t    buf.buf);\n \t\tstrbuf_reset(&buf);\n@@ -4600,9 +4595,9 @@ static int stopped_at_head(struct repository *r)\n \tstruct commit *commit;\n \tstruct commit_message message;\n \n-\tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n+\tif (repo_get_oid(r, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n-\t    repo_parse_commit(the_repository, commit) || get_message(commit, &message))\n+\t    repo_parse_commit(r, commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n \telse {\n \t\tfprintf(stderr, _(\"Stopped at %s\\n\"), message.label);\n@@ -4750,7 +4745,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t * otherwise we do not.\n \t\t\t\t */\n \t\t\t\tif (item->command == TODO_REWORD &&\n-\t\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n+\t\t\t\t    !repo_get_oid(r, \"HEAD\", &oid) &&\n \t\t\t\t    (oideq(&item->commit->object.oid, &oid) ||\n \t\t\t\t     (opts->have_squash_onto &&\n \t\t\t\t      oideq(&opts->squash_onto, &oid))))\n@@ -4839,7 +4834,7 @@ static int pick_commits(struct repository *r,\n \t\t\tstruct object_id head, orig;\n \t\t\tint res;\n \n-\t\t\tif (repo_get_oid(the_repository, \"HEAD\", &head)) {\n+\t\t\tif (repo_get_oid(r, \"HEAD\", &head)) {\n \t\t\t\tres = error(_(\"cannot read HEAD\"));\n cleanup_head_ref:\n \t\t\t\tstrbuf_release(&head_ref);\n@@ -4886,8 +4881,8 @@ static int pick_commits(struct repository *r,\n \t\t\tlog_tree_opt.disable_stdin = 1;\n \n \t\t\tif (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n-\t\t\t    !repo_get_oid(the_repository, buf.buf, &orig) &&\n-\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &head)) {\n+\t\t\t    !repo_get_oid(r, buf.buf, &orig) &&\n+\t\t\t    !repo_get_oid(r, \"HEAD\", &head)) {\n \t\t\t\tdiff_tree_oid(&orig, &head, \"\",\n \t\t\t\t\t      &log_tree_opt.diffopt);\n \t\t\t\tlog_tree_diff_flush(&log_tree_opt);\n@@ -4979,7 +4974,7 @@ static int commit_staged_changes(struct repository *r,\n \t\tstruct strbuf rev = STRBUF_INIT;\n \t\tstruct object_id head, to_amend;\n \n-\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n+\t\tif (repo_get_oid(r, \"HEAD\", &head))\n \t\t\treturn error(_(\"cannot amend non-existing commit\"));\n \t\tif (!read_oneliner(&rev, rebase_path_amend(), 0))\n \t\t\treturn error(_(\"invalid file: '%s'\"), rebase_path_amend());\n@@ -5059,14 +5054,13 @@ static int commit_staged_changes(struct repository *r,\n \t\t\t\tconst char *encoding = get_commit_output_encoding();\n \n \t\t\t\tif (parse_head(r, &commit) ||\n-\t\t\t\t    !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||\n+\t\t\t\t    !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||\n \t\t\t\t    write_message(p, strlen(p), path, 0)) {\n-\t\t\t\t\trepo_unuse_commit_buffer(the_repository,\n-\t\t\t\t\t\t\t\t commit, p);\n+\t\t\t\t\trepo_unuse_commit_buffer(r, commit, p);\n \t\t\t\t\treturn error(_(\"could not write file: \"\n \t\t\t\t\t\t       \"'%s'\"), path);\n \t\t\t\t}\n-\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\trepo_unuse_commit_buffer(r,\n \t\t\t\t\t\t\t commit, p);\n \t\t\t}\n \t\t}\n@@ -5206,7 +5200,7 @@ int sequencer_pick_revisions(struct repository *r,\n \t\tif (!strlen(name))\n \t\t\tcontinue;\n \n-\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n+\t\tif (!repo_get_oid(r, name, &oid)) {\n \t\t\tif (!lookup_commit_reference_gently(r, &oid, 1)) {\n \t\t\t\tenum object_type type = oid_object_info(r,\n \t\t\t\t\t\t\t\t\t&oid,\n@@ -5249,7 +5243,7 @@ int sequencer_pick_revisions(struct repository *r,\n \tif (walk_revs_populate_todo(&todo_list, opts) ||\n \t\t\tcreate_seq_dir(r) < 0)\n \t\treturn -1;\n-\tif (repo_get_oid(the_repository, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n+\tif (repo_get_oid(r, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n \t\treturn error(_(\"can't revert as initial commit\"));\n \tif (save_head(oid_to_hex(&oid)))\n \t\treturn -1;\n@@ -5944,7 +5938,7 @@ static int skip_unnecessary_picks(struct repository *r,\n \t\t\tcontinue;\n \t\tif (item->command != TODO_PICK)\n \t\t\tbreak;\n-\t\tif (repo_parse_commit(the_repository, item->commit)) {\n+\t\tif (repo_parse_commit(r, item->commit)) {\n \t\t\treturn error(_(\"could not parse commit '%s'\"),\n \t\t\t\toid_to_hex(&item->commit->object.oid));\n \t\t}\n@@ -6115,7 +6109,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla\n \tstruct object_id oid = onto->object.oid;\n \tint res;\n \n-\trepo_find_unique_abbrev_r(the_repository, shortonto, &oid,\n+\trepo_find_unique_abbrev_r(r, shortonto, &oid,\n \t\t\t\t  DEFAULT_ABBREV);\n \n \tif (buf->len == 0) {\n@@ -6395,8 +6389,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)\n \t\tif (file_exists(git_path_seq_dir()))\n \t\t\t*whence = FROM_CHERRY_PICK_MULTI;\n \t\tif (file_exists(rebase_path()) &&\n-\t\t    !repo_get_oid(the_repository, \"REBASE_HEAD\", &rebase_head) &&\n-\t\t    !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n+\t\t    !repo_get_oid(r, \"REBASE_HEAD\", &rebase_head) &&\n+\t\t    !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n \t\t    oideq(&rebase_head, &cherry_pick_head))\n \t\t\t*whence = FROM_REBASE_PICK;\n \t\telse\ndiff --git a/shallow.c b/shallow.c\nindex 07278467e47..fbafc4b30e9 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -30,7 +30,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)\n {\n \tstruct commit_graft *graft =\n \t\txmalloc(sizeof(struct commit_graft));\n-\tstruct commit *commit = lookup_commit(the_repository, oid);\n+\tstruct commit *commit = lookup_commit(r, oid);\n \n \toidcpy(&graft->oid, oid);\n \tgraft->nr_parent = -1;\ndiff --git a/tree.c b/tree.c\nindex 1b403c4b5ce..8643b734642 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -58,7 +58,7 @@ int read_tree_at(struct repository *r,\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\n \n-\t\t\tif (repo_parse_commit(the_repository, commit))\n+\t\t\tif (repo_parse_commit(r, commit))\n \t\t\t\tdie(\"Invalid commit %s in submodule path %s%s\",\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\ndiff --git a/wt-status.c b/wt-status.c\nindex dcd1d0cee4c..28e35a2165a 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1664,7 +1664,7 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\treturn;\n \t}\n \n-\tif (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,\n+\tif (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref,\n \t\t\t  1) == 1 &&\n \t    /* oid is a commit? match without further lookup */\n \t    (oideq(&cb.noid, &oid) ||\n@@ -1677,9 +1677,9 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\tstate->detached_from = xstrdup(from);\n \t} else\n \t\tstate->detached_from =\n-\t\t\txstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));\n+\t\t\txstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV));\n \toidcpy(&state->detached_oid, &cb.noid);\n-\tstate->detached_at = !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n+\tstate->detached_at = !repo_get_oid(r, \"HEAD\", &oid) &&\n \t\t\t     oideq(&oid, &state->detached_oid);\n \n \tfree(ref);\n@@ -1770,13 +1770,13 @@ void wt_status_get_state(struct repository *r,\n \t} else if (wt_status_check_rebase(NULL, state)) {\n \t\t;\t\t/* all set */\n \t} else if (refs_ref_exists(get_main_ref_store(r), \"CHERRY_PICK_HEAD\") &&\n-\t\t   !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &oid)) {\n+\t\t   !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &oid)) {\n \t\tstate->cherry_pick_in_progress = 1;\n \t\toidcpy(&state->cherry_pick_head_oid, &oid);\n \t}\n \twt_status_check_bisect(NULL, state);\n \tif (refs_ref_exists(get_main_ref_store(r), \"REVERT_HEAD\") &&\n-\t    !repo_get_oid(the_repository, \"REVERT_HEAD\", &oid)) {\n+\t    !repo_get_oid(r, \"REVERT_HEAD\", &oid)) {\n \t\tstate->revert_in_progress = 1;\n \t\toidcpy(&state->revert_head_oid, &oid);\n \t}\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"473652","messageId":"CAPig+cQigE7n6Op=8_Ky58pgXNUcGDQ7u9mJNHYF3x_TAg-i_Q@mail.gmail.com","threadId":"59404","inReplyTo":"patch-01.17-c167bde3c0c-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 01/17] cocci: remove dead rule from \"the_repository.pending.cocci\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2023-03-17T16:14:49Z","receivedAt":"2023-03-17T16:15:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Mar 17, 2023 at 11:42 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> The \"parse_commit_gently\" macro went away in [1], so we don't need to\n> carry his for its migration.\n\nNit: ECANTPARSE \"carry his for its\"\n"},{"id":"473667","messageId":"xmqqbkkrgp3o.fsf@gitster.g","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 00/17] cocci: remove \"the_index\" wrapper macros","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-17T19:22:19Z","receivedAt":"2023-03-17T19:22:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> In 2.40 the last use of \"USE_THE_INDEX_COMPATIBILITY_MACROS\" went\n> away, this series does the same for our long-standing migration of\n> \"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\".\n\nIs the series title on the Subject: line still valid, or did you\nmisspell \"repository\" somehow?\n\n"},{"id":"473698","messageId":"CABPp-BG=wEGu-mdT_Uj1hADa8KgxXufO6webz7FO1hfADb1v9g@mail.gmail.com","threadId":"59404","inReplyTo":"patch-01.17-c167bde3c0c-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 01/17] cocci: remove dead rule from \"the_repository.pending.cocci\"","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T05:53:13Z","receivedAt":"2023-03-19T05:53:31Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 9:41 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> The \"parse_commit_gently\" macro went away in [1], so we don't need to\n> carry his for its migration.\n\ns/his/this/ ?\n\n> 1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n>    commits, 2020-06-23)\n\nThanks for the explanation and link.\n\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  contrib/coccinelle/the_repository.pending.cocci | 8 --------\n>  1 file changed, 8 deletions(-)\n>\n> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n> index 747d382ff5f..23b97536da5 100644\n> --- a/contrib/coccinelle/the_repository.pending.cocci\n> +++ b/contrib/coccinelle/the_repository.pending.cocci\n> @@ -34,14 +34,6 @@ expression G;\n>  + repo_parse_commit_internal(the_repository,\n>    E, F, G)\n>\n> -@@\n> -expression E;\n> -expression F;\n> -@@\n> -- parse_commit_gently(\n> -+ repo_parse_commit_gently(the_repository,\n> -  E, F)\n> -\n>  @@\n>  expression E;\n>  @@\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n"},{"id":"473699","messageId":"CABPp-BHaxgJthO3ww+-kJZvwU8i8kqTSFn0dwx6X8OYcQhPf_A@mail.gmail.com","threadId":"59404","inReplyTo":"patch-02.17-1b1fc5d41f5-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T05:55:03Z","receivedAt":"2023-03-19T05:55:22Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 8:53 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> When these rules started being added in [1] they didn't use a \";\"\n> after the \")\", and would thus catch uses of these macros within\n> expressions. But as of [2] the new additions were broken in that\n> they'd only match a subset of the users of these macros.\n>\n> Rather than narrowly fixing that, let's have these use the much less\n> verbose pattern introduced in my recent [3]: There's no need to\n> exhaustively enumerate arguments if we use the \"...\" syntax. This\n> means that we can fold all of these different rules into one.\n>\n> 1. afd69dcc219 (object-store: prepare read_object_file to deal with\n>    any repo, 2018-11-13)\n> 2. 21a9651ba3f (commit-reach: prepare get_merge_bases to handle any\n>    repo, 2018-11-13)\n> 3. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,\n>    2022-11-19)\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  .../coccinelle/the_repository.pending.cocci   | 160 +++++-------------\n>  1 file changed, 46 insertions(+), 114 deletions(-)\n>\n> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n> index 23b97536da5..99e192736ee 100644\n> --- a/contrib/coccinelle/the_repository.pending.cocci\n> +++ b/contrib/coccinelle/the_repository.pending.cocci\n> @@ -3,118 +3,50 @@\n>  // our code base.\n>\n>  @@\n> -expression E;\n> -expression F;\n> -expression G;\n>  @@\n> -- read_object_file(\n> -+ repo_read_object_file(the_repository,\n> -  E, F, G)\n> -\n> -@@\n> -expression E;\n> -@@\n> -- has_object_file(\n> -+ repo_has_object_file(the_repository,\n> -  E)\n> -\n> -@@\n> -expression E;\n> -@@\n> -- has_object_file_with_flags(\n> -+ repo_has_object_file_with_flags(the_repository,\n> -  E)\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -@@\n> -- parse_commit_internal(\n> -+ repo_parse_commit_internal(the_repository,\n> -  E, F, G)\n> -\n> -@@\n> -expression E;\n> -@@\n> -- parse_commit(\n> -+ repo_parse_commit(the_repository,\n> -  E)\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -@@\n> -- get_merge_bases(\n> -+ repo_get_merge_bases(the_repository,\n> -  E, F);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -@@\n> -- get_merge_bases_many(\n> -+ repo_get_merge_bases_many(the_repository,\n> -  E, F, G);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -@@\n> -- get_merge_bases_many_dirty(\n> -+ repo_get_merge_bases_many_dirty(the_repository,\n> -  E, F, G);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -@@\n> -- in_merge_bases(\n> -+ repo_in_merge_bases(the_repository,\n> -  E, F);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -@@\n> -- in_merge_bases_many(\n> -+ repo_in_merge_bases_many(the_repository,\n> -  E, F, G);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -@@\n> -- get_commit_buffer(\n> -+ repo_get_commit_buffer(the_repository,\n> -  E, F);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -@@\n> -- unuse_commit_buffer(\n> -+ repo_unuse_commit_buffer(the_repository,\n> -  E, F);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -@@\n> -- logmsg_reencode(\n> -+ repo_logmsg_reencode(the_repository,\n> -  E, F, G);\n> -\n> -@@\n> -expression E;\n> -expression F;\n> -expression G;\n> -expression H;\n> -@@\n> -- format_commit_message(\n> -+ repo_format_commit_message(the_repository,\n> -  E, F, G, H);\n> +(\n> +- read_object_file\n> ++ repo_read_object_file\n> +|\n> +- has_object_file\n> ++ repo_has_object_file\n> +|\n> +- has_object_file_with_flags\n> ++ repo_has_object_file_with_flags\n> +|\n> +- parse_commit_internal\n> ++ repo_parse_commit_internal\n> +|\n> +- parse_commit\n> ++ repo_parse_commit\n> +|\n> +- get_merge_bases\n> ++ repo_get_merge_bases\n> +|\n> +- get_merge_bases_many\n> ++ repo_get_merge_bases_many\n> +|\n> +- get_merge_bases_many_dirty\n> ++ repo_get_merge_bases_many_dirty\n> +|\n> +- in_merge_bases\n> ++ repo_in_merge_bases\n> +|\n> +- in_merge_bases_many\n> ++ repo_in_merge_bases_many\n> +|\n> +- get_commit_buffer\n> ++ repo_get_commit_buffer\n> +|\n> +- unuse_commit_buffer\n> ++ repo_unuse_commit_buffer\n> +|\n> +- logmsg_reencode\n> ++ repo_logmsg_reencode\n> +|\n> +- format_commit_message\n> ++ repo_format_commit_message\n> +)\n> +  (\n> ++ the_repository,\n> +  ...)\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n\nI know virtually nothing about cocci, but the commit message explains\nwell enough that it's clear what you're doing and what's happening.\n:-)\n"},{"id":"473700","messageId":"CABPp-BHhMRHcce=iym8jo=YhgwFMweN0Z=ubjFa_ApZ8ybJt0g@mail.gmail.com","threadId":"59404","inReplyTo":"patch-03.17-34c6b8afd6c-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 03/17] cocci: sort \"the_repository\" rules by header","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T05:59:14Z","receivedAt":"2023-03-19T05:59:32Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 9:16 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> Sort the \"the_repository.pending.cocci\" file by which header the\n> macros are in, and add a comment to that effect in front of the\n> rules. This will make subsequent commits easier to follow, as we'll be\n> applying these rules on a header-by-header basis.\n\nIs this at risk of becoming out-of-date with en/header-cleanup or my\nsecond series over at https://github.com/gitgitgadget/git/pull/1493\nthat I'm planning to submit soon?  It doesn't look like you're adding\nany comments pointing at cache.h, and I'm mostly moving stuff out of\nthere, but I'm just curious if we are risking adding\nlikely-to-become-stale comments.\n\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  .../coccinelle/the_repository.pending.cocci   | 34 +++++++++++--------\n>  1 file changed, 19 insertions(+), 15 deletions(-)\n>\n> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n> index 99e192736ee..84b79dce480 100644\n> --- a/contrib/coccinelle/the_repository.pending.cocci\n> +++ b/contrib/coccinelle/the_repository.pending.cocci\n> @@ -5,21 +5,7 @@\n>  @@\n>  @@\n>  (\n> -- read_object_file\n> -+ repo_read_object_file\n> -|\n> -- has_object_file\n> -+ repo_has_object_file\n> -|\n> -- has_object_file_with_flags\n> -+ repo_has_object_file_with_flags\n> -|\n> -- parse_commit_internal\n> -+ repo_parse_commit_internal\n> -|\n> -- parse_commit\n> -+ repo_parse_commit\n> -|\n> +// commit-reach.h\n>  - get_merge_bases\n>  + repo_get_merge_bases\n>  |\n> @@ -34,6 +20,13 @@\n>  |\n>  - in_merge_bases_many\n>  + repo_in_merge_bases_many\n> +// commit.h\n> +|\n> +- parse_commit_internal\n> ++ repo_parse_commit_internal\n> +|\n> +- parse_commit\n> ++ repo_parse_commit\n>  |\n>  - get_commit_buffer\n>  + repo_get_commit_buffer\n> @@ -43,6 +36,17 @@\n>  |\n>  - logmsg_reencode\n>  + repo_logmsg_reencode\n> +// object-store.h\n> +|\n> +- read_object_file\n> ++ repo_read_object_file\n> +|\n> +- has_object_file\n> ++ repo_has_object_file\n> +|\n> +- has_object_file_with_flags\n> ++ repo_has_object_file_with_flags\n> +// pretty.h\n>  |\n>  - format_commit_message\n>  + repo_format_commit_message\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n\nOther than the minor comment above, things all make sense.\n"},{"id":"473701","messageId":"CABPp-BHNQuK=uaaxO65nMxegSK=cQ20ni_L+RPHs1bkYagetZQ@mail.gmail.com","threadId":"59404","inReplyTo":"patch-04.17-4b62e9a35a9-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 04/17] cocci: add missing \"the_repository\" macros to \"pending\"","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T06:04:39Z","receivedAt":"2023-03-19T06:04:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 8:57 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> In the case of diff.h, rerere.h and revision.h the macros were added\n> in [1], [2] and [3] when \"the_repository.pending.cocci\" didn't\n> exist. None of the subsequently added migration rules covered\n> them. Let's add those missing rules.\n>\n> In the case of macros in \"cache.h\", \"commit.h\", \"packfile.h\",\n> \"promisor-remote.h\" and \"refs.h\" those aren't guarded by\n> \"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\", but they're also macros that\n> add \"the_repository\" as the first argument, so we should migrate away\n> from them.\n\nYaay, nice to see work on migrating away from the_repository again.  :-)\n\n> 1. 2abf3503854 (revision.c: remove implicit dependency on the_index,\n>    2018-09-21)\n> 2. e6757652350 (diff.c: remove implicit dependency on the_index,\n>    2018-09-21)\n> 3. 35843b1123e (rerere.c: remove implicit dependency on the_index,\n>    2018-09-21)\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  .../coccinelle/the_repository.pending.cocci   | 70 +++++++++++++++++++\n>  1 file changed, 70 insertions(+)\n>\n> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n> index 84b79dce480..8b3f2580e6b 100644\n> --- a/contrib/coccinelle/the_repository.pending.cocci\n> +++ b/contrib/coccinelle/the_repository.pending.cocci\n> @@ -5,7 +5,44 @@\n>  @@\n>  @@\n>  (\n> +// cache.h\n> +- get_oid\n> ++ repo_get_oid\n> +|\n> +- get_oid_commit\n> ++ repo_get_oid_commit\n> +|\n> +- get_oid_committish\n> ++ repo_get_oid_committish\n> +|\n> +- get_oid_tree\n> ++ repo_get_oid_tree\n> +|\n> +- get_oid_treeish\n> ++ repo_get_oid_treeish\n> +|\n> +- get_oid_blob\n> ++ repo_get_oid_blob\n> +|\n> +- get_oid_mb\n> ++ repo_get_oid_mb\n> +|\n> +- find_unique_abbrev\n> ++ repo_find_unique_abbrev\n> +|\n> +- find_unique_abbrev_r\n> ++ repo_find_unique_abbrev_r\n> +|\n> +- for_each_abbrev\n> ++ repo_for_each_abbrev\n> +|\n> +- interpret_branch_name\n> ++ repo_interpret_branch_name\n> +|\n> +- peel_to_type\n> ++ repo_peel_to_type\n>  // commit-reach.h\n> +|\n>  - get_merge_bases\n>  + repo_get_merge_bases\n>  |\n> @@ -36,6 +73,13 @@\n>  |\n>  - logmsg_reencode\n>  + repo_logmsg_reencode\n> +|\n> +- get_commit_tree\n> ++ repo_get_commit_tree\n> +// diff.h\n> +|\n> +- diff_setup\n> ++ repo_diff_setup\n>  // object-store.h\n>  |\n>  - read_object_file\n> @@ -50,6 +94,32 @@\n>  |\n>  - format_commit_message\n>  + repo_format_commit_message\n> +// packfile.h\n> +|\n> +- approximate_object_count\n> ++ repo_approximate_object_count\n> +// promisor-remote.h\n> +|\n> +- promisor_remote_reinit\n> ++ repo_promisor_remote_reinit\n> +|\n> +- promisor_remote_find\n> ++ repo_promisor_remote_find\n> +|\n> +- has_promisor_remote\n> ++ repo_has_promisor_remote\n> +// refs.h\n> +|\n> +- dwim_ref\n> ++ repo_dwim_ref\n> +// rerere.h\n> +|\n> +- rerere\n> ++ repo_rerere\n> +// revision.h\n> +|\n> +- init_revisions\n> ++ repo_init_revisions\n>  )\n>    (\n>  + the_repository,\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n\nMakes sense.\n"},{"id":"473702","messageId":"CABPp-BEaRY_NaDNVTWoYmn=61iEUfsi5MdkdYW9STRhQfMBj+g@mail.gmail.com","threadId":"59404","inReplyTo":"patch-05.17-36eae891341-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 05/17] cocci: apply the \"cache.h\" part of \"the_repository.pending\"","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T06:06:55Z","receivedAt":"2023-03-19T06:07:14Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 8:47 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> Apply the part of \"the_repository.pending.cocci\" pertaining to\n> \"cache.h\".\n\nI know you said we only really needed to review 01-04, and 16-17, but\nI spot-checked this one anyway, particularly since it conflicted with\nwhat I was originally trying to include in\nhttps://github.com/gitgitgadget/git/pull/1493.  But, I pulled that\npiece out to submit later, I'm in favor of the changes you are making\nhere.\n\nAlso, looking over this patch I think answered my question on the\nprevious patch.  You only needed the functions sorted by filename for\nthe duration of your series, so that's good too.\n\nAnyway, looks good.\n"},{"id":"473703","messageId":"CABPp-BGQuNhDfE24POO5d-ETZn1ajFTXE0ZZBjvccmjV7x3yGQ@mail.gmail.com","threadId":"59404","inReplyTo":"patch-16.17-86e24add191-20230317T152725Z-avarab@gmail.com","subject":"Re: [PATCH 16/17] post-cocci: adjust comments for recent repo_* migration","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T06:12:26Z","receivedAt":"2023-03-19T06:12:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 9:22 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> In preceding commits we changed many calls to macros that were\n> providing a \"the_repository\" argument to invoke corresponding repo_*()\n> function instead. Let's follow-up and adjust references to those in\n> comments, which coccinelle didn't (and inherently can't) catch.\n\nNice.\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  builtin/branch.c   | 2 +-\n>  builtin/shortlog.c | 2 +-\n>  cache.h            | 4 ++--\n>  commit.h           | 4 ++--\n>  diff.h             | 2 +-\n>  object-file.c      | 2 +-\n>  object-store.h     | 4 ++--\n>  pretty.c           | 2 +-\n>  refs.c             | 2 +-\n>  sequencer.c        | 6 +++---\n>  strbuf.h           | 6 +++---\n>  11 files changed, 18 insertions(+), 18 deletions(-)\n>\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index bbcfb34b3c6..45910039e6b 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -156,7 +156,7 @@ static int branch_merged(int kind, const char *name,\n>         /*\n>          * After the safety valve is fully redefined to \"check with\n>          * upstream, if any, otherwise with HEAD\", we should just\n> -        * return the result of the in_merge_bases() above without\n> +        * return the result of the repo_in_merge_bases() above without\n>          * any of the following code, but during the transition period,\n>          * a gentle reminder is in order.\n>          */\n> diff --git a/builtin/shortlog.c b/builtin/shortlog.c\n> index 62f91b8b932..f287a6acd03 100644\n> --- a/builtin/shortlog.c\n> +++ b/builtin/shortlog.c\n> @@ -176,7 +176,7 @@ static void insert_records_from_trailers(struct shortlog *log,\n>                 return;\n>\n>         /*\n> -        * Using format_commit_message(\"%B\") would be simpler here, but\n> +        * Using repo_format_commit_message(\"%B\") would be simpler here, but\n>          * this saves us copying the message.\n>          */\n>         commit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,\n> diff --git a/cache.h b/cache.h\n> index d835ac8b4d2..555354e1961 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -443,7 +443,7 @@ void validate_cache_entries(const struct index_state *istate);\n>  /*\n>   * Bulk prefetch all missing cache entries that are not GITLINKs and that match\n>   * the given predicate. This function should only be called if\n> - * has_promisor_remote() returns true.\n> + * repo_has_promisor_remote() returns true.\n>   */\n>  typedef int (*must_prefetch_predicate)(const struct cache_entry *);\n>  void prefetch_cache_entries(const struct index_state *istate,\n> @@ -1201,7 +1201,7 @@ void check_repository_format(struct repository_format *fmt);\n>   * terminated.\n>   *\n>   * The non-`_r` version returns a static buffer which remains valid until 4\n> - * more calls to find_unique_abbrev are made.\n> + * more calls to repo_find_unique_abbrev are made.\n>   *\n>   * The `_r` variant writes to a buffer supplied by the caller, which must be at\n>   * least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes\n> diff --git a/commit.h b/commit.h\n> index e98ee6e698e..d4adf111019 100644\n> --- a/commit.h\n> +++ b/commit.h\n> @@ -130,7 +130,7 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,\n>  /*\n>   * Get the commit's object contents, either from cache or by reading the object\n>   * from disk. The resulting memory should not be modified, and must be given\n> - * to unuse_commit_buffer when the caller is done.\n> + * to repo_unuse_commit_buffer when the caller is done.\n>   */\n>  const void *repo_get_commit_buffer(struct repository *r,\n>                                    const struct commit *,\n> @@ -139,7 +139,7 @@ const void *repo_get_commit_buffer(struct repository *r,\n>  /*\n>   * Tell the commit subsystem that we are done with a particular commit buffer.\n>   * The commit and buffer should be the input and return value, respectively,\n> - * from an earlier call to get_commit_buffer.  The buffer may or may not be\n> + * from an earlier call to repo_get_commit_buffer.  The buffer may or may not be\n>   * freed by this call; callers should not access the memory afterwards.\n>   */\n>  void repo_unuse_commit_buffer(struct repository *r,\n> diff --git a/diff.h b/diff.h\n> index 8b510eb579d..0aa36e81261 100644\n> --- a/diff.h\n> +++ b/diff.h\n> @@ -614,7 +614,7 @@ void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);\n>  #define DIFF_STATUS_FILTER_BROKEN      'B'\n>\n>  /*\n> - * This is different from find_unique_abbrev() in that\n> + * This is different from repo_find_unique_abbrev() in that\n>   * it stuffs the result with dots for alignment.\n>   */\n>  const char *diff_aligned_abbrev(const struct object_id *sha1, int);\n> diff --git a/object-file.c b/object-file.c\n> index 141cf85f25b..47c52681640 100644\n> --- a/object-file.c\n> +++ b/object-file.c\n> @@ -267,7 +267,7 @@ int hash_algo_by_length(int len)\n>\n>  /*\n>   * This is meant to hold a *small* number of objects that you would\n> - * want read_object_file() to be able to return, but yet you do not want\n> + * want repo_read_object_file() to be able to return, but yet you do not want\n>   * to write them into the object store (e.g. a browse-only\n>   * application).\n>   */\n> diff --git a/object-store.h b/object-store.h\n> index b47849d4e7e..9217ae83064 100644\n> --- a/object-store.h\n> +++ b/object-store.h\n> @@ -216,7 +216,7 @@ struct raw_object_store {\n>         /*\n>          * A fast, rough count of the number of objects in the repository.\n>          * These two fields are not meant for direct access. Use\n> -        * approximate_object_count() instead.\n> +        * repo_approximate_object_count() instead.\n>          */\n>         unsigned long approximate_object_count;\n>         unsigned approximate_object_count_valid : 1;\n> @@ -343,7 +343,7 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect);\n>\n>  /*\n>   * Enabling the object read lock allows multiple threads to safely call the\n> - * following functions in parallel: repo_read_object_file(), read_object_file(),\n> + * following functions in parallel: repo_read_object_file(),\n>   * read_object_with_reference(), oid_object_info() and oid_object_info_extended().\n>   *\n>   * obj_read_lock() and obj_read_unlock() may also be used to protect other\n> diff --git a/pretty.c b/pretty.c\n> index 076d1c363e7..23ac06b93f3 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -719,7 +719,7 @@ const char *repo_logmsg_reencode(struct repository *r,\n>                  * Otherwise, we still want to munge the encoding header in the\n>                  * result, which will be done by modifying the buffer. If we\n>                  * are using a fresh copy, we can reuse it. But if we are using\n> -                * the cached copy from get_commit_buffer, we need to duplicate it\n> +                * the cached copy from repo_get_commit_buffer, we need to duplicate it\n>                  * to avoid munging the cached copy.\n>                  */\n>                 if (msg == get_cached_commit_buffer(r, commit, NULL))\n> diff --git a/refs.c b/refs.c\n> index aeae31c972f..cd7537bce64 100644\n> --- a/refs.c\n> +++ b/refs.c\n> @@ -1821,7 +1821,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,\n>                         return NULL;\n>\n>                 /*\n> -                * dwim_ref() uses REF_ISBROKEN to distinguish between\n> +                * repo_dwim_ref() uses REF_ISBROKEN to distinguish between\n>                  * missing refs and refs that were present but invalid,\n>                  * to complain about the latter to stderr.\n>                  *\n> diff --git a/sequencer.c b/sequencer.c\n> index aa3ebb47d98..fb5a540fa04 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -768,9 +768,9 @@ static int is_index_unchanged(struct repository *r)\n>         /*\n>          * If head_commit is NULL, check_commit, called from\n>          * lookup_commit, would have indicated that head_commit is not\n> -        * a commit object already.  parse_commit() will return failure\n> +        * a commit object already.  repo_parse_commit() will return failure\n>          * without further complaints in such a case.  Otherwise, if\n> -        * the commit is invalid, parse_commit() will complain.  So\n> +        * the commit is invalid, repo_parse_commit() will complain.  So\n>          * there is nothing for us to say here.  Just return failure.\n>          */\n>         if (repo_parse_commit(the_repository, head_commit))\n> @@ -5365,7 +5365,7 @@ static const char *label_oid(struct object_id *oid, const char *label,\n>          * For \"uninteresting\" commits, i.e. commits that are not to be\n>          * rebased, and which can therefore not be labeled, we use a unique\n>          * abbreviation of the commit name. This is slightly more complicated\n> -        * than calling find_unique_abbrev() because we also need to make\n> +        * than calling repo_find_unique_abbrev() because we also need to make\n>          * sure that the abbreviation does not conflict with any other\n>          * label.\n>          *\n> diff --git a/strbuf.h b/strbuf.h\n> index f6dbb9681ee..b980f9edc6d 100644\n> --- a/strbuf.h\n> +++ b/strbuf.h\n> @@ -631,7 +631,7 @@ void strbuf_add_separated_string_list(struct strbuf *str,\n>  void strbuf_list_free(struct strbuf **list);\n>\n>  /**\n> - * Add the abbreviation, as generated by find_unique_abbrev, of `sha1` to\n> + * Add the abbreviation, as generated by repo_find_unique_abbrev(), of `sha1` to\n>   * the strbuf `sb`.\n>   */\n>  struct repository;\n> @@ -706,14 +706,14 @@ static inline void strbuf_complete_line(struct strbuf *sb)\n>\n>  /*\n>   * Copy \"name\" to \"sb\", expanding any special @-marks as handled by\n> - * interpret_branch_name(). The result is a non-qualified branch name\n> + * repo_interpret_branch_name(). The result is a non-qualified branch name\n>   * (so \"foo\" or \"origin/master\" instead of \"refs/heads/foo\" or\n>   * \"refs/remotes/origin/master\").\n>   *\n>   * Note that the resulting name may not be a syntactically valid refname.\n>   *\n>   * If \"allowed\" is non-zero, restrict the set of allowed expansions. See\n> - * interpret_branch_name() for details.\n> + * repo_interpret_branch_name() for details.\n>   */\n>  void strbuf_branchname(struct strbuf *sb, const char *name,\n>                        unsigned allowed);\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n\nLooks good.\n"},{"id":"473705","messageId":"CABPp-BEdpTO=DRjLq_p+dgX68M0HUVB--3yQR4Sdp8rnFYeyfA@mail.gmail.com","threadId":"59404","inReplyTo":"patch-17.17-6f86a34bf8b-20230317T152725Z-avarab@gmail.com","subject":"Re: [PATCH 17/17] libs: use \"struct repository *\" argument, not \"the_repository\"","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-19T06:19:50Z","receivedAt":"2023-03-19T06:20:10Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Mar 17, 2023 at 8:55 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> As can easily be seen from grepping in our sources, we had these uses\n> of \"the_repository\" in various library code in cases where the\n> function in question was already getting a \"struct repository *\"\n> argument. Let's use that argument instead.\n>\n> Out of these changes only the changes to \"cache-tree.c\",\n> \"commit-reach.c\", \"shallow.c\" and \"upload-pack.c\" would have cleanly\n> applied before the migration away from the \"repo_*()\" wrapper macros\n> in the preceding commits.\n>\n> The rest aren't new, as we'd previously implicitly refer to\n> \"the_repository\", but it's now more obvious that we were doing the\n> wrong thing all along, and should have used the parameter instead.\n\nYES!  I love seeing fixes like this.  I noticed some a while back in\nthe merge code, and had some patches somewhere that I think I never\ngot around to submitting, but which have been in the back of my mind\nbugging me.  Nice to see lots of these kinds of cases getting fixed.\n\n> The change to change \"get_index_format_default(the_repository)\" in\n> \"read-cache.c\" to use the \"r\" variable instead should arguably have\n> been part of [1], or in the subsequent cleanup in [2]. Let's do it\n> here, as can be seen from the initial code in [3] it's not important\n> that we use \"the_repository\" there, but would prefer to always use the\n> current repository.\n>\n> This change excludes the \"the_repository\" use in \"upload-pack.c\"'s\n> upload_pack_advertise(), as the in-flight [4] makes that change.\n>\n> 1. ee1f0c242ef (read-cache: add index.skipHash config option,\n>    2023-01-06)\n> 2. 6269f8eaad0 (treewide: always have a valid \"index_state.repo\"\n>    member, 2023-01-17)\n> 3. 7211b9e7534 (repo-settings: consolidate some config settings,\n>    2019-08-13)\n> 4. <Y/hbUsGPVNAxTdmS@coredump.intra.peff.net>\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  add-interactive.c |   2 +-\n>  branch.c          |   8 ++--\n>  builtin/replace.c |   2 +-\n>  cache-tree.c      |   4 +-\n>  combine-diff.c    |   2 +-\n>  commit-graph.c    |   2 +-\n>  commit-reach.c    |   2 +-\n>  merge-recursive.c |   2 +-\n\nDoh, doesn't fix up the ones I had.  I don't remember the exact issue\nand can't find the patches right now, but looking around a little I\nsee a write_object_file() which should be a repo_write_object_file(),\nbut it's in a function that doesn't take a repository argument.\nHowever, the caller has access to a repository argument, in the form\nof opt->repo, so we've got some low-hanging fruit that could be fixed\nup.  Doesn't need to be part of your series, but it's nice that your\nseries has done some of the groundwork to make these issues more\nobvious.\n\n>  notes-cache.c     |   2 +-\n>  notes-utils.c     |   2 +-\n>  object-name.c     |   8 ++--\n>  read-cache.c      |   4 +-\n>  reset.c           |   2 +-\n>  sequencer.c       | 102 ++++++++++++++++++++++------------------------\n>  shallow.c         |   2 +-\n>  tree.c            |   2 +-\n>  wt-status.c       |  10 ++---\n>  17 files changed, 76 insertions(+), 82 deletions(-)\n>\n> diff --git a/add-interactive.c b/add-interactive.c\n> index 33f41d65a47..02bf6fc15cb 100644\n> --- a/add-interactive.c\n> +++ b/add-interactive.c\n> @@ -551,7 +551,7 @@ static int get_modified_files(struct repository *r,\n>                 opt.def = is_initial ?\n>                         empty_tree_oid_hex() : oid_to_hex(&head_oid);\n>\n> -               repo_init_revisions(the_repository, &rev, NULL);\n> +               repo_init_revisions(r, &rev, NULL);\n>                 setup_revisions(0, NULL, &rev, &opt);\n>\n>                 rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\n> diff --git a/branch.c b/branch.c\n> index a01e465b114..2b266e6fcb9 100644\n> --- a/branch.c\n> +++ b/branch.c\n> @@ -531,7 +531,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n>                 explicit_tracking = 1;\n>\n>         real_ref = NULL;\n> -       if (repo_get_oid_mb(the_repository, start_name, &oid)) {\n> +       if (repo_get_oid_mb(r, start_name, &oid)) {\n>                 if (explicit_tracking) {\n>                         int code = die_message(_(upstream_missing), start_name);\n>                         advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,\n> @@ -541,8 +541,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n>                 die(_(\"not a valid object name: '%s'\"), start_name);\n>         }\n>\n> -       switch (repo_dwim_ref(the_repository, start_name, strlen(start_name),\n> -                             &oid, &real_ref, 0)) {\n> +       switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,\n> +                             &real_ref, 0)) {\n>         case 0:\n>                 /* Not branching from any existing branch */\n>                 if (explicit_tracking)\n> @@ -773,7 +773,7 @@ void create_branches_recursively(struct repository *r, const char *name,\n>                             name);\n>         }\n>\n> -       create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,\n> +       create_branch(r, name, start_commitish, force, 0, reflog, quiet,\n>                       BRANCH_TRACK_NEVER, dry_run);\n>         if (dry_run)\n>                 return;\n> diff --git a/builtin/replace.c b/builtin/replace.c\n> index 85f0b79c924..bd67107a7c7 100644\n> --- a/builtin/replace.c\n> +++ b/builtin/replace.c\n> @@ -54,7 +54,7 @@ static int show_reference(struct repository *r, const char *refname,\n>                         struct object_id object;\n>                         enum object_type obj_type, repl_type;\n>\n> -                       if (repo_get_oid(the_repository, refname, &object))\n> +                       if (repo_get_oid(r, refname, &object))\n>                                 return error(_(\"failed to resolve '%s' as a valid ref\"), refname);\n>\n>                         obj_type = oid_object_info(r, &object, NULL);\n> diff --git a/cache-tree.c b/cache-tree.c\n> index ab2cc1edf29..b0e490b5aa4 100644\n> --- a/cache-tree.c\n> +++ b/cache-tree.c\n> @@ -814,14 +814,14 @@ void prime_cache_tree(struct repository *r,\n>  {\n>         struct strbuf tree_path = STRBUF_INIT;\n>\n> -       trace2_region_enter(\"cache-tree\", \"prime_cache_tree\", the_repository);\n> +       trace2_region_enter(\"cache-tree\", \"prime_cache_tree\", r);\n>         cache_tree_free(&istate->cache_tree);\n>         istate->cache_tree = cache_tree();\n>\n>         prime_cache_tree_rec(r, istate->cache_tree, tree, &tree_path);\n>         strbuf_release(&tree_path);\n>         istate->cache_changed |= CACHE_TREE_CHANGED;\n> -       trace2_region_leave(\"cache-tree\", \"prime_cache_tree\", the_repository);\n> +       trace2_region_leave(\"cache-tree\", \"prime_cache_tree\", r);\n>  }\n>\n>  /*\n> diff --git a/combine-diff.c b/combine-diff.c\n> index 20f8a03924f..fa5967a5be6 100644\n> --- a/combine-diff.c\n> +++ b/combine-diff.c\n> @@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r,\n>                 *size = fill_textconv(r, textconv, df, &blob);\n>                 free_filespec(df);\n>         } else {\n> -               blob = repo_read_object_file(the_repository, oid, &type, size);\n> +               blob = repo_read_object_file(r, oid, &type, size);\n>                 if (type != OBJ_BLOB)\n>                         die(\"object '%s' is not a blob!\", oid_to_hex(oid));\n>         }\n> diff --git a/commit-graph.c b/commit-graph.c\n> index 268410e913c..035816f4d8c 100644\n> --- a/commit-graph.c\n> +++ b/commit-graph.c\n> @@ -2549,7 +2549,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)\n>\n>                 graph_commit = lookup_commit(r, &cur_oid);\n>                 odb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));\n> -               if (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) {\n> +               if (repo_parse_commit_internal(r, odb_commit, 0, 0)) {\n>                         graph_report(_(\"failed to parse commit %s from object database for commit-graph\"),\n>                                      oid_to_hex(&cur_oid));\n>                         continue;\n> diff --git a/commit-reach.c b/commit-reach.c\n> index c88faf7e7b2..01eb11b5957 100644\n> --- a/commit-reach.c\n> +++ b/commit-reach.c\n> @@ -448,7 +448,7 @@ int repo_is_descendant_of(struct repository *r,\n>         if (!with_commit)\n>                 return 1;\n>\n> -       if (generation_numbers_enabled(the_repository)) {\n> +       if (generation_numbers_enabled(r)) {\n>                 struct commit_list *from_list = NULL;\n>                 int result;\n>                 commit_list_insert(commit, &from_list);\n> diff --git a/merge-recursive.c b/merge-recursive.c\n> index d83ce19bb1f..20aa18e2203 100644\n> --- a/merge-recursive.c\n> +++ b/merge-recursive.c\n> @@ -3798,7 +3798,7 @@ static struct commit *get_ref(struct repository *repo,\n>                 return make_virtual_commit(repo, (struct tree*)object, name);\n>         if (object->type != OBJ_COMMIT)\n>                 return NULL;\n> -       if (repo_parse_commit(the_repository, (struct commit *)object))\n> +       if (repo_parse_commit(repo, (struct commit *)object))\n>                 return NULL;\n>         return (struct commit *)object;\n>  }\n> diff --git a/notes-cache.c b/notes-cache.c\n> index e5e9092d367..1a6e214ea79 100644\n> --- a/notes-cache.c\n> +++ b/notes-cache.c\n> @@ -23,7 +23,7 @@ static int notes_cache_match_validity(struct repository *r,\n>                 return 0;\n>\n>         memset(&pretty_ctx, 0, sizeof(pretty_ctx));\n> -       repo_format_commit_message(the_repository, commit, \"%s\", &msg,\n> +       repo_format_commit_message(r, commit, \"%s\", &msg,\n>                                    &pretty_ctx);\n>         strbuf_trim(&msg);\n>\n> diff --git a/notes-utils.c b/notes-utils.c\n> index 0550cfded86..4be0aaa6de9 100644\n> --- a/notes-utils.c\n> +++ b/notes-utils.c\n> @@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r,\n>                 struct object_id parent_oid;\n>                 if (!read_ref(t->ref, &parent_oid)) {\n>                         struct commit *parent = lookup_commit(r, &parent_oid);\n> -                       if (repo_parse_commit(the_repository, parent))\n> +                       if (repo_parse_commit(r, parent))\n>                                 die(\"Failed to find/parse commit %s\", t->ref);\n>                         commit_list_insert(parent, &parents);\n>                 }\n> diff --git a/object-name.c b/object-name.c\n> index df31f192ce3..c7bc311dcef 100644\n> --- a/object-name.c\n> +++ b/object-name.c\n> @@ -1038,7 +1038,7 @@ static enum get_oid_result get_parent(struct repository *r,\n>         if (ret)\n>                 return ret;\n>         commit = lookup_commit_reference(r, &oid);\n> -       if (repo_parse_commit(the_repository, commit))\n> +       if (repo_parse_commit(r, commit))\n>                 return MISSING_OBJECT;\n>         if (!idx) {\n>                 oidcpy(result, &commit->object.oid);\n> @@ -1072,7 +1072,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,\n>                 return MISSING_OBJECT;\n>\n>         while (generation--) {\n> -               if (repo_parse_commit(the_repository, commit) || !commit->parents)\n> +               if (repo_parse_commit(r, commit) || !commit->parents)\n>                         return MISSING_OBJECT;\n>                 commit = commit->parents->item;\n>         }\n> @@ -1363,10 +1363,10 @@ static int get_oid_oneline(struct repository *r,\n>                 commit = pop_most_recent_commit(&list, ONELINE_SEEN);\n>                 if (!parse_object(r, &commit->object.oid))\n>                         continue;\n> -               buf = repo_get_commit_buffer(the_repository, commit, NULL);\n> +               buf = repo_get_commit_buffer(r, commit, NULL);\n>                 p = strstr(buf, \"\\n\\n\");\n>                 matches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));\n> -               repo_unuse_commit_buffer(the_repository, commit, buf);\n> +               repo_unuse_commit_buffer(r, commit, buf);\n>\n>                 if (matches) {\n>                         oidcpy(oid, &commit->object.oid);\n> diff --git a/read-cache.c b/read-cache.c\n> index 1548e886684..892fede6b41 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -2628,7 +2628,7 @@ int repo_index_has_changes(struct repository *repo,\n>\n>         if (tree)\n>                 cmp = tree->object.oid;\n> -       if (tree || !repo_get_oid_tree(the_repository, \"HEAD\", &cmp)) {\n> +       if (tree || !repo_get_oid_tree(repo, \"HEAD\", &cmp)) {\n>                 struct diff_options opt;\n>\n>                 repo_diff_setup(repo, &opt);\n> @@ -2947,7 +2947,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,\n>         }\n>\n>         if (!istate->version)\n> -               istate->version = get_index_format_default(the_repository);\n> +               istate->version = get_index_format_default(r);\n>\n>         /* demote version 3 to version 2 when the latter suffices */\n>         if (istate->version == 3 || istate->version == 2)\n> diff --git a/reset.c b/reset.c\n> index 3a9c6dfdd0a..65f8138c78b 100644\n> --- a/reset.c\n> +++ b/reset.c\n> @@ -106,7 +106,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)\n>                 goto leave_reset_head;\n>         }\n>\n> -       if (!repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n> +       if (!repo_get_oid(r, \"HEAD\", &head_oid)) {\n>                 head = &head_oid;\n>         } else if (!oid || !reset_hard) {\n>                 ret = error(_(\"could not determine HEAD revision\"));\n> diff --git a/sequencer.c b/sequencer.c\n> index fb5a540fa04..f8f4e72112c 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -694,8 +694,8 @@ static int do_recursive_merge(struct repository *r,\n>         o.show_rename_progress = 1;\n>\n>         head_tree = parse_tree_indirect(head);\n> -       next_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);\n> -       base_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);\n> +       next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);\n> +       base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);\n>\n>         for (i = 0; i < opts->xopts_nr; i++)\n>                 parse_merge_opt(&o, opts->xopts[i]);\n> @@ -773,7 +773,7 @@ static int is_index_unchanged(struct repository *r)\n>          * the commit is invalid, repo_parse_commit() will complain.  So\n>          * there is nothing for us to say here.  Just return failure.\n>          */\n> -       if (repo_parse_commit(the_repository, head_commit))\n> +       if (repo_parse_commit(r, head_commit))\n>                 return -1;\n>\n>         if (!(cache_tree_oid = get_cache_tree_oid(istate)))\n> @@ -1338,15 +1338,15 @@ void print_commit_summary(struct repository *r,\n>         commit = lookup_commit(r, oid);\n>         if (!commit)\n>                 die(_(\"couldn't look up newly created commit\"));\n> -       if (repo_parse_commit(the_repository, commit))\n> +       if (repo_parse_commit(r, commit))\n>                 die(_(\"could not parse newly created commit\"));\n>\n>         strbuf_addstr(&format, \"format:%h] %s\");\n>\n> -       repo_format_commit_message(the_repository, commit, \"%an <%ae>\",\n> -                                  &author_ident, &pctx);\n> -       repo_format_commit_message(the_repository, commit, \"%cn <%ce>\",\n> -                                  &committer_ident, &pctx);\n> +       repo_format_commit_message(r, commit, \"%an <%ae>\", &author_ident,\n> +                                  &pctx);\n> +       repo_format_commit_message(r, commit, \"%cn <%ce>\", &committer_ident,\n> +                                  &pctx);\n>         if (strbuf_cmp(&author_ident, &committer_ident)) {\n>                 strbuf_addstr(&format, \"\\n Author: \");\n>                 strbuf_addbuf_percentquote(&format, &author_ident);\n> @@ -1354,8 +1354,7 @@ void print_commit_summary(struct repository *r,\n>         if (flags & SUMMARY_SHOW_AUTHOR_DATE) {\n>                 struct strbuf date = STRBUF_INIT;\n>\n> -               repo_format_commit_message(the_repository, commit, \"%ad\",\n> -                                          &date, &pctx);\n> +               repo_format_commit_message(r, commit, \"%ad\", &date, &pctx);\n>                 strbuf_addstr(&format, \"\\n Date: \");\n>                 strbuf_addbuf_percentquote(&format, &date);\n>                 strbuf_release(&date);\n> @@ -1385,7 +1384,7 @@ void print_commit_summary(struct repository *r,\n>         rev.diffopt.detect_rename = DIFF_DETECT_RENAME;\n>         diff_setup_done(&rev.diffopt);\n>\n> -       refs = get_main_ref_store(the_repository);\n> +       refs = get_main_ref_store(r);\n>         head = refs_resolve_ref_unsafe(refs, \"HEAD\", 0, NULL, NULL);\n>         if (!head)\n>                 die(_(\"unable to resolve HEAD after creating commit\"));\n> @@ -1411,7 +1410,7 @@ static int parse_head(struct repository *r, struct commit **head)\n>         struct commit *current_head;\n>         struct object_id oid;\n>\n> -       if (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n> +       if (repo_get_oid(r, \"HEAD\", &oid)) {\n>                 current_head = NULL;\n>         } else {\n>                 current_head = lookup_commit_reference(r, &oid);\n> @@ -1421,7 +1420,7 @@ static int parse_head(struct repository *r, struct commit **head)\n>                         warning(_(\"HEAD %s is not a commit!\"),\n>                                 oid_to_hex(&oid));\n>                 }\n> -               if (repo_parse_commit(the_repository, current_head))\n> +               if (repo_parse_commit(r, current_head))\n>                         return error(_(\"could not parse HEAD commit\"));\n>         }\n>         *head = current_head;\n> @@ -1464,9 +1463,8 @@ static int try_to_commit(struct repository *r,\n>         if (flags & AMEND_MSG) {\n>                 const char *exclude_gpgsig[] = { \"gpgsig\", \"gpgsig-sha256\", NULL };\n>                 const char *out_enc = get_commit_output_encoding();\n> -               const char *message = repo_logmsg_reencode(the_repository,\n> -                                                          current_head, NULL,\n> -                                                          out_enc);\n> +               const char *message = repo_logmsg_reencode(r, current_head,\n> +                                                          NULL, out_enc);\n>\n>                 if (!msg) {\n>                         const char *orig_message = NULL;\n> @@ -1477,7 +1475,7 @@ static int try_to_commit(struct repository *r,\n>                         hook_commit = \"HEAD\";\n>                 }\n>                 author = amend_author = get_author(message);\n> -               repo_unuse_commit_buffer(the_repository, current_head,\n> +               repo_unuse_commit_buffer(r, current_head,\n>                                          message);\n>                 if (!author) {\n>                         res = error(_(\"unable to parse commit author\"));\n> @@ -2004,18 +2002,18 @@ static int update_squash_messages(struct repository *r,\n>                 struct commit *head_commit;\n>                 const char *head_message, *body;\n>\n> -               if (repo_get_oid(the_repository, \"HEAD\", &head))\n> +               if (repo_get_oid(r, \"HEAD\", &head))\n>                         return error(_(\"need a HEAD to fixup\"));\n>                 if (!(head_commit = lookup_commit_reference(r, &head)))\n>                         return error(_(\"could not read HEAD\"));\n> -               if (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))\n> +               if (!(head_message = repo_logmsg_reencode(r, head_commit, NULL,\n> +                                                         encoding)))\n>                         return error(_(\"could not read HEAD's commit message\"));\n>\n>                 find_commit_subject(head_message, &body);\n>                 if (command == TODO_FIXUP && !flag && write_message(body, strlen(body),\n>                                                         rebase_path_fixup_msg(), 0) < 0) {\n> -                       repo_unuse_commit_buffer(the_repository, head_commit,\n> -                                                head_message);\n> +                       repo_unuse_commit_buffer(r, head_commit, head_message);\n>                         return error(_(\"cannot write '%s'\"), rebase_path_fixup_msg());\n>                 }\n>                 strbuf_addf(&buf, \"%c \", comment_line_char);\n> @@ -2030,11 +2028,10 @@ static int update_squash_messages(struct repository *r,\n>                 else\n>                         strbuf_addstr(&buf, body);\n>\n> -               repo_unuse_commit_buffer(the_repository, head_commit,\n> -                                        head_message);\n> +               repo_unuse_commit_buffer(r, head_commit, head_message);\n>         }\n>\n> -       if (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))\n> +       if (!(message = repo_logmsg_reencode(r, commit, NULL, encoding)))\n>                 return error(_(\"could not read commit message of %s\"),\n>                              oid_to_hex(&commit->object.oid));\n>         find_commit_subject(message, &body);\n> @@ -2049,7 +2046,7 @@ static int update_squash_messages(struct repository *r,\n>                 strbuf_add_commented_lines(&buf, body, strlen(body));\n>         } else\n>                 return error(_(\"unknown command: %d\"), command);\n> -       repo_unuse_commit_buffer(the_repository, commit, message);\n> +       repo_unuse_commit_buffer(r, commit, message);\n>\n>         if (!res)\n>                 res = write_message(buf.buf, buf.len, rebase_path_squash_msg(),\n> @@ -2162,7 +2159,7 @@ static int do_pick_commit(struct repository *r,\n>                 if (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))\n>                         return error(_(\"your index file is unmerged.\"));\n>         } else {\n> -               unborn = repo_get_oid(the_repository, \"HEAD\", &head);\n> +               unborn = repo_get_oid(r, \"HEAD\", &head);\n>                 /* Do we want to generate a root commit? */\n>                 if (is_pick_or_similar(command) && opts->have_squash_onto &&\n>                     oideq(&head, &opts->squash_onto)) {\n> @@ -2224,7 +2221,7 @@ static int do_pick_commit(struct repository *r,\n>                 msg_file = NULL;\n>                 goto fast_forward_edit;\n>         }\n> -       if (parent && repo_parse_commit(the_repository, parent) < 0)\n> +       if (parent && repo_parse_commit(r, parent) < 0)\n>                 /* TRANSLATORS: The first %s will be a \"todo\" command like\n>                    \"revert\" or \"pick\", the second %s a SHA1. */\n>                 return error(_(\"%s: cannot parse parent commit %s\"),\n> @@ -2616,7 +2613,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n>         end_of_object_name = (char *) bol + strcspn(bol, \" \\t\\n\");\n>         saved = *end_of_object_name;\n>         *end_of_object_name = '\\0';\n> -       status = repo_get_oid(the_repository, bol, &commit_oid);\n> +       status = repo_get_oid(r, bol, &commit_oid);\n>         if (status < 0)\n>                 error(_(\"could not parse '%s'\"), bol); /* return later */\n>         *end_of_object_name = saved;\n> @@ -3531,12 +3528,12 @@ static int make_patch(struct repository *r,\n>         strbuf_addf(&buf, \"%s/message\", get_dir(opts));\n>         if (!file_exists(buf.buf)) {\n>                 const char *encoding = get_commit_output_encoding();\n> -               const char *commit_buffer = repo_logmsg_reencode(the_repository,\n> +               const char *commit_buffer = repo_logmsg_reencode(r,\n>                                                                  commit, NULL,\n>                                                                  encoding);\n>                 find_commit_subject(commit_buffer, &subject);\n>                 res |= write_message(subject, strlen(subject), buf.buf, 1);\n> -               repo_unuse_commit_buffer(the_repository, commit,\n> +               repo_unuse_commit_buffer(r, commit,\n>                                          commit_buffer);\n>         }\n>         strbuf_release(&buf);\n> @@ -3716,7 +3713,7 @@ static int do_label(struct repository *r, const char *name, int len)\n>         if (!transaction) {\n>                 error(\"%s\", err.buf);\n>                 ret = -1;\n> -       } else if (repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n> +       } else if (repo_get_oid(r, \"HEAD\", &head_oid)) {\n>                 error(_(\"could not read HEAD\"));\n>                 ret = -1;\n>         } else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,\n> @@ -4004,8 +4001,7 @@ static int do_merge(struct repository *r,\n>\n>         if (commit) {\n>                 const char *encoding = get_commit_output_encoding();\n> -               const char *message = repo_logmsg_reencode(the_repository,\n> -                                                          commit, NULL,\n> +               const char *message = repo_logmsg_reencode(r, commit, NULL,\n>                                                            encoding);\n>                 const char *body;\n>                 int len;\n> @@ -4019,7 +4015,7 @@ static int do_merge(struct repository *r,\n>                 find_commit_subject(message, &body);\n>                 len = strlen(body);\n>                 ret = write_message(body, len, git_path_merge_msg(r), 0);\n> -               repo_unuse_commit_buffer(the_repository, commit, message);\n> +               repo_unuse_commit_buffer(r, commit, message);\n>                 if (ret) {\n>                         error_errno(_(\"could not write '%s'\"),\n>                                     git_path_merge_msg(r));\n> @@ -4119,8 +4115,7 @@ static int do_merge(struct repository *r,\n>         }\n>\n>         merge_commit = to_merge->item;\n> -       bases = repo_get_merge_bases(the_repository, head_commit,\n> -                                    merge_commit);\n> +       bases = repo_get_merge_bases(r, head_commit, merge_commit);\n>         if (bases && oideq(&merge_commit->object.oid,\n>                            &bases->item->object.oid)) {\n>                 ret = 0;\n> @@ -4475,7 +4470,7 @@ void create_autostash(struct repository *r, const char *path)\n>                 if (capture_command(&stash, &buf, GIT_MAX_HEXSZ))\n>                         die(_(\"Cannot autostash\"));\n>                 strbuf_trim_trailing_newline(&buf);\n> -               if (repo_get_oid(the_repository, buf.buf, &oid))\n> +               if (repo_get_oid(r, buf.buf, &oid))\n>                         die(_(\"Unexpected stash response: '%s'\"),\n>                             buf.buf);\n>                 strbuf_reset(&buf);\n> @@ -4600,9 +4595,9 @@ static int stopped_at_head(struct repository *r)\n>         struct commit *commit;\n>         struct commit_message message;\n>\n> -       if (repo_get_oid(the_repository, \"HEAD\", &head) ||\n> +       if (repo_get_oid(r, \"HEAD\", &head) ||\n>             !(commit = lookup_commit(r, &head)) ||\n> -           repo_parse_commit(the_repository, commit) || get_message(commit, &message))\n> +           repo_parse_commit(r, commit) || get_message(commit, &message))\n>                 fprintf(stderr, _(\"Stopped at HEAD\\n\"));\n>         else {\n>                 fprintf(stderr, _(\"Stopped at %s\\n\"), message.label);\n> @@ -4750,7 +4745,7 @@ static int pick_commits(struct repository *r,\n>                                  * otherwise we do not.\n>                                  */\n>                                 if (item->command == TODO_REWORD &&\n> -                                   !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n> +                                   !repo_get_oid(r, \"HEAD\", &oid) &&\n>                                     (oideq(&item->commit->object.oid, &oid) ||\n>                                      (opts->have_squash_onto &&\n>                                       oideq(&opts->squash_onto, &oid))))\n> @@ -4839,7 +4834,7 @@ static int pick_commits(struct repository *r,\n>                         struct object_id head, orig;\n>                         int res;\n>\n> -                       if (repo_get_oid(the_repository, \"HEAD\", &head)) {\n> +                       if (repo_get_oid(r, \"HEAD\", &head)) {\n>                                 res = error(_(\"cannot read HEAD\"));\n>  cleanup_head_ref:\n>                                 strbuf_release(&head_ref);\n> @@ -4886,8 +4881,8 @@ static int pick_commits(struct repository *r,\n>                         log_tree_opt.disable_stdin = 1;\n>\n>                         if (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n> -                           !repo_get_oid(the_repository, buf.buf, &orig) &&\n> -                           !repo_get_oid(the_repository, \"HEAD\", &head)) {\n> +                           !repo_get_oid(r, buf.buf, &orig) &&\n> +                           !repo_get_oid(r, \"HEAD\", &head)) {\n>                                 diff_tree_oid(&orig, &head, \"\",\n>                                               &log_tree_opt.diffopt);\n>                                 log_tree_diff_flush(&log_tree_opt);\n> @@ -4979,7 +4974,7 @@ static int commit_staged_changes(struct repository *r,\n>                 struct strbuf rev = STRBUF_INIT;\n>                 struct object_id head, to_amend;\n>\n> -               if (repo_get_oid(the_repository, \"HEAD\", &head))\n> +               if (repo_get_oid(r, \"HEAD\", &head))\n>                         return error(_(\"cannot amend non-existing commit\"));\n>                 if (!read_oneliner(&rev, rebase_path_amend(), 0))\n>                         return error(_(\"invalid file: '%s'\"), rebase_path_amend());\n> @@ -5059,14 +5054,13 @@ static int commit_staged_changes(struct repository *r,\n>                                 const char *encoding = get_commit_output_encoding();\n>\n>                                 if (parse_head(r, &commit) ||\n> -                                   !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||\n> +                                   !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||\n>                                     write_message(p, strlen(p), path, 0)) {\n> -                                       repo_unuse_commit_buffer(the_repository,\n> -                                                                commit, p);\n> +                                       repo_unuse_commit_buffer(r, commit, p);\n>                                         return error(_(\"could not write file: \"\n>                                                        \"'%s'\"), path);\n>                                 }\n> -                               repo_unuse_commit_buffer(the_repository,\n> +                               repo_unuse_commit_buffer(r,\n>                                                          commit, p);\n>                         }\n>                 }\n> @@ -5206,7 +5200,7 @@ int sequencer_pick_revisions(struct repository *r,\n>                 if (!strlen(name))\n>                         continue;\n>\n> -               if (!repo_get_oid(the_repository, name, &oid)) {\n> +               if (!repo_get_oid(r, name, &oid)) {\n>                         if (!lookup_commit_reference_gently(r, &oid, 1)) {\n>                                 enum object_type type = oid_object_info(r,\n>                                                                         &oid,\n> @@ -5249,7 +5243,7 @@ int sequencer_pick_revisions(struct repository *r,\n>         if (walk_revs_populate_todo(&todo_list, opts) ||\n>                         create_seq_dir(r) < 0)\n>                 return -1;\n> -       if (repo_get_oid(the_repository, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n> +       if (repo_get_oid(r, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n>                 return error(_(\"can't revert as initial commit\"));\n>         if (save_head(oid_to_hex(&oid)))\n>                 return -1;\n> @@ -5944,7 +5938,7 @@ static int skip_unnecessary_picks(struct repository *r,\n>                         continue;\n>                 if (item->command != TODO_PICK)\n>                         break;\n> -               if (repo_parse_commit(the_repository, item->commit)) {\n> +               if (repo_parse_commit(r, item->commit)) {\n>                         return error(_(\"could not parse commit '%s'\"),\n>                                 oid_to_hex(&item->commit->object.oid));\n>                 }\n> @@ -6115,7 +6109,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla\n>         struct object_id oid = onto->object.oid;\n>         int res;\n>\n> -       repo_find_unique_abbrev_r(the_repository, shortonto, &oid,\n> +       repo_find_unique_abbrev_r(r, shortonto, &oid,\n>                                   DEFAULT_ABBREV);\n>\n>         if (buf->len == 0) {\n> @@ -6395,8 +6389,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)\n>                 if (file_exists(git_path_seq_dir()))\n>                         *whence = FROM_CHERRY_PICK_MULTI;\n>                 if (file_exists(rebase_path()) &&\n> -                   !repo_get_oid(the_repository, \"REBASE_HEAD\", &rebase_head) &&\n> -                   !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n> +                   !repo_get_oid(r, \"REBASE_HEAD\", &rebase_head) &&\n> +                   !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n>                     oideq(&rebase_head, &cherry_pick_head))\n>                         *whence = FROM_REBASE_PICK;\n>                 else\n> diff --git a/shallow.c b/shallow.c\n> index 07278467e47..fbafc4b30e9 100644\n> --- a/shallow.c\n> +++ b/shallow.c\n> @@ -30,7 +30,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)\n>  {\n>         struct commit_graft *graft =\n>                 xmalloc(sizeof(struct commit_graft));\n> -       struct commit *commit = lookup_commit(the_repository, oid);\n> +       struct commit *commit = lookup_commit(r, oid);\n>\n>         oidcpy(&graft->oid, oid);\n>         graft->nr_parent = -1;\n> diff --git a/tree.c b/tree.c\n> index 1b403c4b5ce..8643b734642 100644\n> --- a/tree.c\n> +++ b/tree.c\n> @@ -58,7 +58,7 @@ int read_tree_at(struct repository *r,\n>                                     oid_to_hex(&entry.oid),\n>                                     base->buf, entry.path);\n>\n> -                       if (repo_parse_commit(the_repository, commit))\n> +                       if (repo_parse_commit(r, commit))\n>                                 die(\"Invalid commit %s in submodule path %s%s\",\n>                                     oid_to_hex(&entry.oid),\n>                                     base->buf, entry.path);\n> diff --git a/wt-status.c b/wt-status.c\n> index dcd1d0cee4c..28e35a2165a 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -1664,7 +1664,7 @@ static void wt_status_get_detached_from(struct repository *r,\n>                 return;\n>         }\n>\n> -       if (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,\n> +       if (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref,\n>                           1) == 1 &&\n>             /* oid is a commit? match without further lookup */\n>             (oideq(&cb.noid, &oid) ||\n> @@ -1677,9 +1677,9 @@ static void wt_status_get_detached_from(struct repository *r,\n>                 state->detached_from = xstrdup(from);\n>         } else\n>                 state->detached_from =\n> -                       xstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));\n> +                       xstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV));\n>         oidcpy(&state->detached_oid, &cb.noid);\n> -       state->detached_at = !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n> +       state->detached_at = !repo_get_oid(r, \"HEAD\", &oid) &&\n>                              oideq(&oid, &state->detached_oid);\n>\n>         free(ref);\n> @@ -1770,13 +1770,13 @@ void wt_status_get_state(struct repository *r,\n>         } else if (wt_status_check_rebase(NULL, state)) {\n>                 ;               /* all set */\n>         } else if (refs_ref_exists(get_main_ref_store(r), \"CHERRY_PICK_HEAD\") &&\n> -                  !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &oid)) {\n> +                  !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &oid)) {\n>                 state->cherry_pick_in_progress = 1;\n>                 oidcpy(&state->cherry_pick_head_oid, &oid);\n>         }\n>         wt_status_check_bisect(NULL, state);\n>         if (refs_ref_exists(get_main_ref_store(r), \"REVERT_HEAD\") &&\n> -           !repo_get_oid(the_repository, \"REVERT_HEAD\", &oid)) {\n> +           !repo_get_oid(r, \"REVERT_HEAD\", &oid)) {\n>                 state->revert_in_progress = 1;\n>                 oidcpy(&state->revert_head_oid, &oid);\n>         }\n> --\n> 2.40.0.rc1.1034.g5867a1b10c5\n\nI started looking through it closely, but after a bit I realized that\nthe only kind of error you would likely to be make here would be the\nkind caught by the compiler, so then I started just skimming over it.\nBut I think that's safe for this kind of change.  I'm a big fan of\nthese kinds of cleanups and fixups, though.\n\nI'm not sure I can give a Reviewed-by since I just don't know cocci,\nbut it all looked pretty logical.  You definitely have my Acked-by on\nthe series, though.\n"},{"id":"473968","messageId":"kl6ledpge75s.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59404","inReplyTo":"patch-02.17-1b1fc5d41f5-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-03-22T22:46:23Z","receivedAt":"2023-03-22T22:46:37Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"\nEvery time I try to read cocci and spatch docs, I'm impressed at how\nimpenetrable they are ;) Nevertheless, I'd still like to understand how\nthe pattern works. I'll take a stab in the dark, and perhaps you can\ncorrect me.\n\nÆvar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n\n> +(\n> +- read_object_file\n> ++ repo_read_object_file\n> +|\n> +- has_object_file\n> ++ repo_has_object_file\n> +|\n> +- has_object_file_with_flags\n> ++ repo_has_object_file_with_flags\n> +|\n> +- parse_commit_internal\n> ++ repo_parse_commit_internal\n> +|\n> +- parse_commit\n> ++ repo_parse_commit\n> +|\n> +- get_merge_bases\n> ++ repo_get_merge_bases\n> +|\n> +- get_merge_bases_many\n> ++ repo_get_merge_bases_many\n> +|\n> +- get_merge_bases_many_dirty\n> ++ repo_get_merge_bases_many_dirty\n> +|\n> +- in_merge_bases\n> ++ repo_in_merge_bases\n> +|\n> +- in_merge_bases_many\n> ++ repo_in_merge_bases_many\n> +|\n> +- get_commit_buffer\n> ++ repo_get_commit_buffer\n> +|\n> +- unuse_commit_buffer\n> ++ repo_unuse_commit_buffer\n> +|\n> +- logmsg_reencode\n> ++ repo_logmsg_reencode\n> +|\n> +- format_commit_message\n> ++ repo_format_commit_message\n> +)\n\nI assume that `|` characters in parentheses are a logical OR, and each\nof the expressions checks for the `-` side in the original and replaces\nit with the `+` side.\n\n> +  (\n> ++ the_repository,\n> +  ...)\n\nThen this is another expression that matches literal `()` after the\nprevious expression? `+the_repository` adds `the_repository` right after\nthe opening `(`, then leaves the uninteresting `...` in place.\n\nIf so, I don't know how cocci/spatch tells the difference between\nliteral `()` vs an expression in the syntax (preceding whitespace?).\n\nEither way, as Elijah said, your plain explanation is clear enough that\nI feel comfortable with this.\n\n> -- \n> 2.40.0.rc1.1034.g5867a1b10c5\n"},{"id":"473969","messageId":"kl6lbkkke5p7.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59404","inReplyTo":"patch-05.17-36eae891341-20230317T152724Z-avarab@gmail.com","subject":"Re: [PATCH 05/17] cocci: apply the \"cache.h\" part of \"the_repository.pending\"","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-03-22T23:17:56Z","receivedAt":"2023-03-22T23:18:02Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"Ævar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n\n> Apply the part of \"the_repository.pending.cocci\" pertaining to\n> \"cache.h\".\n\nLike Elijah, I skimmed most of these \"apply cocci\" patches, since the\ncode correctness would be enfoced by the compiler anyway.\n\nFor reasonableness, I checked that each patch did the following...\n\n>  cache.h                                       | 15 ------\n\nRemove the macros/function definitions from the header file being\ntouched.\n\n>  contrib/coccinelle/the_repository.cocci       | 44 ++++++++++++++++\n\nAdd the relevant lines to contrib/coccinelle/the_repository.cocci\n\n>  .../coccinelle/the_repository.pending.cocci   | 37 --------------\n\nRemove the relevant lines from\ncontrib/coccinelle/the_repository.pending.cocci.\n\nAnd all the patches did this, so the patch organization looks good :)\n"},{"id":"473971","messageId":"kl6l8rfoe4qr.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59404","inReplyTo":"patch-15.17-c8ff241844a-20230317T152725Z-avarab@gmail.com","subject":"Re: [PATCH 15/17] cocci: apply the \"revision.h\" part of \"the_repository.pending\"","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-03-22T23:38:36Z","receivedAt":"2023-03-22T23:38:41Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"Ævar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n\n> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n> deleted file mode 100644\n> index 1190a3312bd..00000000000\n> --- a/contrib/coccinelle/the_repository.pending.cocci\n> +++ /dev/null\n> @@ -1,14 +0,0 @@\n> -// This file is used for the ongoing refactoring of\n> -// bringing the index or repository struct in all of\n> -// our code base.\n\nNow that we've deleted this file, I wanted to get a sense of where this\nseries lands us in the the_repository migration. ISTR that we'd consider\nourselves \"done\" when we stop referencing \"the_repository\" in\nnon-builtins, so presumably we aren't there yet ;)\n\nInspecting all of the \".h\" files, we can see that the only remaining\nfunction/macro of this sort is \"the_hash_algo\". Because you expanded the\nsearch to cover cases not in \"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\",\nyou've actually achieved more than what your CL says. Hooray!\n\nWe can't go so far as to say that we've removed all implicit references\nto \"the_repository\", though, since we still have functions that\nreference \"the_repository\" in their implementations. But, I don't think\nthis \".cocci\" file would help us with those cases anyway, since this was\ntargeted specifically at functions/macros that were passing\n\"the_repository\" to functions that accepted a \"struct repository\" arg.\n\nThanks for the cleanup, this is great!\n"},{"id":"473972","messageId":"kl6l5yase416.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59404","inReplyTo":"kl6l8rfoe4qr.fsf@chooglen-macbookpro.roam.corp.google.com","subject":"Re: [PATCH 15/17] cocci: apply the \"revision.h\" part of \"the_repository.pending\"","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-03-22T23:53:57Z","receivedAt":"2023-03-22T23:54:03Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"Glen Choo <chooglen@google.com> writes:\n\n> Ævar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n>\n>> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n>> deleted file mode 100644\n>> index 1190a3312bd..00000000000\n>> --- a/contrib/coccinelle/the_repository.pending.cocci\n>> +++ /dev/null\n>> @@ -1,14 +0,0 @@\n>> -// This file is used for the ongoing refactoring of\n>> -// bringing the index or repository struct in all of\n>> -// our code base.\n> We can't go so far as to say that we've removed all implicit references\n> to \"the_repository\", though, since we still have functions that\n> reference \"the_repository\" in their implementations. But, I don't think\n> this \".cocci\" file would help us with those cases anyway, since this was\n> targeted specifically at functions/macros that were passing\n> \"the_repository\" to functions that accepted a \"struct repository\" arg.\n\nFor these implicitly-the_repository functions, (e.g. git_path) we'd\npresumably refactor them into repo_* versions and then apply the same\nsorts of changes we did in this series? I guess we'd make those changes\nin contrib/coccinelle/the_repository.cocci, so we don't need the\n*.pending* one.\n\nOn that note, I'm curious what contrib/coccinelle/the_repository.cocci\nis doing for us after this series. By definition, all of the macros have\nbeen fully migrated, so they're all a noop. Would this slow down `make\ncoccicheck`?\n"},{"id":"474186","messageId":"230326.86ileow1fu.gmgdl@evledraar.gmail.com","threadId":"59404","inReplyTo":"kl6l5yase416.fsf@chooglen-macbookpro.roam.corp.google.com","subject":"Re: [PATCH 15/17] cocci: apply the \"revision.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-26T04:59:46Z","receivedAt":"2023-03-26T05:01:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Mar 22 2023, Glen Choo wrote:\n\n> Glen Choo <chooglen@google.com> writes:\n>\n>> Ævar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n>>\n>>> diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\n>>> deleted file mode 100644\n>>> index 1190a3312bd..00000000000\n>>> --- a/contrib/coccinelle/the_repository.pending.cocci\n>>> +++ /dev/null\n>>> @@ -1,14 +0,0 @@\n>>> -// This file is used for the ongoing refactoring of\n>>> -// bringing the index or repository struct in all of\n>>> -// our code base.\n>> We can't go so far as to say that we've removed all implicit references\n>> to \"the_repository\", though, since we still have functions that\n>> reference \"the_repository\" in their implementations. But, I don't think\n>> this \".cocci\" file would help us with those cases anyway, since this was\n>> targeted specifically at functions/macros that were passing\n>> \"the_repository\" to functions that accepted a \"struct repository\" arg.\n>\n> For these implicitly-the_repository functions, (e.g. git_path) we'd\n> presumably refactor them into repo_* versions and then apply the same\n> sorts of changes we did in this series? I guess we'd make those changes\n> in contrib/coccinelle/the_repository.cocci, so we don't need the\n> *.pending* one.\n\nWhether we add it to a \"pending\" or not is just a question of whether\nthe migration is done right away, or left for later.\n\n> On that note, I'm curious what contrib/coccinelle/the_repository.cocci\n> is doing for us after this series. By definition, all of the macros have\n> been fully migrated, so they're all a noop.\n\nI left them for the benefit of any in-flight conflicts, or semantic\nconflicts with out-of-tree.\n\nI.e. in such a case you'd keep the other side, then apply the cocci\nrule, and the result is a semantically correct merge of the two.\n\n> Would this slow down `make coccicheck`?\n\nA bit. It doesn't slow it down by much, as these rules are the simplest\nto execute, spatch can skip the file if the relevant tokens aren't found\nin it.\n"},{"id":"474187","messageId":"230326.86edpcw0yh.gmgdl@evledraar.gmail.com","threadId":"59404","inReplyTo":"kl6ledpge75s.fsf@chooglen-macbookpro.roam.corp.google.com","subject":"Re: [PATCH 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-26T05:02:55Z","receivedAt":"2023-03-26T05:12:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Mar 22 2023, Glen Choo wrote:\n\n> Every time I try to read cocci and spatch docs, I'm impressed at how\n> impenetrable they are ;)\n\nFWIW you should ignore the manpage, which and instead read the\n\"Coccinelle User’s manual\", and particularly \"The SmPL Grammar\", both of\nwhich are available as PDFs on their website.\n\nBut their docs are rather terse, and sometimes even incomplete. I've\noften resorted to grepping their own test cases to figure out how\nsomething works.\n\n> Nevertheless, I'd still like to understand how\n> the pattern works. I'll take a stab in the dark, and perhaps you can\n> correct me.\n>\n> Ævar Arnfjörð Bjarmason         <avarab@gmail.com> writes:\n>\n>> +(\n>> +- read_object_file\n>> ++ repo_read_object_file\n>> +|\n>> +- has_object_file\n>> ++ repo_has_object_file\n>> +|\n>> +- has_object_file_with_flags\n>> ++ repo_has_object_file_with_flags\n>> +|\n>> +- parse_commit_internal\n>> ++ repo_parse_commit_internal\n>> +|\n>> +- parse_commit\n>> ++ repo_parse_commit\n>> +|\n>> +- get_merge_bases\n>> ++ repo_get_merge_bases\n>> +|\n>> +- get_merge_bases_many\n>> ++ repo_get_merge_bases_many\n>> +|\n>> +- get_merge_bases_many_dirty\n>> ++ repo_get_merge_bases_many_dirty\n>> +|\n>> +- in_merge_bases\n>> ++ repo_in_merge_bases\n>> +|\n>> +- in_merge_bases_many\n>> ++ repo_in_merge_bases_many\n>> +|\n>> +- get_commit_buffer\n>> ++ repo_get_commit_buffer\n>> +|\n>> +- unuse_commit_buffer\n>> ++ repo_unuse_commit_buffer\n>> +|\n>> +- logmsg_reencode\n>> ++ repo_logmsg_reencode\n>> +|\n>> +- format_commit_message\n>> ++ repo_format_commit_message\n>> +)\n>\n> I assume that `|` characters in parentheses are a logical OR, and each\n> of the expressions checks for the `-` side in the original and replaces\n> it with the `+` side.\n\nYes, just a simple \"replace A with B\".\n\n>> +  (\n>> ++ the_repository,\n>> +  ...)\n>\n> Then this is another expression that matches literal `()` after the\n> previous expression? `+the_repository` adds `the_repository` right after\n> the opening `(`, then leaves the uninteresting `...` in place.\n>\n> If so, I don't know how cocci/spatch tells the difference between\n> literal `()` vs an expression in the syntax (preceding whitespace?).\n\nYes, whitespace is significant in the coccinelle syntax, generally its\nown \"()\" grouping goes at the beginning of a line, wheras you indent\nprogram text in the \"diff\" with whitespace.\n\nE.g. our equals-null.cocci has two rules that use \"(\" and \")\" in a way\nthat would be ambiguous if this whitespace-disambiguation weren't being\nused.\n"},{"id":"474272","messageId":"230328.86a5zxw31u.gmgdl@evledraar.gmail.com","threadId":"59404","inReplyTo":"CABPp-BEdpTO=DRjLq_p+dgX68M0HUVB--3yQR4Sdp8rnFYeyfA@mail.gmail.com","subject":"Re: [PATCH 17/17] libs: use \"struct repository *\" argument, not \"the_repository\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T10:53:24Z","receivedAt":"2023-03-28T11:03:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Mar 18 2023, Elijah Newren wrote:\n\n> On Fri, Mar 17, 2023 at 8:55 AM Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n>>\n>> As can easily be seen from grepping in our sources, we had these uses\n>> of \"the_repository\" in various library code in cases where the\n>> function in question was already getting a \"struct repository *\"\n>> argument. Let's use that argument instead.\n>>\n>> Out of these changes only the changes to \"cache-tree.c\",\n>> \"commit-reach.c\", \"shallow.c\" and \"upload-pack.c\" would have cleanly\n>> applied before the migration away from the \"repo_*()\" wrapper macros\n>> in the preceding commits.\n>>\n>> The rest aren't new, as we'd previously implicitly refer to\n>> \"the_repository\", but it's now more obvious that we were doing the\n>> wrong thing all along, and should have used the parameter instead.\n>\n> YES!  I love seeing fixes like this.  I noticed some a while back in\n> the merge code, and had some patches somewhere that I think I never\n> got around to submitting, but which have been in the back of my mind\n> bugging me.  Nice to see lots of these kinds of cases getting fixed.\n\nYeah, it will be nice to fix those...\n\n>> The change to change \"get_index_format_default(the_repository)\" in\n>> \"read-cache.c\" to use the \"r\" variable instead should arguably have\n>> been part of [1], or in the subsequent cleanup in [2]. Let's do it\n>> here, as can be seen from the initial code in [3] it's not important\n>> that we use \"the_repository\" there, but would prefer to always use the\n>> current repository.\n>>\n>> This change excludes the \"the_repository\" use in \"upload-pack.c\"'s\n>> upload_pack_advertise(), as the in-flight [4] makes that change.\n>>\n>> 1. ee1f0c242ef (read-cache: add index.skipHash config option,\n>>    2023-01-06)\n>> 2. 6269f8eaad0 (treewide: always have a valid \"index_state.repo\"\n>>    member, 2023-01-17)\n>> 3. 7211b9e7534 (repo-settings: consolidate some config settings,\n>>    2019-08-13)\n>> 4. <Y/hbUsGPVNAxTdmS@coredump.intra.peff.net>\n>>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>>  add-interactive.c |   2 +-\n>>  branch.c          |   8 ++--\n>>  builtin/replace.c |   2 +-\n>>  cache-tree.c      |   4 +-\n>>  combine-diff.c    |   2 +-\n>>  commit-graph.c    |   2 +-\n>>  commit-reach.c    |   2 +-\n>>  merge-recursive.c |   2 +-\n>\n> Doh, doesn't fix up the ones I had.  I don't remember the exact issue\n> and can't find the patches right now, but looking around a little I\n> see a write_object_file() which should be a repo_write_object_file(),\n> but it's in a function that doesn't take a repository argument.\n> However, the caller has access to a repository argument, in the form\n> of opt->repo, so we've got some low-hanging fruit that could be fixed\n> up.  Doesn't need to be part of your series, but it's nice that your\n> series has done some of the groundwork to make these issues more\n> obvious.\n\n...yeah, I do have a WIP follow-up based on this topic which addresses\nthe sort of issues you're rasing here, i.e. in many cases we have\n\"the_repository\", no \"struct repository *\" function argument, but we\nhave a \"x->repo\", where \"x\" is the \"struct\" state object we have in play\nin that API.\n\nMy messy WIP follow-up for starting to fix those is at :\nhttps://github.com/avar/git/compare/6f86a34bf8b...2072d685a56\n\nI didn't get to the merge/object code you mentioned, but we should do\nthese sorts of changes as a follow-up.\n\nI didn't do them as part of this topic, because this series was already\nquite long, and this 17/17 is arguably scope-creep, but I could argue\nfor it on the basis of it being almost entirely a post-cleanup for the\npreceding changes.\n\n> [...]\n> I started looking through it closely, but after a bit I realized that\n> the only kind of error you would likely to be make here would be the\n> kind caught by the compiler, so then I started just skimming over it.\n> But I think that's safe for this kind of change.  I'm a big fan of\n> these kinds of cleanups and fixups, though.\n>\n> I'm not sure I can give a Reviewed-by since I just don't know cocci,\n> but it all looked pretty logical.  You definitely have my Acked-by on\n> the series, though.\n\nI won't add your Reviewed-by to a re-roll given that caveat, but FWIW I\nthink in general those not familiar with cocci should be comfortable\nreviewing topics that modify code using the tool.\n\nEven if you don't grok the patch lanugage, you can review the resulting\ndiff, as you've done here.\n\nI think the exception to that is if the change itself is proposing to\ninstitute a new cocci rule, that we can expect to apply going\nforward. In those cases really understanding the rule matters, e.g. the\ncontrib/coccinelle/unused.cocci rule I added relatively recently is one\nsuch example.\n\nBut here the rules are just a one-off, and are just an aid to reproduce\nthe changes.\n"},{"id":"474282","messageId":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com","subject":"[PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:41Z","receivedAt":"2023-03-28T13:59:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"A v2 of the removal of \"the_repository\" wrapper macros and adjacent\ncleanups. The v1 subject for this said \"the_index\", sorry!\n\nSee v1 [1] for a more general overview. The changes since v1 are\ntrivial & best skimmed from the range-diff, just a rebasing,\nclarification in a commit message, and a typo fix, thanks all!\n\nAs before this has a trivial conflict with \"seen\", but this time\naround the conflict is different, but it's trivially solved as before,\nthe remerge-diff was:\n\t\n\tdiff --git a/cache.h b/cache.h\n\tremerge CONFLICT (content): Merge conflict in cache.h\n\tindex 25e002c488b..82d7b112b4e 100644\n\t--- a/cache.h\n\t+++ b/cache.h\n\t@@ -711,31 +711,6 @@ extern int quote_path_fully;\n\t  */\n\t const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);\n\t int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n\t-<<<<<<< 9f4013b4b9d (libs: use \"struct repository *\" argument, not \"the_repository\")\n\t-\n\t-/* set default permissions by passing mode arguments to open(2) */\n\t-int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n\t-int git_mkstemp_mode(char *pattern, int mode);\n\t-\n\t-/*\n\t- * NOTE NOTE NOTE!!\n\t- *\n\t- * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must\n\t- * not be changed. Old repositories have core.sharedrepository written in\n\t- * numeric format, and therefore these values are preserved for compatibility\n\t- * reasons.\n\t- */\n\t-enum sharedrepo {\n\t-\tPERM_UMASK          = 0,\n\t-\tOLD_PERM_GROUP      = 1,\n\t-\tOLD_PERM_EVERYBODY  = 2,\n\t-\tPERM_GROUP          = 0660,\n\t-\tPERM_EVERYBODY      = 0664\n\t-};\n\t-int git_config_perm(const char *var, const char *value);\n\t-int adjust_shared_perm(const char *path);\n\t-=======\n\t->>>>>>> 2bb680d6bbd (Merge branch 'kh/commentchar-config-error-message' into seen)\n\t \n\t /*\n\t  * Create the directory containing the named path, using care to be\n\t@@ -925,11 +900,6 @@ int repo_interpret_branch_name(struct repository *r,\n\t \t\t\t       const char *str, int len,\n\t \t\t\t       struct strbuf *buf,\n\t \t\t\t       const struct interpret_branch_name_options *options);\n\t-<<<<<<< 9f4013b4b9d (libs: use \"struct repository *\" argument, not \"the_repository\")\n\t-\n\t-int validate_headref(const char *ref);\n\t-=======\n\t->>>>>>> 2bb680d6bbd (Merge branch 'kh/commentchar-config-error-message' into seen)\n\t \n\t int base_name_compare(const char *name1, size_t len1, int mode1,\n\t \t\t      const char *name2, size_t len2, int mode2);\nBranch & CI for this at:\nhttps://github.com/avar/git/tree/avar/cocci-the-repository-from-pending-2\n\n1. https://lore.kernel.org/git/cover-00.17-00000000000-20230317T152724Z-avarab@gmail.com/\n\nÆvar Arnfjörð Bjarmason (17):\n  cocci: remove dead rule from \"the_repository.pending.cocci\"\n  cocci: fix incorrect & verbose \"the_repository\" rules\n  cocci: sort \"the_repository\" rules by header\n  cocci: add missing \"the_repository\" macros to \"pending\"\n  cocci: apply the \"cache.h\" part of \"the_repository.pending\"\n  cocci: apply the \"commit-reach.h\" part of \"the_repository.pending\"\n  cocci: apply the \"commit.h\" part of \"the_repository.pending\"\n  cocci: apply the \"diff.h\" part of \"the_repository.pending\"\n  cocci: apply the \"object-store.h\" part of \"the_repository.pending\"\n  cocci: apply the \"pretty.h\" part of \"the_repository.pending\"\n  cocci: apply the \"packfile.h\" part of \"the_repository.pending\"\n  cocci: apply the \"promisor-remote.h\" part of \"the_repository.pending\"\n  cocci: apply the \"refs.h\" part of \"the_repository.pending\"\n  cocci: apply the \"rerere.h\" part of \"the_repository.pending\"\n  cocci: apply the \"revision.h\" part of \"the_repository.pending\"\n  post-cocci: adjust comments for recent repo_* migration\n  libs: use \"struct repository *\" argument, not \"the_repository\"\n\n add-interactive.c                             |   2 +-\n add-patch.c                                   |   2 +-\n apply.c                                       |  13 +-\n archive.c                                     |  12 +-\n bisect.c                                      |  11 +-\n blame.c                                       |  15 +-\n branch.c                                      |   7 +-\n builtin/am.c                                  |  23 +--\n builtin/bisect.c                              |  33 ++--\n builtin/blame.c                               |  15 +-\n builtin/branch.c                              |   9 +-\n builtin/cat-file.c                            |  25 +--\n builtin/checkout.c                            |  35 ++--\n builtin/clone.c                               |   6 +-\n builtin/commit-tree.c                         |   4 +-\n builtin/commit.c                              |  29 ++--\n builtin/describe.c                            |   9 +-\n builtin/diff.c                                |   3 +-\n builtin/difftool.c                            |   3 +-\n builtin/fast-export.c                         |  12 +-\n builtin/fast-import.c                         |  17 +-\n builtin/fetch.c                               |  21 +--\n builtin/fsck.c                                |   2 +-\n builtin/gc.c                                  |   8 +-\n builtin/grep.c                                |   6 +-\n builtin/index-pack.c                          |  11 +-\n builtin/log.c                                 |  30 ++--\n builtin/ls-files.c                            |   4 +-\n builtin/ls-tree.c                             |   9 +-\n builtin/merge-base.c                          |   9 +-\n builtin/merge-recursive.c                     |   6 +-\n builtin/merge-tree.c                          |  18 ++-\n builtin/merge.c                               |  23 +--\n builtin/mktag.c                               |   3 +-\n builtin/name-rev.c                            |  11 +-\n builtin/notes.c                               |  34 ++--\n builtin/pack-objects.c                        |  24 ++-\n builtin/prune.c                               |   2 +-\n builtin/pull.c                                |   4 +-\n builtin/range-diff.c                          |  12 +-\n builtin/read-tree.c                           |   2 +-\n builtin/rebase.c                              |  21 +--\n builtin/receive-pack.c                        |  14 +-\n builtin/remote.c                              |   2 +-\n builtin/repack.c                              |   2 +-\n builtin/replace.c                             |  20 +--\n builtin/reset.c                               |  22 +--\n builtin/rev-list.c                            |   2 +-\n builtin/rev-parse.c                           |  18 ++-\n builtin/rm.c                                  |   2 +-\n builtin/shortlog.c                            |  13 +-\n builtin/show-branch.c                         |  19 +--\n builtin/show-ref.c                            |   6 +-\n builtin/sparse-checkout.c                     |   2 +-\n builtin/stash.c                               |  26 +--\n builtin/submodule--helper.c                   |   6 +-\n builtin/tag.c                                 |  10 +-\n builtin/unpack-file.c                         |   4 +-\n builtin/unpack-objects.c                      |   5 +-\n builtin/update-ref.c                          |   8 +-\n builtin/verify-commit.c                       |   2 +-\n builtin/verify-tag.c                          |   2 +-\n builtin/worktree.c                            |   8 +-\n bulk-checkin.c                                |   2 +-\n bundle.c                                      |   5 +-\n cache-tree.c                                  |  16 +-\n cache.h                                       |  19 +--\n checkout.c                                    |   2 +-\n combine-diff.c                                |   8 +-\n commit-graph.c                                |   4 +-\n commit-reach.c                                |  21 +--\n commit-reach.h                                |   9 --\n commit.c                                      |  44 ++---\n commit.h                                      |  22 +--\n connected.c                                   |   4 +-\n contrib/coccinelle/the_repository.cocci       | 123 ++++++++++++++\n .../coccinelle/the_repository.pending.cocci   | 128 ---------------\n delta-islands.c                               |   5 +-\n diff-lib.c                                    |   2 +-\n diff.c                                        |   6 +-\n diff.h                                        |   5 +-\n diffcore-break.c                              |   2 +-\n diffcore-rename.c                             |   4 +-\n dir.c                                         |   2 +-\n entry.c                                       |   3 +-\n fetch-pack.c                                  |   8 +-\n fmt-merge-msg.c                               |  15 +-\n fsck.c                                        |   6 +-\n http-push.c                                   |  16 +-\n http-walker.c                                 |   4 +-\n list-objects-filter-options.c                 |   7 +-\n list-objects.c                                |  20 ++-\n log-tree.c                                    |  28 ++--\n mailmap.c                                     |   4 +-\n match-trees.c                                 |   4 +-\n merge-blobs.c                                 |   6 +-\n merge-ort.c                                   |   6 +-\n merge-recursive.c                             |   9 +-\n negotiator/default.c                          |   6 +-\n negotiator/skipping.c                         |   2 +-\n notes-cache.c                                 |   5 +-\n notes-merge.c                                 |  11 +-\n notes-utils.c                                 |   2 +-\n notes.c                                       |  18 ++-\n object-file.c                                 |   4 +-\n object-name.c                                 |  19 ++-\n object-store.h                                |  11 +-\n pack-bitmap-write.c                           |   3 +-\n packfile.c                                    |   2 +-\n packfile.h                                    |   1 -\n parse-options-cb.c                            |   8 +-\n pretty.c                                      |  10 +-\n pretty.h                                      |   4 -\n promisor-remote.h                             |  15 --\n range-diff.c                                  |  12 +-\n read-cache.c                                  |   9 +-\n rebase-interactive.c                          |   2 +-\n ref-filter.c                                  |   8 +-\n reflog.c                                      |   7 +-\n refs.c                                        |   2 +-\n refs.h                                        |   6 -\n remote.c                                      |  15 +-\n rerere.c                                      |   5 +-\n rerere.h                                      |   3 -\n reset.c                                       |   4 +-\n revision.c                                    |  27 ++--\n revision.h                                    |   3 -\n send-pack.c                                   |   6 +-\n sequencer.c                                   | 150 ++++++++++--------\n shallow.c                                     |  21 +--\n strbuf.h                                      |   6 +-\n submodule-config.c                            |   5 +-\n submodule.c                                   |   8 +-\n t/helper/test-fast-rebase.c                   |  19 ++-\n t/helper/test-match-trees.c                   |   4 +-\n t/helper/test-oidmap.c                        |   6 +-\n t/helper/test-reach.c                         |  12 +-\n t/helper/test-revision-walking.c              |   3 +-\n t/helper/test-submodule-config.c              |   2 +-\n tag.c                                         |   9 +-\n transport-helper.c                            |   2 +-\n transport.c                                   |   3 +-\n tree.c                                        |   5 +-\n unpack-trees.c                                |   2 +-\n upload-pack.c                                 |   8 +-\n walker.c                                      |   6 +-\n wt-status.c                                   |  21 +--\n xdiff-interface.c                             |   2 +-\n 148 files changed, 958 insertions(+), 873 deletions(-)\n create mode 100644 contrib/coccinelle/the_repository.cocci\n delete mode 100644 contrib/coccinelle/the_repository.pending.cocci\n\nRange-diff against v1:\n 1:  c167bde3c0c !  1:  e1e27490d60 cocci: remove dead rule from \"the_repository.pending.cocci\"\n    @@ Commit message\n         cocci: remove dead rule from \"the_repository.pending.cocci\"\n     \n         The \"parse_commit_gently\" macro went away in [1], so we don't need to\n    -    carry his for its migration.\n    +    carry this for its migration.\n     \n         1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n            commits, 2020-06-23)\n 2:  1b1fc5d41f5 =  2:  5ac9d5b8905 cocci: fix incorrect & verbose \"the_repository\" rules\n 3:  34c6b8afd6c !  3:  a3fcd19d744 cocci: sort \"the_repository\" rules by header\n    @@ Commit message\n         rules. This will make subsequent commits easier to follow, as we'll be\n         applying these rules on a header-by-header basis.\n     \n    +    Once we've fully applied \"the_repository.pending.cocci\" we'll keep\n    +    this rules around for a while in \"the_repository.cocci\", to help any\n    +    outstanding topics and out-of-tree code to resolve textual or semantic\n    +    conflicts with these changes, but eventually we'll remove the\n    +    \"the_repository.cocci\" as a follow-up.\n    +\n    +    So even if some of these functions are subsequently moved and/or split\n    +    into other or new headers there's no risk of this becoming stale, if\n    +    and when that happens the we should be removing these rules anyway.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## contrib/coccinelle/the_repository.pending.cocci ##\n 4:  4b62e9a35a9 =  4:  af8bdc2adec cocci: add missing \"the_repository\" macros to \"pending\"\n 5:  36eae891341 !  5:  3e721fa5db0 cocci: apply the \"cache.h\" part of \"the_repository.pending\"\n    @@ cache.h: void *read_object_with_reference(struct repository *r,\n     -#define peel_to_type(name, namelen, obj, type) \\\n     -\trepo_peel_to_type(the_repository, name, namelen, obj, type)\n      \n    - #define IDENT_STRICT\t       1\n    - #define IDENT_NO_DATE\t       2\n    + const char *git_editor(void);\n    + const char *git_sequence_editor(void);\n     \n      ## checkout.c ##\n     @@ checkout.c: static int check_tracking_name(struct remote *remote, void *cb_data)\n 6:  b06ea9861fd =  6:  0f24a57b50b cocci: apply the \"commit-reach.h\" part of \"the_repository.pending\"\n 7:  2e9cf3ca378 !  7:  7d64ace3551 cocci: apply the \"commit.h\" part of \"the_repository.pending\"\n    @@ commit.h: void repo_unuse_commit_buffer(struct repository *r,\n      \n      /*\n     @@ commit.h: void free_commit_list(struct commit_list *list);\n    + \n      struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n      \n    - int has_non_ascii(const char *text);\n     -const char *logmsg_reencode(const struct commit *commit,\n     -\t\t\t    char **commit_encoding,\n     -\t\t\t    const char *output_encoding);\n 8:  6c5f4861471 =  8:  f442e7b9acc cocci: apply the \"diff.h\" part of \"the_repository.pending\"\n 9:  893684f135b =  9:  1866d473f1b cocci: apply the \"object-store.h\" part of \"the_repository.pending\"\n10:  c4bf81a2892 = 10:  10e05c56231 cocci: apply the \"pretty.h\" part of \"the_repository.pending\"\n11:  8cfc1c18878 = 11:  13955394126 cocci: apply the \"packfile.h\" part of \"the_repository.pending\"\n12:  abd237009f9 = 12:  8336b0321a8 cocci: apply the \"promisor-remote.h\" part of \"the_repository.pending\"\n13:  aae743233ab = 13:  a08d7f8eccf cocci: apply the \"refs.h\" part of \"the_repository.pending\"\n14:  fb281b1ecdd = 14:  3d59dfe4186 cocci: apply the \"rerere.h\" part of \"the_repository.pending\"\n15:  c8ff241844a = 15:  b7561c87ba5 cocci: apply the \"revision.h\" part of \"the_repository.pending\"\n16:  86e24add191 = 16:  f947bb69dee post-cocci: adjust comments for recent repo_* migration\n17:  6f86a34bf8b = 17:  9f4013b4b9d libs: use \"struct repository *\" argument, not \"the_repository\"\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474281","messageId":"patch-v2-01.17-e1e27490d60-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 01/17] cocci: remove dead rule from \"the_repository.pending.cocci\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:42Z","receivedAt":"2023-03-28T13:59:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The \"parse_commit_gently\" macro went away in [1], so we don't need to\ncarry this for its migration.\n\n1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n   commits, 2020-06-23)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/coccinelle/the_repository.pending.cocci | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 747d382ff5f..23b97536da5 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -34,14 +34,6 @@ expression G;\n + repo_parse_commit_internal(the_repository,\n   E, F, G)\n \n-@@\n-expression E;\n-expression F;\n-@@\n-- parse_commit_gently(\n-+ repo_parse_commit_gently(the_repository,\n-  E, F)\n-\n @@\n expression E;\n @@\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474283","messageId":"patch-v2-02.17-5ac9d5b8905-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:43Z","receivedAt":"2023-03-28T13:59:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"When these rules started being added in [1] they didn't use a \";\"\nafter the \")\", and would thus catch uses of these macros within\nexpressions. But as of [2] the new additions were broken in that\nthey'd only match a subset of the users of these macros.\n\nRather than narrowly fixing that, let's have these use the much less\nverbose pattern introduced in my recent [3]: There's no need to\nexhaustively enumerate arguments if we use the \"...\" syntax. This\nmeans that we can fold all of these different rules into one.\n\n1. afd69dcc219 (object-store: prepare read_object_file to deal with\n   any repo, 2018-11-13)\n2. 21a9651ba3f (commit-reach: prepare get_merge_bases to handle any\n   repo, 2018-11-13)\n3. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,\n   2022-11-19)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 160 +++++-------------\n 1 file changed, 46 insertions(+), 114 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 23b97536da5..99e192736ee 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -3,118 +3,50 @@\n // our code base.\n \n @@\n-expression E;\n-expression F;\n-expression G;\n @@\n-- read_object_file(\n-+ repo_read_object_file(the_repository,\n-  E, F, G)\n-\n-@@\n-expression E;\n-@@\n-- has_object_file(\n-+ repo_has_object_file(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-@@\n-- has_object_file_with_flags(\n-+ repo_has_object_file_with_flags(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- parse_commit_internal(\n-+ repo_parse_commit_internal(the_repository,\n-  E, F, G)\n-\n-@@\n-expression E;\n-@@\n-- parse_commit(\n-+ repo_parse_commit(the_repository,\n-  E)\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- get_merge_bases(\n-+ repo_get_merge_bases(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- get_merge_bases_many(\n-+ repo_get_merge_bases_many(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- get_merge_bases_many_dirty(\n-+ repo_get_merge_bases_many_dirty(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- in_merge_bases(\n-+ repo_in_merge_bases(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- in_merge_bases_many(\n-+ repo_in_merge_bases_many(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- get_commit_buffer(\n-+ repo_get_commit_buffer(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-@@\n-- unuse_commit_buffer(\n-+ repo_unuse_commit_buffer(the_repository,\n-  E, F);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-@@\n-- logmsg_reencode(\n-+ repo_logmsg_reencode(the_repository,\n-  E, F, G);\n-\n-@@\n-expression E;\n-expression F;\n-expression G;\n-expression H;\n-@@\n-- format_commit_message(\n-+ repo_format_commit_message(the_repository,\n-  E, F, G, H);\n+(\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n+|\n+- get_merge_bases\n++ repo_get_merge_bases\n+|\n+- get_merge_bases_many\n++ repo_get_merge_bases_many\n+|\n+- get_merge_bases_many_dirty\n++ repo_get_merge_bases_many_dirty\n+|\n+- in_merge_bases\n++ repo_in_merge_bases\n+|\n+- in_merge_bases_many\n++ repo_in_merge_bases_many\n+|\n+- get_commit_buffer\n++ repo_get_commit_buffer\n+|\n+- unuse_commit_buffer\n++ repo_unuse_commit_buffer\n+|\n+- logmsg_reencode\n++ repo_logmsg_reencode\n+|\n+- format_commit_message\n++ repo_format_commit_message\n+)\n+  (\n++ the_repository,\n+  ...)\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474284","messageId":"patch-v2-03.17-a3fcd19d744-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 03/17] cocci: sort \"the_repository\" rules by header","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:44Z","receivedAt":"2023-03-28T13:59:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Sort the \"the_repository.pending.cocci\" file by which header the\nmacros are in, and add a comment to that effect in front of the\nrules. This will make subsequent commits easier to follow, as we'll be\napplying these rules on a header-by-header basis.\n\nOnce we've fully applied \"the_repository.pending.cocci\" we'll keep\nthis rules around for a while in \"the_repository.cocci\", to help any\noutstanding topics and out-of-tree code to resolve textual or semantic\nconflicts with these changes, but eventually we'll remove the\n\"the_repository.cocci\" as a follow-up.\n\nSo even if some of these functions are subsequently moved and/or split\ninto other or new headers there's no risk of this becoming stale, if\nand when that happens the we should be removing these rules anyway.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 34 +++++++++++--------\n 1 file changed, 19 insertions(+), 15 deletions(-)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 99e192736ee..84b79dce480 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,21 +5,7 @@\n @@\n @@\n (\n-- read_object_file\n-+ repo_read_object_file\n-|\n-- has_object_file\n-+ repo_has_object_file\n-|\n-- has_object_file_with_flags\n-+ repo_has_object_file_with_flags\n-|\n-- parse_commit_internal\n-+ repo_parse_commit_internal\n-|\n-- parse_commit\n-+ repo_parse_commit\n-|\n+// commit-reach.h\n - get_merge_bases\n + repo_get_merge_bases\n |\n@@ -34,6 +20,13 @@\n |\n - in_merge_bases_many\n + repo_in_merge_bases_many\n+// commit.h\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n |\n - get_commit_buffer\n + repo_get_commit_buffer\n@@ -43,6 +36,17 @@\n |\n - logmsg_reencode\n + repo_logmsg_reencode\n+// object-store.h\n+|\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n+// pretty.h\n |\n - format_commit_message\n + repo_format_commit_message\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474285","messageId":"patch-v2-04.17-af8bdc2adec-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 04/17] cocci: add missing \"the_repository\" macros to \"pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:45Z","receivedAt":"2023-03-28T13:59:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In the case of diff.h, rerere.h and revision.h the macros were added\nin [1], [2] and [3] when \"the_repository.pending.cocci\" didn't\nexist. None of the subsequently added migration rules covered\nthem. Let's add those missing rules.\n\nIn the case of macros in \"cache.h\", \"commit.h\", \"packfile.h\",\n\"promisor-remote.h\" and \"refs.h\" those aren't guarded by\n\"NO_THE_REPOSITORY_COMPATIBILITY_MACROS\", but they're also macros that\nadd \"the_repository\" as the first argument, so we should migrate away\nfrom them.\n\n1. 2abf3503854 (revision.c: remove implicit dependency on the_index,\n   2018-09-21)\n2. e6757652350 (diff.c: remove implicit dependency on the_index,\n   2018-09-21)\n3. 35843b1123e (rerere.c: remove implicit dependency on the_index,\n   2018-09-21)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .../coccinelle/the_repository.pending.cocci   | 70 +++++++++++++++++++\n 1 file changed, 70 insertions(+)\n\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 84b79dce480..8b3f2580e6b 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,7 +5,44 @@\n @@\n @@\n (\n+// cache.h\n+- get_oid\n++ repo_get_oid\n+|\n+- get_oid_commit\n++ repo_get_oid_commit\n+|\n+- get_oid_committish\n++ repo_get_oid_committish\n+|\n+- get_oid_tree\n++ repo_get_oid_tree\n+|\n+- get_oid_treeish\n++ repo_get_oid_treeish\n+|\n+- get_oid_blob\n++ repo_get_oid_blob\n+|\n+- get_oid_mb\n++ repo_get_oid_mb\n+|\n+- find_unique_abbrev\n++ repo_find_unique_abbrev\n+|\n+- find_unique_abbrev_r\n++ repo_find_unique_abbrev_r\n+|\n+- for_each_abbrev\n++ repo_for_each_abbrev\n+|\n+- interpret_branch_name\n++ repo_interpret_branch_name\n+|\n+- peel_to_type\n++ repo_peel_to_type\n // commit-reach.h\n+|\n - get_merge_bases\n + repo_get_merge_bases\n |\n@@ -36,6 +73,13 @@\n |\n - logmsg_reencode\n + repo_logmsg_reencode\n+|\n+- get_commit_tree\n++ repo_get_commit_tree\n+// diff.h\n+|\n+- diff_setup\n++ repo_diff_setup\n // object-store.h\n |\n - read_object_file\n@@ -50,6 +94,32 @@\n |\n - format_commit_message\n + repo_format_commit_message\n+// packfile.h\n+|\n+- approximate_object_count\n++ repo_approximate_object_count\n+// promisor-remote.h\n+|\n+- promisor_remote_reinit\n++ repo_promisor_remote_reinit\n+|\n+- promisor_remote_find\n++ repo_promisor_remote_find\n+|\n+- has_promisor_remote\n++ repo_has_promisor_remote\n+// refs.h\n+|\n+- dwim_ref\n++ repo_dwim_ref\n+// rerere.h\n+|\n+- rerere\n++ repo_rerere\n+// revision.h\n+|\n+- init_revisions\n++ repo_init_revisions\n )\n   (\n + the_repository,\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474286","messageId":"patch-v2-06.17-0f24a57b50b-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 06/17] cocci: apply the \"commit-reach.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:47Z","receivedAt":"2023-03-28T13:59:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"commit-reach.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n bisect.c                                        |  3 ++-\n builtin/branch.c                                |  5 +++--\n builtin/fast-import.c                           |  2 +-\n builtin/fetch.c                                 |  3 ++-\n builtin/log.c                                   | 10 +++++++---\n builtin/merge-base.c                            |  5 +++--\n builtin/merge-tree.c                            |  3 ++-\n builtin/merge.c                                 |  7 +++++--\n builtin/rebase.c                                |  5 +++--\n builtin/receive-pack.c                          |  2 +-\n builtin/rev-parse.c                             |  2 +-\n commit-reach.c                                  |  3 ++-\n commit-reach.h                                  |  9 ---------\n commit.c                                        |  3 ++-\n contrib/coccinelle/the_repository.cocci         | 16 ++++++++++++++++\n contrib/coccinelle/the_repository.pending.cocci | 16 ----------------\n http-push.c                                     |  2 +-\n log-tree.c                                      |  2 +-\n merge-ort.c                                     |  2 +-\n merge-recursive.c                               |  2 +-\n notes-merge.c                                   |  2 +-\n remote.c                                        |  2 +-\n revision.c                                      |  4 ++--\n sequencer.c                                     |  3 ++-\n shallow.c                                       |  9 +++++----\n t/helper/test-reach.c                           | 10 +++++++---\n 26 files changed, 72 insertions(+), 60 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 1409150c5c3..b1639a9de7f 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -847,7 +847,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int\n \tenum bisect_error res = BISECT_OK;\n \tstruct commit_list *result;\n \n-\tresult = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);\n+\tresult = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,\n+\t\t\t\t\t   rev + 1);\n \n \tfor (; result; result = result->next) {\n \t\tconst struct object_id *mb = &result->item->object.oid;\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 968ea03c059..bbcfb34b3c6 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -150,7 +150,8 @@ static int branch_merged(int kind, const char *name,\n \tif (!reference_rev)\n \t\treference_rev = head_rev;\n \n-\tmerged = reference_rev ? in_merge_bases(rev, reference_rev) : 0;\n+\tmerged = reference_rev ? repo_in_merge_bases(the_repository, rev,\n+\t\t\t\t\t\t     reference_rev) : 0;\n \n \t/*\n \t * After the safety valve is fully redefined to \"check with\n@@ -160,7 +161,7 @@ static int branch_merged(int kind, const char *name,\n \t * a gentle reminder is in order.\n \t */\n \tif ((head_rev != reference_rev) &&\n-\t    (head_rev ? in_merge_bases(rev, head_rev) : 0) != merged) {\n+\t    (head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {\n \t\tif (merged)\n \t\t\twarning(_(\"deleting branch '%s' that has been merged to\\n\"\n \t\t\t\t\"         '%s', but not yet merged to HEAD.\"),\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 7faedc9aa44..e4566490d91 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1626,7 +1626,7 @@ static int update_branch(struct branch *b)\n \t\tif (!old_cmit || !new_cmit)\n \t\t\treturn error(\"Branch %s is missing commits.\", b->name);\n \n-\t\tif (!in_merge_bases(old_cmit, new_cmit)) {\n+\t\tif (!repo_in_merge_bases(the_repository, old_cmit, new_cmit)) {\n \t\t\twarning(\"Not updating %s\"\n \t\t\t\t\" (new tip %s does not contain %s)\",\n \t\t\t\tb->name, oid_to_hex(&b->oid),\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 6bab662829f..16dc2a33cac 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -966,7 +966,8 @@ static int update_local_ref(struct ref *ref,\n \n \tif (fetch_show_forced_updates) {\n \t\tuint64_t t_before = getnanotime();\n-\t\tfast_forward = in_merge_bases(current, updated);\n+\t\tfast_forward = repo_in_merge_bases(the_repository, current,\n+\t\t\t\t\t\t   updated);\n \t\tforced_updates_ms += (getnanotime() - t_before) / 1000000;\n \t} else {\n \t\tfast_forward = 1;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 1e7bbedf5d2..e16bda87ba3 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1663,7 +1663,9 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\t\t\t\treturn NULL;\n \t\t\t}\n \t\t\tcommit = lookup_commit_or_die(&oid, \"upstream base\");\n-\t\t\tbase_list = get_merge_bases_many(commit, total, list);\n+\t\t\tbase_list = repo_get_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t      commit, total,\n+\t\t\t\t\t\t\t      list);\n \t\t\t/* There should be one and only one merge base. */\n \t\t\tif (!base_list || base_list->next) {\n \t\t\t\tif (die_on_failure) {\n@@ -1697,7 +1699,9 @@ static struct commit *get_base_commit(const char *base_commit,\n \twhile (rev_nr > 1) {\n \t\tfor (i = 0; i < rev_nr / 2; i++) {\n \t\t\tstruct commit_list *merge_base;\n-\t\t\tmerge_base = get_merge_bases(rev[2 * i], rev[2 * i + 1]);\n+\t\t\tmerge_base = repo_get_merge_bases(the_repository,\n+\t\t\t\t\t\t\t  rev[2 * i],\n+\t\t\t\t\t\t\t  rev[2 * i + 1]);\n \t\t\tif (!merge_base || merge_base->next) {\n \t\t\t\tif (die_on_failure) {\n \t\t\t\t\tdie(_(\"failed to find exact merge base\"));\n@@ -1715,7 +1719,7 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\trev_nr = DIV_ROUND_UP(rev_nr, 2);\n \t}\n \n-\tif (!in_merge_bases(base, rev[0])) {\n+\tif (!repo_in_merge_bases(the_repository, base, rev[0])) {\n \t\tif (die_on_failure) {\n \t\t\tdie(_(\"base commit should be the ancestor of revision list\"));\n \t\t} else {\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 5b0ed0d2738..671e424c26c 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -14,7 +14,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)\n {\n \tstruct commit_list *result, *r;\n \n-\tresult = get_merge_bases_many_dirty(rev[0], rev_nr - 1, rev + 1);\n+\tresult = repo_get_merge_bases_many_dirty(the_repository, rev[0],\n+\t\t\t\t\t\t rev_nr - 1, rev + 1);\n \n \tif (!result)\n \t\treturn 1;\n@@ -106,7 +107,7 @@ static int handle_is_ancestor(int argc, const char **argv)\n \t\tdie(\"--is-ancestor takes exactly two commits\");\n \tone = get_commit_reference(argv[0]);\n \ttwo = get_commit_reference(argv[1]);\n-\tif (in_merge_bases(one, two))\n+\tif (repo_in_merge_bases(the_repository, one, two))\n \t\treturn 0;\n \telse\n \t\treturn 1;\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex e7825181648..234db21548b 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -453,7 +453,8 @@ static int real_merge(struct merge_tree_options *o,\n \t\t * Get the merge bases, in reverse order; see comment above\n \t\t * merge_incore_recursive in merge-ort.h\n \t\t */\n-\t\tmerge_bases = get_merge_bases(parent1, parent2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, parent1,\n+\t\t\t\t\t\t   parent2);\n \t\tif (!merge_bases && !o->allow_unrelated_histories)\n \t\t\tdie(_(\"refusing to merge unrelated histories\"));\n \t\tmerge_bases = reverse_commit_list(merge_bases);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 6a0519c39db..5dfc650a7bc 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1530,7 +1530,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \tif (!remoteheads)\n \t\t; /* already up-to-date */\n \telse if (!remoteheads->next)\n-\t\tcommon = get_merge_bases(head_commit, remoteheads->item);\n+\t\tcommon = repo_get_merge_bases(the_repository, head_commit,\n+\t\t\t\t\t      remoteheads->item);\n \telse {\n \t\tstruct commit_list *list = remoteheads;\n \t\tcommit_list_insert(head_commit, &list);\n@@ -1648,7 +1649,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t * merge_bases again, otherwise \"git merge HEAD^\n \t\t\t * HEAD^^\" would be missed.\n \t\t\t */\n-\t\t\tcommon_one = get_merge_bases(head_commit, j->item);\n+\t\t\tcommon_one = repo_get_merge_bases(the_repository,\n+\t\t\t\t\t\t\t  head_commit,\n+\t\t\t\t\t\t\t  j->item);\n \t\t\tif (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {\n \t\t\t\tup_to_date = 0;\n \t\t\t\tbreak;\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 55ecc2d5f33..6390dd2fcc1 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -883,7 +883,7 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,\n \tif (!upstream)\n \t\tgoto done;\n \n-\tmerge_bases = get_merge_bases(upstream, head);\n+\tmerge_bases = repo_get_merge_bases(the_repository, upstream, head);\n \tif (!merge_bases || merge_bases->next)\n \t\tgoto done;\n \n@@ -902,7 +902,8 @@ static void fill_branch_base(struct rebase_options *options,\n {\n \tstruct commit_list *merge_bases = NULL;\n \n-\tmerge_bases = get_merge_bases(options->onto, options->orig_head);\n+\tmerge_bases = repo_get_merge_bases(the_repository, options->onto,\n+\t\t\t\t\t   options->orig_head);\n \tif (!merge_bases || merge_bases->next)\n \t\toidcpy(branch_base, null_oid());\n \telse\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex c6ab537a44f..e2b7202b04c 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1547,7 +1547,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)\n \t\t}\n \t\told_commit = (struct commit *)old_object;\n \t\tnew_commit = (struct commit *)new_object;\n-\t\tif (!in_merge_bases(old_commit, new_commit)) {\n+\t\tif (!repo_in_merge_bases(the_repository, old_commit, new_commit)) {\n \t\t\trp_error(\"denying non-fast-forward %s\"\n \t\t\t\t \" (you should pull first)\", name);\n \t\t\tret = \"non-fast-forward\";\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 5db9d6ad518..4969815ca79 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -294,7 +294,7 @@ static int try_difference(const char *arg)\n \t\t\t\t*dotdot = '.';\n \t\t\t\treturn 0;\n \t\t\t}\n-\t\t\texclude = get_merge_bases(a, b);\n+\t\t\texclude = repo_get_merge_bases(the_repository, a, b);\n \t\t\twhile (exclude) {\n \t\t\t\tstruct commit *commit = pop_commit(&exclude);\n \t\t\t\tshow_rev(REVERSED, &commit->object.oid, NULL);\ndiff --git a/commit-reach.c b/commit-reach.c\nindex 7c0c39fd286..4a2ea9ca1f7 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -164,7 +164,8 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)\n \n \t\tfor (j = ret; j; j = j->next) {\n \t\t\tstruct commit_list *bases;\n-\t\t\tbases = get_merge_bases(i->item, j->item);\n+\t\t\tbases = repo_get_merge_bases(the_repository, i->item,\n+\t\t\t\t\t\t     j->item);\n \t\t\tif (!new_commits)\n \t\t\t\tnew_commits = bases;\n \t\t\telse\ndiff --git a/commit-reach.h b/commit-reach.h\nindex 148b56fea50..94a96e03299 100644\n--- a/commit-reach.h\n+++ b/commit-reach.h\n@@ -19,11 +19,6 @@ struct commit_list *repo_get_merge_bases_many(struct repository *r,\n struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,\n \t\t\t\t\t\t    struct commit *one, int n,\n \t\t\t\t\t\t    struct commit **twos);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define get_merge_bases(r1, r2)           repo_get_merge_bases(the_repository, r1, r2)\n-#define get_merge_bases_many(one, n, two) repo_get_merge_bases_many(the_repository, one, n, two)\n-#define get_merge_bases_many_dirty(one, n, twos) repo_get_merge_bases_many_dirty(the_repository, one, n, twos)\n-#endif\n \n struct commit_list *get_octopus_merge_bases(struct commit_list *in);\n \n@@ -36,10 +31,6 @@ int repo_in_merge_bases(struct repository *r,\n int repo_in_merge_bases_many(struct repository *r,\n \t\t\t     struct commit *commit,\n \t\t\t     int nr_reference, struct commit **reference);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define in_merge_bases(c1, c2) repo_in_merge_bases(the_repository, c1, c2)\n-#define in_merge_bases_many(c1, n, cs) repo_in_merge_bases_many(the_repository, c1, n, cs)\n-#endif\n \n /*\n  * Takes a list of commits and returns a new list where those\ndiff --git a/commit.c b/commit.c\nindex c0b1db3d3e1..aa2e58ea207 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -1017,7 +1017,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)\n \tfor (i = 0; i < revs.nr; i++)\n \t\trevs.commit[i]->object.flags &= ~TMP_MARK;\n \n-\tbases = get_merge_bases_many(commit, revs.nr, revs.commit);\n+\tbases = repo_get_merge_bases_many(the_repository, commit, revs.nr,\n+\t\t\t\t\t  revs.commit);\n \n \t/*\n \t * There should be one and only one merge base, when we found\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex dcdba314fc2..1ab63f0196b 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -38,6 +38,22 @@\n |\n - peel_to_type\n + repo_peel_to_type\n+// commit-reach.h\n+|\n+- get_merge_bases\n++ repo_get_merge_bases\n+|\n+- get_merge_bases_many\n++ repo_get_merge_bases_many\n+|\n+- get_merge_bases_many_dirty\n++ repo_get_merge_bases_many_dirty\n+|\n+- in_merge_bases\n++ repo_in_merge_bases\n+|\n+- in_merge_bases_many\n++ repo_in_merge_bases_many\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 2d200ab83e7..e9209fc0cc4 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,23 +5,7 @@\n @@\n @@\n (\n-// commit-reach.h\n-- get_merge_bases\n-+ repo_get_merge_bases\n-|\n-- get_merge_bases_many\n-+ repo_get_merge_bases_many\n-|\n-- get_merge_bases_many_dirty\n-+ repo_get_merge_bases_many_dirty\n-|\n-- in_merge_bases\n-+ repo_in_merge_bases\n-|\n-- in_merge_bases_many\n-+ repo_in_merge_bases_many\n // commit.h\n-|\n - parse_commit_internal\n + repo_parse_commit_internal\n |\ndiff --git a/http-push.c b/http-push.c\nindex 88aa045ecba..2693d73cf9a 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1571,7 +1571,7 @@ static int verify_merge_base(struct object_id *head_oid, struct ref *remote)\n \tstruct commit *branch = lookup_commit_or_die(&remote->old_oid,\n \t\t\t\t\t\t     remote->name);\n \n-\treturn in_merge_bases(branch, head);\n+\treturn repo_in_merge_bases(the_repository, branch, head);\n }\n \n static int delete_remote_branch(const char *pattern, int force)\ndiff --git a/log-tree.c b/log-tree.c\nindex 49411c5c6a6..97d374c76d6 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -996,7 +996,7 @@ static int do_remerge_diff(struct rev_info *opt,\n \t/* Parse the relevant commits and get the merge bases */\n \tparse_commit_or_die(parent1);\n \tparse_commit_or_die(parent2);\n-\tbases = get_merge_bases(parent1, parent2);\n+\tbases = repo_get_merge_bases(the_repository, parent1, parent2);\n \n \t/* Re-merge the parents */\n \tmerge_incore_recursive(&o, bases, parent1, parent2, &res);\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 4c5be8ed910..186e26d90a0 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -5018,7 +5018,7 @@ static void merge_ort_internal(struct merge_options *opt,\n \tstruct strbuf merge_base_abbrev = STRBUF_INIT;\n \n \tif (!merge_bases) {\n-\t\tmerge_bases = get_merge_bases(h1, h2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, h1, h2);\n \t\t/* See merge-ort.h:merge_incore_recursive() declaration NOTE */\n \t\tmerge_bases = reverse_commit_list(merge_bases);\n \t}\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 89731f40908..cfb201d682b 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3592,7 +3592,7 @@ static int merge_recursive_internal(struct merge_options *opt,\n \t}\n \n \tif (!merge_bases) {\n-\t\tmerge_bases = get_merge_bases(h1, h2);\n+\t\tmerge_bases = repo_get_merge_bases(the_repository, h1, h2);\n \t\tmerge_bases = reverse_commit_list(merge_bases);\n \t}\n \ndiff --git a/notes-merge.c b/notes-merge.c\nindex f9137ec768f..699edcfe105 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -601,7 +601,7 @@ int notes_merge(struct notes_merge_options *o,\n \tassert(local && remote);\n \n \t/* Find merge bases */\n-\tbases = get_merge_bases(local, remote);\n+\tbases = repo_get_merge_bases(the_repository, local, remote);\n \tif (!bases) {\n \t\tbase_oid = null_oid();\n \t\tbase_tree_oid = the_hash_algo->empty_tree;\ndiff --git a/remote.c b/remote.c\nindex a0f22c8751e..37cb5213795 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2664,7 +2664,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote)\n \t\tif (MERGE_BASES_BATCH_SIZE < size)\n \t\t\tsize = MERGE_BASES_BATCH_SIZE;\n \n-\t\tif ((ret = in_merge_bases_many(commit, size, chunk)))\n+\t\tif ((ret = repo_in_merge_bases_many(the_repository, commit, size, chunk)))\n \t\t\tbreak;\n \t}\n \ndiff --git a/revision.c b/revision.c\nindex e08f697c47c..b6a1b47c306 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1960,7 +1960,7 @@ static void prepare_show_merge(struct rev_info *revs)\n \tother = lookup_commit_or_die(&oid, \"MERGE_HEAD\");\n \tadd_pending_object(revs, &head->object, \"HEAD\");\n \tadd_pending_object(revs, &other->object, \"MERGE_HEAD\");\n-\tbases = get_merge_bases(head, other);\n+\tbases = repo_get_merge_bases(the_repository, head, other);\n \tadd_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);\n \tadd_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);\n \tfree_commit_list(bases);\n@@ -2055,7 +2055,7 @@ static int handle_dotdot_1(const char *arg, char *dotdot,\n \t\tif (!a || !b)\n \t\t\treturn dotdot_missing(arg, dotdot, revs, symmetric);\n \n-\t\texclude = get_merge_bases(a, b);\n+\t\texclude = repo_get_merge_bases(the_repository, a, b);\n \t\tadd_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,\n \t\t\t\t     flags_exclude);\n \t\tadd_pending_commit_list(revs, exclude, flags_exclude);\ndiff --git a/sequencer.c b/sequencer.c\nindex d73827632d8..3578dc25510 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -4105,7 +4105,8 @@ static int do_merge(struct repository *r,\n \t}\n \n \tmerge_commit = to_merge->item;\n-\tbases = get_merge_bases(head_commit, merge_commit);\n+\tbases = repo_get_merge_bases(the_repository, head_commit,\n+\t\t\t\t     merge_commit);\n \tif (bases && oideq(&merge_commit->object.oid,\n \t\t\t   &bases->item->object.oid)) {\n \t\tret = 0;\ndiff --git a/shallow.c b/shallow.c\nindex 1cbb05ba0e4..db9856ef8ad 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -793,7 +793,7 @@ static void post_assign_shallow(struct shallow_info *info,\n \t\tfor (j = 0; j < bitmap_nr; j++)\n \t\t\tif (bitmap[0][j] &&\n \t\t\t    /* Step 7, reachability test at commit level */\n-\t\t\t    !in_merge_bases_many(c, ca.nr, ca.commits)) {\n+\t\t\t    !repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits)) {\n \t\t\t\tupdate_refstatus(ref_status, info->ref->nr, *bitmap);\n \t\t\t\tdst++;\n \t\t\t\tbreak;\n@@ -821,9 +821,10 @@ int delayed_reachability_test(struct shallow_info *si, int c)\n \t\t\tsi->nr_commits = ca.nr;\n \t\t}\n \n-\t\tsi->reachable[c] = in_merge_bases_many(commit,\n-\t\t\t\t\t\t       si->nr_commits,\n-\t\t\t\t\t\t       si->commits);\n+\t\tsi->reachable[c] = repo_in_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t    commit,\n+\t\t\t\t\t\t\t    si->nr_commits,\n+\t\t\t\t\t\t\t    si->commits);\n \t\tsi->need_reachability_test[c] = 0;\n \t}\n \treturn si->reachable[c];\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex afb9bb3189f..d08c3ffa3ba 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -107,13 +107,17 @@ int cmd__reach(int ac, const char **av)\n \tif (!strcmp(av[1], \"ref_newer\"))\n \t\tprintf(\"%s(A,B):%d\\n\", av[1], ref_newer(&oid_A, &oid_B));\n \telse if (!strcmp(av[1], \"in_merge_bases\"))\n-\t\tprintf(\"%s(A,B):%d\\n\", av[1], in_merge_bases(A, B));\n+\t\tprintf(\"%s(A,B):%d\\n\", av[1],\n+\t\t       repo_in_merge_bases(the_repository, A, B));\n \telse if (!strcmp(av[1], \"in_merge_bases_many\"))\n-\t\tprintf(\"%s(A,X):%d\\n\", av[1], in_merge_bases_many(A, X_nr, X_array));\n+\t\tprintf(\"%s(A,X):%d\\n\", av[1],\n+\t\t       repo_in_merge_bases_many(the_repository, A, X_nr, X_array));\n \telse if (!strcmp(av[1], \"is_descendant_of\"))\n \t\tprintf(\"%s(A,X):%d\\n\", av[1], repo_is_descendant_of(r, A, X));\n \telse if (!strcmp(av[1], \"get_merge_bases_many\")) {\n-\t\tstruct commit_list *list = get_merge_bases_many(A, X_nr, X_array);\n+\t\tstruct commit_list *list = repo_get_merge_bases_many(the_repository,\n+\t\t\t\t\t\t\t\t     A, X_nr,\n+\t\t\t\t\t\t\t\t     X_array);\n \t\tprintf(\"%s(A,X):\\n\", av[1]);\n \t\tprint_sorted_commit_ids(list);\n \t} else if (!strcmp(av[1], \"reduce_heads\")) {\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474288","messageId":"patch-v2-05.17-3e721fa5db0-20230328T110946Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 05/17] cocci: apply the \"cache.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:46Z","receivedAt":"2023-03-28T13:59:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"cache.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-patch.c                                   |  2 +-\n apply.c                                       |  4 +-\n archive.c                                     |  2 +-\n branch.c                                      |  2 +-\n builtin/am.c                                  | 16 +++---\n builtin/bisect.c                              | 19 +++----\n builtin/blame.c                               |  9 ++--\n builtin/branch.c                              |  2 +-\n builtin/checkout.c                            | 16 +++---\n builtin/commit-tree.c                         |  4 +-\n builtin/commit.c                              |  8 +--\n builtin/describe.c                            |  5 +-\n builtin/fast-import.c                         |  8 +--\n builtin/fetch.c                               |  2 +-\n builtin/fsck.c                                |  2 +-\n builtin/log.c                                 |  8 +--\n builtin/ls-files.c                            |  4 +-\n builtin/ls-tree.c                             |  9 ++--\n builtin/merge-base.c                          |  4 +-\n builtin/merge-recursive.c                     |  6 +--\n builtin/merge.c                               | 10 ++--\n builtin/name-rev.c                            |  7 +--\n builtin/notes.c                               | 22 ++++----\n builtin/prune.c                               |  2 +-\n builtin/pull.c                                |  4 +-\n builtin/range-diff.c                          | 12 ++---\n builtin/read-tree.c                           |  2 +-\n builtin/rebase.c                              | 12 +++--\n builtin/receive-pack.c                        | 10 ++--\n builtin/replace.c                             | 16 +++---\n builtin/reset.c                               | 19 +++----\n builtin/rev-list.c                            |  2 +-\n builtin/rev-parse.c                           | 12 +++--\n builtin/rm.c                                  |  2 +-\n builtin/show-branch.c                         | 12 ++---\n builtin/show-ref.c                            |  4 +-\n builtin/sparse-checkout.c                     |  2 +-\n builtin/stash.c                               | 13 ++---\n builtin/submodule--helper.c                   |  4 +-\n builtin/tag.c                                 |  6 +--\n builtin/unpack-file.c                         |  2 +-\n builtin/update-ref.c                          |  8 +--\n builtin/verify-commit.c                       |  2 +-\n builtin/verify-tag.c                          |  2 +-\n builtin/worktree.c                            |  8 +--\n cache.h                                       | 15 ------\n checkout.c                                    |  2 +-\n combine-diff.c                                |  6 +--\n commit.c                                      | 10 ++--\n contrib/coccinelle/the_repository.cocci       | 44 ++++++++++++++++\n .../coccinelle/the_repository.pending.cocci   | 37 --------------\n diff-lib.c                                    |  2 +-\n diff.c                                        |  4 +-\n fmt-merge-msg.c                               |  4 +-\n log-tree.c                                    | 15 +++---\n mailmap.c                                     |  2 +-\n notes-merge.c                                 |  2 +-\n notes.c                                       |  6 +--\n object-name.c                                 |  5 +-\n parse-options-cb.c                            |  8 +--\n range-diff.c                                  |  8 +--\n read-cache.c                                  |  2 +-\n rebase-interactive.c                          |  2 +-\n ref-filter.c                                  |  8 +--\n remote.c                                      |  6 +--\n reset.c                                       |  4 +-\n revision.c                                    | 11 ++--\n sequencer.c                                   | 51 ++++++++++---------\n submodule-config.c                            |  2 +-\n submodule.c                                   |  8 +--\n t/helper/test-fast-rebase.c                   | 10 ++--\n t/helper/test-match-trees.c                   |  4 +-\n t/helper/test-oidmap.c                        |  6 +--\n t/helper/test-reach.c                         |  2 +-\n t/helper/test-submodule-config.c              |  2 +-\n tag.c                                         |  4 +-\n transport-helper.c                            |  2 +-\n transport.c                                   |  3 +-\n wt-status.c                                   | 18 +++----\n 79 files changed, 332 insertions(+), 310 deletions(-)\n create mode 100644 contrib/coccinelle/the_repository.cocci\n\ndiff --git a/add-patch.c b/add-patch.c\nindex e6c34b9c381..6a32b49b29c 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -415,7 +415,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)\n \t\tstrvec_push(&args,\n \t\t\t    /* could be on an unborn branch */\n \t\t\t    !strcmp(\"HEAD\", s->revision) &&\n-\t\t\t    get_oid(\"HEAD\", &oid) ?\n+\t\t\t    repo_get_oid(the_repository, \"HEAD\", &oid) ?\n \t\t\t    empty_tree_oid_hex() : s->revision);\n \t}\n \tcolor_arg_index = args.nr;\ndiff --git a/apply.c b/apply.c\nindex 8776ab939ad..ed6abc7722f 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3612,7 +3612,7 @@ static int try_threeway(struct apply_state *state,\n \t/* Preimage the patch was prepared for */\n \tif (patch->is_new)\n \t\twrite_object_file(\"\", 0, OBJ_BLOB, &pre_oid);\n-\telse if (get_oid(patch->old_oid_prefix, &pre_oid) ||\n+\telse if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) ||\n \t\t read_blob_object(&buf, &pre_oid, patch->old_mode))\n \t\treturn error(_(\"repository lacks the necessary blob to perform 3-way merge.\"));\n \n@@ -4129,7 +4129,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \t\t\telse\n \t\t\t\treturn error(_(\"sha1 information is lacking or \"\n \t\t\t\t\t       \"useless for submodule %s\"), name);\n-\t\t} else if (!get_oid_blob(patch->old_oid_prefix, &oid)) {\n+\t\t} else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) {\n \t\t\t; /* ok */\n \t\t} else if (!patch->lines_added && !patch->lines_deleted) {\n \t\t\t/* mode-only change: update the current */\ndiff --git a/archive.c b/archive.c\nindex 1c2ca78e52a..cb7ca69cce1 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -463,7 +463,7 @@ static void parse_treeish_arg(const char **argv,\n \t\tdwim_ref(name, strlen(name), &oid, &ref, 0);\n \t}\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\tdie(_(\"not a valid object name: %s\"), name);\n \n \tcommit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);\ndiff --git a/branch.c b/branch.c\nindex eacef62b7c9..efea29af1ac 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -532,7 +532,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\texplicit_tracking = 1;\n \n \treal_ref = NULL;\n-\tif (get_oid_mb(start_name, &oid)) {\n+\tif (repo_get_oid_mb(the_repository, start_name, &oid)) {\n \t\tif (explicit_tracking) {\n \t\t\tint code = die_message(_(upstream_missing), start_name);\n \t\t\tadvise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5e6b237c424..775beac2a92 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1067,7 +1067,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,\n \telse\n \t\twrite_state_text(state, \"applying\", \"\");\n \n-\tif (!get_oid(\"HEAD\", &curr_head)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &curr_head)) {\n \t\twrite_state_text(state, \"abort-safety\", oid_to_hex(&curr_head));\n \t\tif (!state->rebasing)\n \t\t\tupdate_ref(\"am\", \"ORIG_HEAD\", &curr_head, NULL, 0,\n@@ -1110,7 +1110,7 @@ static void am_next(struct am_state *state)\n \tunlink(am_path(state, \"original-commit\"));\n \tdelete_ref(NULL, \"REBASE_HEAD\", NULL, REF_NO_DEREF);\n \n-\tif (!get_oid(\"HEAD\", &head))\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head))\n \t\twrite_state_text(state, \"abort-safety\", oid_to_hex(&head));\n \telse\n \t\twrite_state_text(state, \"abort-safety\", \"\");\n@@ -1403,7 +1403,7 @@ static void write_index_patch(const struct am_state *state)\n \tstruct rev_info rev_info;\n \tFILE *fp;\n \n-\tif (!get_oid(\"HEAD\", &head)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\tstruct commit *commit = lookup_commit_or_die(&head, \"HEAD\");\n \t\ttree = get_commit_tree(commit);\n \t} else\n@@ -1557,7 +1557,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa\n \tstruct commit *result;\n \tchar *their_tree_name;\n \n-\tif (get_oid(\"HEAD\", &our_tree) < 0)\n+\tif (repo_get_oid(the_repository, \"HEAD\", &our_tree) < 0)\n \t\toidcpy(&our_tree, the_hash_algo->empty_tree);\n \n \tif (build_fake_ancestor(state, index_path))\n@@ -1647,7 +1647,7 @@ static void do_commit(const struct am_state *state)\n \tif (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL))\n \t\tdie(_(\"git write-tree failed to write a tree\"));\n \n-\tif (!get_oid_commit(\"HEAD\", &parent)) {\n+\tif (!repo_get_oid_commit(the_repository, \"HEAD\", &parent)) {\n \t\told_oid = &parent;\n \t\tcommit_list_insert(lookup_commit(the_repository, &parent),\n \t\t\t\t   &parents);\n@@ -2089,7 +2089,7 @@ static void am_skip(struct am_state *state)\n \n \tam_rerere_clear();\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\toidcpy(&head, the_hash_algo->empty_tree);\n \n \tif (clean_index(&head, &head))\n@@ -2131,7 +2131,7 @@ static int safe_to_abort(const struct am_state *state)\n \t\toidclr(&abort_safety);\n \tstrbuf_release(&sb);\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\toidclr(&head);\n \n \tif (oideq(&head, &abort_safety))\n@@ -2164,7 +2164,7 @@ static void am_abort(struct am_state *state)\n \tif (!has_curr_head)\n \t\toidcpy(&curr_head, the_hash_algo->empty_tree);\n \n-\thas_orig_head = !get_oid(\"ORIG_HEAD\", &orig_head);\n+\thas_orig_head = !repo_get_oid(the_repository, \"ORIG_HEAD\", &orig_head);\n \tif (!has_orig_head)\n \t\toidcpy(&orig_head, the_hash_algo->empty_tree);\n \ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex c64c8d715a5..f925ceeb3c0 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -236,7 +236,7 @@ static int bisect_reset(const char *commit)\n \t} else {\n \t\tstruct object_id oid;\n \n-\t\tif (get_oid_commit(commit, &oid))\n+\t\tif (repo_get_oid_commit(the_repository, commit, &oid))\n \t\t\treturn error(_(\"'%s' is not a valid commit\"), commit);\n \t\tstrbuf_addstr(&branch, commit);\n \t}\n@@ -294,7 +294,7 @@ static int bisect_write(const char *state, const char *rev,\n \t\tgoto finish;\n \t}\n \n-\tif (get_oid(rev, &oid)) {\n+\tif (repo_get_oid(the_repository, rev, &oid)) {\n \t\tres = error(_(\"couldn't get the oid of the rev '%s'\"), rev);\n \t\tgoto finish;\n \t}\n@@ -777,7 +777,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t */\n \thead = resolve_ref_unsafe(\"HEAD\", 0, &head_oid, &flags);\n \tif (!head)\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\treturn error(_(\"bad HEAD - I need a HEAD\"));\n \n \t/*\n@@ -803,11 +803,11 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t\t}\n \t} else {\n \t\t/* Get the rev from where we start. */\n-\t\tif (!get_oid(head, &head_oid) &&\n+\t\tif (!repo_get_oid(the_repository, head, &head_oid) &&\n \t\t    !starts_with(head, \"refs/heads/\")) {\n \t\t\tstrbuf_reset(&start_head);\n \t\t\tstrbuf_addstr(&start_head, oid_to_hex(&head_oid));\n-\t\t} else if (!get_oid(head, &head_oid) &&\n+\t\t} else if (!repo_get_oid(the_repository, head, &head_oid) &&\n \t\t\t   skip_prefix(head, \"refs/heads/\", &head)) {\n \t\t\tstrbuf_addstr(&start_head, head);\n \t\t} else {\n@@ -830,7 +830,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,\n \t\twrite_file(git_path_bisect_first_parent(), \"\\n\");\n \n \tif (no_checkout) {\n-\t\tif (get_oid(start_head.buf, &oid) < 0) {\n+\t\tif (repo_get_oid(the_repository, start_head.buf, &oid) < 0) {\n \t\t\tres = error(_(\"invalid ref: '%s'\"), start_head.buf);\n \t\t\tgoto finish;\n \t\t}\n@@ -935,11 +935,12 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,\n \n \tif (argc == 0) {\n \t\tconst char *head = \"BISECT_HEAD\";\n-\t\tenum get_oid_result res_head = get_oid(head, &oid);\n+\t\tenum get_oid_result res_head = repo_get_oid(the_repository,\n+\t\t\t\t\t\t\t    head, &oid);\n \n \t\tif (res_head == MISSING_OBJECT) {\n \t\t\thead = \"HEAD\";\n-\t\t\tres_head = get_oid(head, &oid);\n+\t\t\tres_head = repo_get_oid(the_repository, head, &oid);\n \t\t}\n \n \t\tif (res_head)\n@@ -955,7 +956,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,\n \tfor (; argc; argc--, argv++) {\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(*argv, &oid)){\n+\t\tif (repo_get_oid(the_repository, *argv, &oid)){\n \t\t\terror(_(\"Bad rev input: %s\"), *argv);\n \t\t\toid_array_clear(&revs);\n \t\t\treturn BISECT_FAILED;\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fdd9f0c0fc7..6c266019ebb 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -603,8 +603,9 @@ static int read_ancestry(const char *graft_file)\n \n static int update_auto_abbrev(int auto_abbrev, struct blame_origin *suspect)\n {\n-\tconst char *uniq = find_unique_abbrev(&suspect->commit->object.oid,\n-\t\t\t\t\t      auto_abbrev);\n+\tconst char *uniq = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t   &suspect->commit->object.oid,\n+\t\t\t\t\t\t   auto_abbrev);\n \tint len = strlen(uniq);\n \tif (auto_abbrev < len)\n \t\treturn len;\n@@ -804,7 +805,7 @@ static int is_a_rev(const char *name)\n {\n \tstruct object_id oid;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn 0;\n \treturn OBJ_NONE < oid_object_info(the_repository, &oid, NULL);\n }\n@@ -847,7 +848,7 @@ static void build_ignorelist(struct blame_scoreboard *sb,\n \t\t\t\t\t\t    peel_to_commit_oid, sb);\n \t}\n \tfor_each_string_list_item(i, ignore_rev_list) {\n-\t\tif (get_oid_committish(i->string, &oid) ||\n+\t\tif (repo_get_oid_committish(the_repository, i->string, &oid) ||\n \t\t    peel_to_commit_oid(&oid, sb))\n \t\t\tdie(_(\"cannot find revision %s to ignore\"), i->string);\n \t\toidset_insert(&sb->ignore_list, &oid);\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex f63fd45edb9..968ea03c059 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -280,7 +280,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,\n \t\titem = string_list_append(&refs_to_delete, name);\n \t\titem->util = xstrdup((flags & REF_ISBROKEN) ? \"broken\"\n \t\t\t\t    : (flags & REF_ISSYMREF) ? target\n-\t\t\t\t    : find_unique_abbrev(&oid, DEFAULT_ABBREV));\n+\t\t\t\t    : repo_find_unique_abbrev(the_repository, &oid, DEFAULT_ABBREV));\n \n \tnext:\n \t\tfree(target);\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 734d730980c..18f3fc76ced 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -433,8 +433,8 @@ static int checkout_worktree(const struct checkout_opts *opts,\n \t\t\t\t\t      \"Updated %d paths from %s\",\n \t\t\t\t\t      nr_checkouts),\n \t\t\t\t   nr_checkouts,\n-\t\t\t\t   find_unique_abbrev(&opts->source_tree->object.oid,\n-\t\t\t\t\t\t      DEFAULT_ABBREV));\n+\t\t\t\t   repo_find_unique_abbrev(the_repository, &opts->source_tree->object.oid,\n+\t\t\t\t\t\t\t   DEFAULT_ABBREV));\n \t\telse if (!nr_unmerged || nr_checkouts)\n \t\t\tfprintf_ln(stderr, Q_(\"Updated %d path from the index\",\n \t\t\t\t\t      \"Updated %d paths from the index\",\n@@ -658,10 +658,12 @@ static void describe_detached_head(const char *msg, struct commit *commit)\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);\n \tif (print_sha1_ellipsis()) {\n \t\tfprintf(stderr, \"%s %s... %s\\n\", msg,\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n+\t\t\tsb.buf);\n \t} else {\n \t\tfprintf(stderr, \"%s %s %s\\n\", msg,\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n+\t\t\tsb.buf);\n \t}\n \tstrbuf_release(&sb);\n }\n@@ -1074,7 +1076,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n \t\t\t\" git branch <new-branch-name> %s\\n\\n\",\n \t\t\t/* Give ngettext() the count */\n \t\t\tlost),\n-\t\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n }\n \n /*\n@@ -1336,7 +1338,7 @@ static int parse_branchname_arg(int argc, const char **argv,\n \tif (!strcmp(arg, \"-\"))\n \t\targ = \"@{-1}\";\n \n-\tif (get_oid_mb(arg, rev)) {\n+\tif (repo_get_oid_mb(the_repository, arg, rev)) {\n \t\t/*\n \t\t * Either case (3) or (4), with <something> not being\n \t\t * a commit, or an attempt to use case (1) with an\n@@ -1762,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,\n \t} else if (!opts->accept_ref && opts->from_treeish) {\n \t\tstruct object_id rev;\n \n-\t\tif (get_oid_mb(opts->from_treeish, &rev))\n+\t\tif (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))\n \t\t\tdie(_(\"could not resolve %s\"), opts->from_treeish);\n \n \t\tsetup_new_branch_info_and_source_tree(new_branch_info,\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex e805da5bb1c..b046c193067 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -46,7 +46,7 @@ static int parse_parent_arg_callback(const struct option *opt,\n \n \tBUG_ON_OPT_NEG_NOARG(unset, arg);\n \n-\tif (get_oid_commit(arg, &oid))\n+\tif (repo_get_oid_commit(the_repository, arg, &oid))\n \t\tdie(_(\"not a valid object name %s\"), arg);\n \n \tassert_oid_type(&oid, OBJ_COMMIT);\n@@ -124,7 +124,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \tif (argc != 1)\n \t\tdie(_(\"must give exactly one tree\"));\n \n-\tif (get_oid_tree(argv[0], &tree_oid))\n+\tif (repo_get_oid_tree(the_repository, argv[0], &tree_oid))\n \t\tdie(_(\"not a valid object name %s\"), argv[0]);\n \n \tif (!buffer.len) {\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex f71ed41bf59..95bca976a58 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -557,7 +557,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \ts->index_file = index_file;\n \ts->fp = fp;\n \ts->nowarn = nowarn;\n-\ts->is_initial = get_oid(s->reference, &oid) ? 1 : 0;\n+\ts->is_initial = repo_get_oid(the_repository, s->reference, &oid) ? 1 : 0;\n \tif (!s->is_initial)\n \t\toidcpy(&s->oid_commit, &oid);\n \ts->status_format = status_format;\n@@ -1000,7 +1000,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tif (amend)\n \t\t\tparent = \"HEAD^1\";\n \n-\t\tif (get_oid(parent, &oid)) {\n+\t\tif (repo_get_oid(the_repository, parent, &oid)) {\n \t\t\tint i, ita_nr = 0;\n \n \t\t\t/* TODO: audit for interaction with sparse-index. */\n@@ -1567,7 +1567,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \telse\n \t\tfd = -1;\n \n-\ts.is_initial = get_oid(s.reference, &oid) ? 1 : 0;\n+\ts.is_initial = repo_get_oid(the_repository, s.reference, &oid) ? 1 : 0;\n \tif (!s.is_initial)\n \t\toidcpy(&s.oid_commit, &oid);\n \n@@ -1710,7 +1710,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tstatus_format = STATUS_FORMAT_NONE; /* Ignore status.short */\n \ts.colopts = 0;\n \n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\tcurrent_head = NULL;\n \telse {\n \t\tcurrent_head = lookup_commit_or_die(&oid, \"HEAD\");\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 5b5930f5c8c..de3743e803a 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -299,7 +299,8 @@ static void append_name(struct commit_name *n, struct strbuf *dst)\n \n static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)\n {\n-\tstrbuf_addf(dst, \"-%d-g%s\", depth, find_unique_abbrev(oid, abbrev));\n+\tstrbuf_addf(dst, \"-%d-g%s\", depth,\n+\t\t    repo_find_unique_abbrev(the_repository, oid, abbrev));\n }\n \n static void describe_commit(struct object_id *oid, struct strbuf *dst)\n@@ -532,7 +533,7 @@ static void describe(const char *arg, int last_one)\n \tif (debug)\n \t\tfprintf(stderr, _(\"describe %s\\n\"), arg);\n \n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\tdie(_(\"Not a valid object name %s\"), arg);\n \tcmit = lookup_commit_reference_gently(the_repository, &oid, 1);\n \ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f7548ff4a35..7faedc9aa44 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -2487,7 +2487,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa\n \t\tif (commit_oe->type != OBJ_COMMIT)\n \t\t\tdie(\"Mark :%\" PRIuMAX \" not a commit\", commit_mark);\n \t\toidcpy(&commit_oid, &commit_oe->idx.oid);\n-\t} else if (!get_oid(p, &commit_oid)) {\n+\t} else if (!repo_get_oid(the_repository, p, &commit_oid)) {\n \t\tunsigned long size;\n \t\tchar *buf = read_object_with_reference(the_repository,\n \t\t\t\t\t\t       &commit_oid,\n@@ -2600,7 +2600,7 @@ static int parse_objectish(struct branch *b, const char *objectish)\n \t\t\t} else\n \t\t\t\tparse_from_existing(b);\n \t\t}\n-\t} else if (!get_oid(objectish, &b->oid)) {\n+\t} else if (!repo_get_oid(the_repository, objectish, &b->oid)) {\n \t\tparse_from_existing(b);\n \t\tif (is_null_oid(&b->oid))\n \t\t\tb->delete = 1;\n@@ -2655,7 +2655,7 @@ static struct hash_list *parse_merge(unsigned int *count)\n \t\t\tif (oe->type != OBJ_COMMIT)\n \t\t\t\tdie(\"Mark :%\" PRIuMAX \" not a commit\", idnum);\n \t\t\toidcpy(&n->oid, &oe->idx.oid);\n-\t\t} else if (!get_oid(from, &n->oid)) {\n+\t\t} else if (!repo_get_oid(the_repository, from, &n->oid)) {\n \t\t\tunsigned long size;\n \t\t\tchar *buf = read_object_with_reference(the_repository,\n \t\t\t\t\t\t\t       &n->oid,\n@@ -2828,7 +2828,7 @@ static void parse_new_tag(const char *arg)\n \t\toe = find_mark(marks, from_mark);\n \t\ttype = oe->type;\n \t\toidcpy(&oid, &oe->idx.oid);\n-\t} else if (!get_oid(from, &oid)) {\n+\t} else if (!repo_get_oid(the_repository, from, &oid)) {\n \t\tstruct object_entry *oe = find_object(&oid);\n \t\tif (!oe) {\n \t\t\ttype = oid_object_info(the_repository, &oid, NULL);\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 7221e57f352..6bab662829f 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1490,7 +1490,7 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)\n \t\tint old_nr;\n \t\tif (!has_glob_specials(s)) {\n \t\t\tstruct object_id oid;\n-\t\t\tif (get_oid(s, &oid))\n+\t\t\tif (repo_get_oid(the_repository, s, &oid))\n \t\t\t\tdie(_(\"%s is not a valid object\"), s);\n \t\t\tif (!has_object(the_repository, &oid, 0))\n \t\t\t\tdie(_(\"the object %s does not exist\"), s);\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex c4a633c0329..4537d9f0f22 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -959,7 +959,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tstruct object_id oid;\n-\t\tif (!get_oid(arg, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, arg, &oid)) {\n \t\t\tstruct object *obj = lookup_object(the_repository,\n \t\t\t\t\t\t\t   &oid);\n \ndiff --git a/builtin/log.c b/builtin/log.c\nindex 4693385e8ed..1e7bbedf5d2 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1656,7 +1656,7 @@ static struct commit *get_base_commit(const char *base_commit,\n \t\t\tstruct commit *commit;\n \t\t\tstruct object_id oid;\n \n-\t\t\tif (get_oid(upstream, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, upstream, &oid)) {\n \t\t\t\tif (die_on_failure)\n \t\t\t\t\tdie(_(\"failed to resolve '%s' as a valid ref\"), upstream);\n \t\t\t\telse\n@@ -2414,7 +2414,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)\n {\n \tstruct object_id oid;\n-\tif (get_oid(arg, &oid) == 0) {\n+\tif (repo_get_oid(the_repository, arg, &oid) == 0) {\n \t\tstruct commit *commit = lookup_commit_reference(the_repository,\n \t\t\t\t\t\t\t\t&oid);\n \t\tif (commit) {\n@@ -2436,12 +2436,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,\n {\n \tif (!verbose) {\n \t\tfprintf(file, \"%c %s\\n\", sign,\n-\t\t       find_unique_abbrev(&commit->object.oid, abbrev));\n+\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev));\n \t} else {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);\n \t\tfprintf(file, \"%c %s %s\\n\", sign,\n-\t\t       find_unique_abbrev(&commit->object.oid, abbrev),\n+\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev),\n \t\t       buf.buf);\n \t\tstrbuf_release(&buf);\n \t}\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 26e309f533a..7fc82d7f760 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -363,7 +363,7 @@ static void show_ru_info(struct index_state *istate)\n \t\t\tif (!ui->mode[i])\n \t\t\t\tcontinue;\n \t\t\tprintf(\"%s%06o %s %d\\t\", tag_resolve_undo, ui->mode[i],\n-\t\t\t       find_unique_abbrev(&ui->oid[i], abbrev),\n+\t\t\t       repo_find_unique_abbrev(the_repository, &ui->oid[i], abbrev),\n \t\t\t       i + 1);\n \t\t\twrite_name(path);\n \t\t}\n@@ -578,7 +578,7 @@ void overlay_tree_on_index(struct index_state *istate,\n \tread_tree_fn_t fn = NULL;\n \tint err;\n \n-\tif (get_oid(tree_name, &oid))\n+\tif (repo_get_oid(the_repository, tree_name, &oid))\n \t\tdie(\"tree-ish %s not found.\", tree_name);\n \ttree = parse_tree_indirect(&oid);\n \tif (!tree)\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 64d8e54318c..568088b6d66 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -229,7 +229,7 @@ static int show_tree_default(const struct object_id *oid, struct strbuf *base,\n \t\treturn early;\n \n \tprintf(\"%06o %s %s\\t\", mode, type_name(object_type(mode)),\n-\t       find_unique_abbrev(oid, options->abbrev));\n+\t       repo_find_unique_abbrev(the_repository, oid, options->abbrev));\n \tshow_tree_common_default_long(options, base, pathname, base->len);\n \treturn recurse;\n }\n@@ -260,7 +260,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \t}\n \n \tprintf(\"%06o %s %s %7s\\t\", mode, type_name(type),\n-\t       find_unique_abbrev(oid, options->abbrev), size_text);\n+\t       repo_find_unique_abbrev(the_repository, oid, options->abbrev),\n+\t       size_text);\n \tshow_tree_common_default_long(options, base, pathname, base->len);\n \treturn recurse;\n }\n@@ -311,7 +312,7 @@ static int show_tree_object(const struct object_id *oid, struct strbuf *base,\n \tif (early >= 0)\n \t\treturn early;\n \n-\tstr = find_unique_abbrev(oid, options->abbrev);\n+\tstr = repo_find_unique_abbrev(the_repository, oid, options->abbrev);\n \tif (options->null_termination) {\n \t\tfputs(str, stdout);\n \t\tfputc('\\0', stdout);\n@@ -434,7 +435,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)\n \t\t\tls_tree_usage, ls_tree_options);\n \tif (argc < 1)\n \t\tusage_with_options(ls_tree_usage, ls_tree_options);\n-\tif (get_oid(argv[0], &oid))\n+\tif (repo_get_oid(the_repository, argv[0], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[0]);\n \n \t/*\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex be8f3b221c9..5b0ed0d2738 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -43,7 +43,7 @@ static struct commit *get_commit_reference(const char *arg)\n \tstruct object_id revkey;\n \tstruct commit *r;\n \n-\tif (get_oid(arg, &revkey))\n+\tif (repo_get_oid(the_repository, arg, &revkey))\n \t\tdie(\"Not a valid object name %s\", arg);\n \tr = lookup_commit_reference(the_repository, &revkey);\n \tif (!r)\n@@ -119,7 +119,7 @@ static int handle_fork_point(int argc, const char **argv)\n \tconst char *commitname;\n \n \tcommitname = (argc == 2) ? argv[1] : \"HEAD\";\n-\tif (get_oid(commitname, &oid))\n+\tif (repo_get_oid(the_repository, commitname, &oid))\n \t\tdie(\"Not a valid object name: '%s'\", commitname);\n \n \tderived = lookup_commit_reference(the_repository, &oid);\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex b9acbf5d342..a50b328d943 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -49,7 +49,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)\n \t\t}\n \t\tif (bases_count < ARRAY_SIZE(bases)-1) {\n \t\t\tstruct object_id *oid = xmalloc(sizeof(struct object_id));\n-\t\t\tif (get_oid(argv[i], oid))\n+\t\t\tif (repo_get_oid(the_repository, argv[i], oid))\n \t\t\t\tdie(_(\"could not parse object '%s'\"), argv[i]);\n \t\t\tbases[bases_count++] = oid;\n \t\t}\n@@ -70,9 +70,9 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)\n \to.branch1 = argv[++i];\n \to.branch2 = argv[++i];\n \n-\tif (get_oid(o.branch1, &h1))\n+\tif (repo_get_oid(the_repository, o.branch1, &h1))\n \t\tdie(_(\"could not resolve ref '%s'\"), o.branch1);\n-\tif (get_oid(o.branch2, &h2))\n+\tif (repo_get_oid(the_repository, o.branch2, &h2))\n \t\tdie(_(\"could not resolve ref '%s'\"), o.branch2);\n \n \to.branch1 = better1 = better_branch_name(o.branch1);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 19c31d4ff48..6a0519c39db 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -339,7 +339,7 @@ static int save_state(struct object_id *stash)\n \telse if (!len)\t\t/* no changes */\n \t\tgoto out;\n \tstrbuf_setlen(&buffer, buffer.len-1);\n-\tif (get_oid(buffer.buf, stash))\n+\tif (repo_get_oid(the_repository, buffer.buf, stash))\n \t\tdie(_(\"not a valid object: %s\"), buffer.buf);\n \trc = 0;\n out:\n@@ -1566,10 +1566,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \n \t\tif (verbosity >= 0) {\n \t\t\tprintf(_(\"Updating %s..%s\\n\"),\n-\t\t\t       find_unique_abbrev(&head_commit->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV),\n-\t\t\t       find_unique_abbrev(&remoteheads->item->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &head_commit->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV),\n+\t\t\t       repo_find_unique_abbrev(the_repository, &remoteheads->item->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV));\n \t\t}\n \t\tcommit = remoteheads->item;\n \t\tif (!commit) {\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 723ba616a88..cd9c000f56b 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -494,7 +494,8 @@ static void show_name(const struct object *obj,\n \telse if (allow_undefined)\n \t\tprintf(\"undefined\\n\");\n \telse if (always)\n-\t\tprintf(\"%s\\n\", find_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\tprintf(\"%s\\n\",\n+\t\t       repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \telse\n \t\tdie(\"cannot describe '%s'\", oid_to_hex(oid));\n \tstrbuf_release(&buf);\n@@ -528,7 +529,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)\n \t\t\tcounter = 0;\n \n \t\t\t*(p+1) = 0;\n-\t\t\tif (!get_oid(p - (hexsz - 1), &oid)) {\n+\t\t\tif (!repo_get_oid(the_repository, p - (hexsz - 1), &oid)) {\n \t\t\t\tstruct object *o =\n \t\t\t\t\tlookup_object(the_repository, &oid);\n \t\t\t\tif (o)\n@@ -605,7 +606,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)\n \t\tstruct object *object;\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(*argv, &oid)) {\n+\t\tif (repo_get_oid(the_repository, *argv, &oid)) {\n \t\t\tfprintf(stderr, \"Could not get sha1 for %s. Skipping.\\n\",\n \t\t\t\t\t*argv);\n \t\t\tcontinue;\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 75ce7f3f574..73c9c691781 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -259,7 +259,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)\n \tif (d->buf.len)\n \t\tstrbuf_addch(&d->buf, '\\n');\n \n-\tif (get_oid(arg, &object))\n+\tif (repo_get_oid(the_repository, arg, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), arg);\n \tif (!(buf = read_object_file(&object, &type, &len)))\n \t\tdie(_(\"failed to read object '%s'.\"), arg);\n@@ -309,9 +309,9 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd)\n \t\t\tdie(_(\"malformed input line: '%s'.\"), buf.buf);\n \t\tstrbuf_rtrim(split[0]);\n \t\tstrbuf_rtrim(split[1]);\n-\t\tif (get_oid(split[0]->buf, &from_obj))\n+\t\tif (repo_get_oid(the_repository, split[0]->buf, &from_obj))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), split[0]->buf);\n-\t\tif (get_oid(split[1]->buf, &to_obj))\n+\t\tif (repo_get_oid(the_repository, split[1]->buf, &to_obj))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), split[1]->buf);\n \n \t\tif (rewrite_cmd)\n@@ -379,7 +379,7 @@ static int list(int argc, const char **argv, const char *prefix)\n \n \tt = init_notes_check(\"list\", 0);\n \tif (argc) {\n-\t\tif (get_oid(argv[0], &object))\n+\t\tif (repo_get_oid(the_repository, argv[0], &object))\n \t\t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), argv[0]);\n \t\tnote = get_note(t, &object);\n \t\tif (note) {\n@@ -434,7 +434,7 @@ static int add(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = argc > 1 ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"add\", NOTES_INIT_WRITABLE);\n@@ -522,12 +522,12 @@ static int copy(int argc, const char **argv, const char *prefix)\n \t\tusage_with_options(git_notes_copy_usage, options);\n \t}\n \n-\tif (get_oid(argv[0], &from_obj))\n+\tif (repo_get_oid(the_repository, argv[0], &from_obj))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), argv[0]);\n \n \tobject_ref = 1 < argc ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"copy\", NOTES_INIT_WRITABLE);\n@@ -606,7 +606,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = 1 < argc ? argv[1] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(argv[0], NOTES_INIT_WRITABLE);\n@@ -668,7 +668,7 @@ static int show(int argc, const char **argv, const char *prefix)\n \n \tobject_ref = argc ? argv[0] : \"HEAD\";\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tt = init_notes_check(\"show\", 0);\n@@ -718,7 +718,7 @@ static int merge_commit(struct notes_merge_options *o)\n \t * and target notes ref from .git/NOTES_MERGE_REF.\n \t */\n \n-\tif (get_oid(\"NOTES_MERGE_PARTIAL\", &oid))\n+\tif (repo_get_oid(the_repository, \"NOTES_MERGE_PARTIAL\", &oid))\n \t\tdie(_(\"failed to read ref NOTES_MERGE_PARTIAL\"));\n \telse if (!(partial = lookup_commit_reference(the_repository, &oid)))\n \t\tdie(_(\"could not find commit from NOTES_MERGE_PARTIAL.\"));\n@@ -897,7 +897,7 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag\n {\n \tint status;\n \tstruct object_id oid;\n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn error(_(\"Failed to resolve '%s' as a valid ref.\"), name);\n \tstatus = remove_note(t, oid.hash);\n \tif (status)\ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 119a253a2ad..202f7367746 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -172,7 +172,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)\n \t\tstruct object_id oid;\n \t\tconst char *name = *argv++;\n \n-\t\tif (!get_oid(name, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n \t\t\tstruct object *object = parse_object_or_die(&oid,\n \t\t\t\t\t\t\t\t    name);\n \t\t\tadd_pending_object(&revs, object, \"\");\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 56f679d94a0..bc0f29064b3 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -1031,7 +1031,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (file_exists(git_path_merge_head(the_repository)))\n \t\tdie_conclude_merge();\n \n-\tif (get_oid(\"HEAD\", &orig_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &orig_head))\n \t\toidclr(&orig_head);\n \n \tif (opt_rebase) {\n@@ -1056,7 +1056,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (opt_dry_run)\n \t\treturn 0;\n \n-\tif (get_oid(\"HEAD\", &curr_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &curr_head))\n \t\toidclr(&curr_head);\n \n \tif (!is_null_oid(&orig_head) && !is_null_oid(&curr_head) &&\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex aecfae12d3a..556ee84b6d3 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -65,20 +65,20 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)\n \n \tif (dash_dash == 3 ||\n \t    (dash_dash < 0 && argc > 2 &&\n-\t     !get_oid_committish(argv[0], &oid) &&\n-\t     !get_oid_committish(argv[1], &oid) &&\n-\t     !get_oid_committish(argv[2], &oid))) {\n+\t     !repo_get_oid_committish(the_repository, argv[0], &oid) &&\n+\t     !repo_get_oid_committish(the_repository, argv[1], &oid) &&\n+\t     !repo_get_oid_committish(the_repository, argv[2], &oid))) {\n \t\tif (dash_dash < 0)\n \t\t\t; /* already validated arguments */\n-\t\telse if (get_oid_committish(argv[0], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[0], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[0]);\n-\t\telse if (get_oid_committish(argv[1], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[1], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[1]);\n-\t\telse if (get_oid_committish(argv[2], &oid))\n+\t\telse if (repo_get_oid_committish(the_repository, argv[2], &oid))\n \t\t\tusage_msg_optf(_(\"not a revision: '%s'\"),\n \t\t\t\t       builtin_range_diff_usage, options,\n \t\t\t\t       argv[2]);\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 11759c415f3..fe19852634b 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -199,7 +199,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)\n \tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \n-\t\tif (get_oid(arg, &oid))\n+\t\tif (repo_get_oid(the_repository, arg, &oid))\n \t\t\tdie(\"Not a valid object name %s\", arg);\n \t\tif (list_tree(&oid) < 0)\n \t\t\tdie(\"failed to unpack tree object %s\", arg);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 5b7b908b66b..55ecc2d5f33 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -219,13 +219,15 @@ static int get_revision_ranges(struct commit *upstream, struct commit *onto,\n \t*revisions = xstrfmt(\"%s...%s\", oid_to_hex(&base_rev->object.oid),\n \t\t\t     oid_to_hex(orig_head));\n \n-\tshorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);\n+\tshorthead = repo_find_unique_abbrev(the_repository, orig_head,\n+\t\t\t\t\t    DEFAULT_ABBREV);\n \n \tif (upstream) {\n \t\tconst char *shortrev;\n \n-\t\tshortrev = find_unique_abbrev(&base_rev->object.oid,\n-\t\t\t\t\t      DEFAULT_ABBREV);\n+\t\tshortrev = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t   &base_rev->object.oid,\n+\t\t\t\t\t\t   DEFAULT_ABBREV);\n \n \t\t*shortrevisions = xstrfmt(\"%s..%s\", shortrev, shorthead);\n \t} else\n@@ -1262,7 +1264,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\tint fd;\n \n \t\t/* Sanity check */\n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\tdie(_(\"Cannot read HEAD\"));\n \n \t\tfd = repo_hold_locked_index(the_repository, &lock_file, 0);\n@@ -1681,7 +1683,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t} else if (!options.onto_name)\n \t\toptions.onto_name = options.upstream_name;\n \tif (strstr(options.onto_name, \"...\")) {\n-\t\tif (get_oid_mb(options.onto_name, &branch_base) < 0) {\n+\t\tif (repo_get_oid_mb(the_repository, options.onto_name, &branch_base) < 0) {\n \t\t\tif (keep_base)\n \t\t\t\tdie(_(\"'%s': need exactly one merge base with branch\"),\n \t\t\t\t    options.upstream_name);\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex cccdb73807c..c6ab537a44f 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1344,7 +1344,7 @@ static int head_has_history(void)\n {\n \tstruct object_id oid;\n \n-\treturn !get_oid(\"HEAD\", &oid);\n+\treturn !repo_get_oid(the_repository, \"HEAD\", &oid);\n }\n \n static const char *push_to_deploy(unsigned char *sha1,\n@@ -1680,11 +1680,11 @@ static void check_aliased_update_internal(struct command *cmd,\n \trp_error(\"refusing inconsistent update between symref '%s' (%s..%s) and\"\n \t\t \" its target '%s' (%s..%s)\",\n \t\t cmd->ref_name,\n-\t\t find_unique_abbrev(&cmd->old_oid, DEFAULT_ABBREV),\n-\t\t find_unique_abbrev(&cmd->new_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &cmd->old_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &cmd->new_oid, DEFAULT_ABBREV),\n \t\t dst_cmd->ref_name,\n-\t\t find_unique_abbrev(&dst_cmd->old_oid, DEFAULT_ABBREV),\n-\t\t find_unique_abbrev(&dst_cmd->new_oid, DEFAULT_ABBREV));\n+\t\t repo_find_unique_abbrev(the_repository, &dst_cmd->old_oid, DEFAULT_ABBREV),\n+\t\t repo_find_unique_abbrev(the_repository, &dst_cmd->new_oid, DEFAULT_ABBREV));\n \n \tcmd->error_string = dst_cmd->error_string =\n \t\t\"inconsistent aliased update\";\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 71d8e949e35..f765a3e2d75 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -56,7 +56,7 @@ static int show_reference(struct repository *r, const char *refname,\n \t\t\tstruct object_id object;\n \t\t\tenum object_type obj_type, repl_type;\n \n-\t\t\tif (get_oid(refname, &object))\n+\t\t\tif (repo_get_oid(the_repository, refname, &object))\n \t\t\t\treturn error(_(\"failed to resolve '%s' as a valid ref\"), refname);\n \n \t\t\tobj_type = oid_object_info(r, &object, NULL);\n@@ -114,7 +114,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)\n \tbase_len = ref.len;\n \n \tfor (p = argv; *p; p++) {\n-\t\tif (get_oid(*p, &oid)) {\n+\t\tif (repo_get_oid(the_repository, *p, &oid)) {\n \t\t\terror(\"failed to resolve '%s' as a valid ref\", *p);\n \t\t\thad_error = 1;\n \t\t\tcontinue;\n@@ -208,10 +208,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f\n {\n \tstruct object_id object, repl;\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\treturn error(_(\"failed to resolve '%s' as a valid ref\"),\n \t\t\t     object_ref);\n-\tif (get_oid(replace_ref, &repl))\n+\tif (repo_get_oid(the_repository, replace_ref, &repl))\n \t\treturn error(_(\"failed to resolve '%s' as a valid ref\"),\n \t\t\t     replace_ref);\n \n@@ -322,7 +322,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)\n \tstruct object_id old_oid, new_oid, prev;\n \tstruct strbuf ref = STRBUF_INIT;\n \n-\tif (get_oid(object_ref, &old_oid) < 0)\n+\tif (repo_get_oid(the_repository, object_ref, &old_oid) < 0)\n \t\treturn error(_(\"not a valid object name: '%s'\"), object_ref);\n \n \ttype = oid_object_info(the_repository, &old_oid, NULL);\n@@ -377,7 +377,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)\n \t\tstruct object_id oid;\n \t\tstruct commit *commit;\n \n-\t\tif (get_oid(argv[i], &oid) < 0) {\n+\t\tif (repo_get_oid(the_repository, argv[i], &oid) < 0) {\n \t\t\tstrbuf_release(&new_parents);\n \t\t\treturn error(_(\"not a valid object name: '%s'\"),\n \t\t\t\t     argv[i]);\n@@ -424,7 +424,7 @@ static int check_one_mergetag(struct commit *commit,\n \t/* iterate over new parents */\n \tfor (i = 1; i < mergetag_data->argc; i++) {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(mergetag_data->argv[i], &oid) < 0)\n+\t\tif (repo_get_oid(the_repository, mergetag_data->argv[i], &oid) < 0)\n \t\t\treturn error(_(\"not a valid object name: '%s'\"),\n \t\t\t\t     mergetag_data->argv[i]);\n \t\tif (oideq(get_tagged_oid(tag), &oid))\n@@ -454,7 +454,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)\n \tconst char *buffer;\n \tunsigned long size;\n \n-\tif (get_oid(old_ref, &old_oid) < 0)\n+\tif (repo_get_oid(the_repository, old_ref, &old_oid) < 0)\n \t\treturn error(_(\"not a valid object name: '%s'\"), old_ref);\n \tcommit = lookup_commit_reference(the_repository, &old_oid);\n \tif (!commit)\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 24b04aeecb9..cd4165537c5 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -90,7 +90,7 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t\n \n \tif (reset_type == KEEP) {\n \t\tstruct object_id head_oid;\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\treturn error(_(\"You do not have a valid HEAD.\"));\n \t\tif (!fill_tree_descriptor(the_repository, desc + nr, &head_oid))\n \t\t\treturn error(_(\"Failed to find tree of HEAD.\"));\n@@ -125,7 +125,7 @@ static void print_new_head_line(struct commit *commit)\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tprintf(_(\"HEAD is now at %s\"),\n-\t\tfind_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\trepo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \n \tpp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);\n \tif (buf.len > 0)\n@@ -261,8 +261,8 @@ static void parse_args(struct pathspec *pathspec,\n \t\t * has to be unambiguous. If there is a single argument, it\n \t\t * can not be a tree\n \t\t */\n-\t\telse if ((!argv[1] && !get_oid_committish(argv[0], &unused)) ||\n-\t\t\t (argv[1] && !get_oid_treeish(argv[0], &unused))) {\n+\t\telse if ((!argv[1] && !repo_get_oid_committish(the_repository, argv[0], &unused)) ||\n+\t\t\t (argv[1] && !repo_get_oid_treeish(the_repository, argv[0], &unused))) {\n \t\t\t/*\n \t\t\t * Ok, argv[0] looks like a commit/tree; it should not\n \t\t\t * be a filename.\n@@ -289,9 +289,9 @@ static int reset_refs(const char *rev, const struct object_id *oid)\n \tstruct object_id *orig = NULL, oid_orig,\n \t\t*old_orig = NULL, oid_old_orig;\n \n-\tif (!get_oid(\"ORIG_HEAD\", &oid_old_orig))\n+\tif (!repo_get_oid(the_repository, \"ORIG_HEAD\", &oid_old_orig))\n \t\told_orig = &oid_old_orig;\n-\tif (!get_oid(\"HEAD\", &oid_orig)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &oid_orig)) {\n \t\torig = &oid_orig;\n \t\tset_reflog_message(&msg, \"updating ORIG_HEAD\", NULL);\n \t\tupdate_ref(msg.buf, \"ORIG_HEAD\", orig, old_orig, 0,\n@@ -367,13 +367,14 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\tdie(_(\"the option '%s' requires '%s'\"), \"--pathspec-file-nul\", \"--pathspec-from-file\");\n \t}\n \n-\tunborn = !strcmp(rev, \"HEAD\") && get_oid(\"HEAD\", &oid);\n+\tunborn = !strcmp(rev, \"HEAD\") && repo_get_oid(the_repository, \"HEAD\",\n+\t\t\t\t\t\t      &oid);\n \tif (unborn) {\n \t\t/* reset on unborn branch: treat as reset to empty tree */\n \t\toidcpy(&oid, the_hash_algo->empty_tree);\n \t} else if (!pathspec.nr && !patch_mode) {\n \t\tstruct commit *commit;\n-\t\tif (get_oid_committish(rev, &oid))\n+\t\tif (repo_get_oid_committish(the_repository, rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid revision.\"), rev);\n \t\tcommit = lookup_commit_reference(the_repository, &oid);\n \t\tif (!commit)\n@@ -381,7 +382,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\toidcpy(&oid, &commit->object.oid);\n \t} else {\n \t\tstruct tree *tree;\n-\t\tif (get_oid_treeish(rev, &oid))\n+\t\tif (repo_get_oid_treeish(the_repository, rev, &oid))\n \t\t\tdie(_(\"Failed to resolve '%s' as a valid tree.\"), rev);\n \t\ttree = parse_tree_indirect(&oid);\n \t\tif (!tree)\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 85e522dff8a..e88affc2764 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -135,7 +135,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tif (!revs->graph)\n \t\t\tfputs(get_revision_mark(revs, commit), stdout);\n \t\tif (revs->abbrev_commit && revs->abbrev)\n-\t\t\tfputs(find_unique_abbrev(&commit->object.oid, revs->abbrev),\n+\t\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),\n \t\t\t      stdout);\n \t\telse\n \t\t\tfputs(oid_to_hex(&commit->object.oid), stdout);\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex e1fa9c6348c..5db9d6ad518 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -164,7 +164,8 @@ static void show_rev(int type, const struct object_id *oid, const char *name)\n \t\t}\n \t}\n \telse if (abbrev)\n-\t\tshow_with_type(type, find_unique_abbrev(oid, abbrev));\n+\t\tshow_with_type(type,\n+\t\t\t       repo_find_unique_abbrev(the_repository, oid, abbrev));\n \telse\n \t\tshow_with_type(type, oid_to_hex(oid));\n }\n@@ -189,7 +190,7 @@ static int show_default(void)\n \t\tstruct object_id oid;\n \n \t\tdef = NULL;\n-\t\tif (!get_oid(s, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, s, &oid)) {\n \t\t\tshow_rev(NORMAL, &oid, s);\n \t\t\treturn 1;\n \t\t}\n@@ -281,7 +282,7 @@ static int try_difference(const char *arg)\n \t\treturn 0;\n \t}\n \n-\tif (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {\n+\tif (!repo_get_oid_committish(the_repository, start, &start_oid) && !repo_get_oid_committish(the_repository, end, &end_oid)) {\n \t\tshow_rev(NORMAL, &end_oid, end);\n \t\tshow_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);\n \t\tif (symmetric) {\n@@ -339,7 +340,7 @@ static int try_parent_shorthands(const char *arg)\n \t\treturn 0;\n \n \t*dotdot = 0;\n-\tif (get_oid_committish(arg, &oid) ||\n+\tif (repo_get_oid_committish(the_repository, arg, &oid) ||\n \t    !(commit = lookup_commit_reference(the_repository, &oid))) {\n \t\t*dotdot = '^';\n \t\treturn 0;\n@@ -870,7 +871,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (skip_prefix(arg, \"--disambiguate=\", &arg)) {\n-\t\t\t\tfor_each_abbrev(arg, show_abbrev, NULL);\n+\t\t\t\trepo_for_each_abbrev(the_repository, arg,\n+\t\t\t\t\t\t     show_abbrev, NULL);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--bisect\")) {\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex dc198f79082..e093cb99966 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -371,7 +371,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t */\n \tif (!force) {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(\"HEAD\", &oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\t\toidclr(&oid);\n \t\tif (check_local_mod(&oid, index_only))\n \t\t\texit(1);\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 8342b68aef7..9d208db3b43 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -313,8 +313,8 @@ static void show_one_commit(struct commit *commit, int no_name)\n \t\t}\n \t\telse\n \t\t\tprintf(\"[%s] \",\n-\t\t\t       find_unique_abbrev(&commit->object.oid,\n-\t\t\t\t\t\t  DEFAULT_ABBREV));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t\t\t       DEFAULT_ABBREV));\n \t}\n \tputs(pretty_str);\n \tstrbuf_release(&pretty);\n@@ -415,7 +415,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))\n+\tif (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -430,7 +430,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,\n \t/* If both heads/foo and tags/foo exists, get_sha1 would\n \t * get confused.\n \t */\n-\tif (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))\n+\tif (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))\n \t\tofs = 5;\n \treturn append_ref(refname + ofs, oid, 0);\n }\n@@ -534,7 +534,7 @@ static int show_independent(struct commit **rev,\n static void append_one_rev(const char *av)\n {\n \tstruct object_id revkey;\n-\tif (!get_oid(av, &revkey)) {\n+\tif (!repo_get_oid(the_repository, av, &revkey)) {\n \t\tappend_ref(av, &revkey, 0);\n \t\treturn;\n \t}\n@@ -837,7 +837,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tdie(Q_(\"cannot handle more than %d rev.\",\n \t\t\t       \"cannot handle more than %d revs.\",\n \t\t\t       MAX_REVS), MAX_REVS);\n-\t\tif (get_oid(ref_name[num_rev], &revkey))\n+\t\tif (repo_get_oid(the_repository, ref_name[num_rev], &revkey))\n \t\t\tdie(_(\"'%s' is not a valid ref.\"), ref_name[num_rev]);\n \t\tcommit = lookup_commit_reference(the_repository, &revkey);\n \t\tif (!commit)\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 1f28d7fe4b9..b5a68e23e65 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -34,7 +34,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \tif (quiet)\n \t\treturn;\n \n-\thex = find_unique_abbrev(oid, abbrev);\n+\thex = repo_find_unique_abbrev(the_repository, oid, abbrev);\n \tif (hash_only)\n \t\tprintf(\"%s\\n\", hex);\n \telse\n@@ -44,7 +44,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \t\treturn;\n \n \tif (!peel_iterated_oid(oid, &peeled)) {\n-\t\thex = find_unique_abbrev(&peeled, abbrev);\n+\t\thex = repo_find_unique_abbrev(the_repository, &peeled, abbrev);\n \t\tprintf(\"%s %s^{}\\n\", hex, refname);\n \t}\n }\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 8d5ae6f2a60..d73d3d2d825 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -469,7 +469,7 @@ static int sparse_checkout_init(int argc, const char **argv, const char *prefix)\n \t\treturn update_working_directory(NULL);\n \t}\n \n-\tif (get_oid(\"HEAD\", &oid)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n \t\tFILE *fp;\n \n \t\t/* assume we are in a fresh repo, but update the sparse-checkout file */\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 6a12fed2713..dd5f67e7e6e 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -202,7 +202,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n \n \trevision = info->revision.buf;\n \n-\tif (get_oid(revision, &info->w_commit))\n+\tif (repo_get_oid(the_repository, revision, &info->w_commit))\n \t\treturn error(_(\"%s is not a valid reference\"), revision);\n \n \tassert_stash_like(info, revision);\n@@ -232,7 +232,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n static int do_clear_stash(void)\n {\n \tstruct object_id obj;\n-\tif (get_oid(ref_stash, &obj))\n+\tif (repo_get_oid(the_repository, ref_stash, &obj))\n \t\treturn 0;\n \n \treturn delete_ref(NULL, ref_stash, &obj, 0);\n@@ -1084,7 +1084,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)\n \tint ret = 0;\n \n \t/* No initial commit. */\n-\tif (get_oid(\"HEAD\", &dummy))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &dummy))\n \t\treturn -1;\n \n \tif (repo_read_index(the_repository) < 0)\n@@ -1356,7 +1356,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b\n \t\tgoto done;\n \t}\n \n-\tif (get_oid(\"HEAD\", &info->b_commit)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &info->b_commit)) {\n \t\tif (!quiet)\n \t\t\tfprintf_ln(stderr, _(\"You do not have \"\n \t\t\t\t\t     \"the initial commit yet\"));\n@@ -1374,8 +1374,9 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b\n \tbranch_ref = resolve_ref_unsafe(\"HEAD\", 0, NULL, &flags);\n \tif (flags & REF_ISSYMREF)\n \t\tskip_prefix(branch_ref, \"refs/heads/\", &branch_name);\n-\thead_short_sha1 = find_unique_abbrev(&head_commit->object.oid,\n-\t\t\t\t\t     DEFAULT_ABBREV);\n+\thead_short_sha1 = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t\t  &head_commit->object.oid,\n+\t\t\t\t\t\t  DEFAULT_ABBREV);\n \tstrbuf_addf(&msg, \"%s: %s \", branch_name, head_short_sha1);\n \tpp_commit_easy(CMIT_FMT_ONELINE, head_commit, &msg);\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d05d1a84623..b21857479de 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1176,7 +1176,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)\n \tif (!summary_limit)\n \t\treturn 0;\n \n-\tif (!get_oid(argc ? argv[0] : \"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(the_repository, argc ? argv[0] : \"HEAD\", &head_oid)) {\n \t\tif (argc) {\n \t\t\targv++;\n \t\t\targc--;\n@@ -1189,7 +1189,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)\n \t\t\targc--;\n \t\t}\n \t} else {\n-\t\tif (get_oid(\"HEAD\", &head_oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head_oid))\n \t\t\tdie(_(\"could not fetch a revision for HEAD\"));\n \t}\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex adcaa547b0d..7af7eaa4139 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -138,7 +138,7 @@ static int delete_tags(const char **argv)\n \t\tif (!ref_exists(name))\n \t\t\tprintf(_(\"Deleted tag '%s' (was %s)\\n\"),\n \t\t\t\titem->string + 10,\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \n \t\tfree(oid);\n \t}\n@@ -590,7 +590,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tif (argc > 2)\n \t\tdie(_(\"too many arguments\"));\n \n-\tif (get_oid(object_ref, &object))\n+\tif (repo_get_oid(the_repository, object_ref, &object))\n \t\tdie(_(\"Failed to resolve '%s' as a valid ref.\"), object_ref);\n \n \tif (strbuf_check_tag_ref(&ref, tag))\n@@ -631,7 +631,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tref_transaction_free(transaction);\n \tif (force && !is_null_oid(&prev) && !oideq(&prev, &object))\n \t\tprintf(_(\"Updated tag '%s' (was %s)\\n\"), tag,\n-\t\t       find_unique_abbrev(&prev, DEFAULT_ABBREV));\n+\t\t       repo_find_unique_abbrev(the_repository, &prev, DEFAULT_ABBREV));\n \n cleanup:\n \tref_sorting_release(sorting);\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex e9b105a5397..b9e258a553f 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -30,7 +30,7 @@ int cmd_unpack_file(int argc, const char **argv, const char *prefix)\n \n \tif (argc != 2 || !strcmp(argv[1], \"-h\"))\n \t\tusage(\"git unpack-file <blob>\");\n-\tif (get_oid(argv[1], &oid))\n+\tif (repo_get_oid(the_repository, argv[1], &oid))\n \t\tdie(\"Not a valid object name %s\", argv[1]);\n \n \tgit_config(git_default_config, NULL);\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex a84e7b47a20..1ba0727ba77 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -116,7 +116,7 @@ static int parse_next_oid(const char **next, const char *end,\n \t\t(*next)++;\n \t\t*next = parse_arg(*next, &arg);\n \t\tif (arg.len) {\n-\t\t\tif (get_oid(arg.buf, oid))\n+\t\t\tif (repo_get_oid(the_repository, arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else {\n \t\t\t/* Without -z, an empty value means all zeros: */\n@@ -134,7 +134,7 @@ static int parse_next_oid(const char **next, const char *end,\n \t\t*next += arg.len;\n \n \t\tif (arg.len) {\n-\t\t\tif (get_oid(arg.buf, oid))\n+\t\t\tif (repo_get_oid(the_repository, arg.buf, oid))\n \t\t\t\tgoto invalid;\n \t\t} else if (flags & PARSE_SHA1_ALLOW_EMPTY) {\n \t\t\t/* With -z, treat an empty value as all zeros: */\n@@ -549,7 +549,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\trefname = argv[0];\n \t\tvalue = argv[1];\n \t\toldval = argv[2];\n-\t\tif (get_oid(value, &oid))\n+\t\tif (repo_get_oid(the_repository, value, &oid))\n \t\t\tdie(\"%s: not a valid SHA1\", value);\n \t}\n \n@@ -560,7 +560,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\t\t * must not already exist:\n \t\t\t */\n \t\t\toidclr(&oldoid);\n-\t\telse if (get_oid(oldval, &oldoid))\n+\t\telse if (repo_get_oid(the_repository, oldval, &oldoid))\n \t\t\tdie(\"%s: not a valid old SHA1\", oldval);\n \t}\n \ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 7aedf10e856..2a0c927ee93 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -39,7 +39,7 @@ static int verify_commit(const char *name, unsigned flags)\n \tstruct object_id oid;\n \tstruct object *obj;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn error(\"commit '%s' not found.\", name);\n \n \tobj = parse_object(the_repository, &oid);\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5c00b0b0f77..2a9aac43b85 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -52,7 +52,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n \t\tstruct object_id oid;\n \t\tconst char *name = argv[i++];\n \n-\t\tif (get_oid(name, &oid)) {\n+\t\tif (repo_get_oid(the_repository, name, &oid)) {\n \t\t\thad_error = !!error(\"tag '%s' not found.\", name);\n \t\t\tcontinue;\n \t\t}\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 80d05e246d8..62c02fe2dee 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -553,7 +553,7 @@ static void print_preparing_worktree_line(int detach,\n \t\telse\n \t\t\tfprintf_ln(stderr, _(\"Preparing worktree (resetting branch '%s'; was at %s)\"),\n \t\t\t\t  new_branch,\n-\t\t\t\t  find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\t\t  repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \t} else if (new_branch) {\n \t\tfprintf_ln(stderr, _(\"Preparing worktree (new branch '%s')\"), new_branch);\n \t} else {\n@@ -567,7 +567,7 @@ static void print_preparing_worktree_line(int detach,\n \t\t\tif (!commit)\n \t\t\t\tdie(_(\"invalid reference: %s\"), branch);\n \t\t\tfprintf_ln(stderr, _(\"Preparing worktree (detached HEAD %s)\"),\n-\t\t\t\t  find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));\n+\t\t\t\t  repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));\n \t\t}\n \t\tstrbuf_release(&s);\n \t}\n@@ -757,7 +757,7 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)\n \t\tstrbuf_addstr(&sb, \"(bare)\");\n \telse {\n \t\tstrbuf_addf(&sb, \"%-*s \", abbrev_len,\n-\t\t\t\tfind_unique_abbrev(&wt->head_oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, &wt->head_oid, DEFAULT_ABBREV));\n \t\tif (wt->is_detached)\n \t\t\tstrbuf_addstr(&sb, \"(detached HEAD)\");\n \t\telse if (wt->head_ref) {\n@@ -794,7 +794,7 @@ static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)\n \n \t\tif (path_len > *maxlen)\n \t\t\t*maxlen = path_len;\n-\t\tsha1_len = strlen(find_unique_abbrev(&wt[i]->head_oid, *abbrev));\n+\t\tsha1_len = strlen(repo_find_unique_abbrev(the_repository, &wt[i]->head_oid, *abbrev));\n \t\tif (sha1_len > *abbrev)\n \t\t\t*abbrev = sha1_len;\n \t}\ndiff --git a/cache.h b/cache.h\nindex 5a736a2b7e7..1d05a8e945f 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1103,9 +1103,7 @@ void check_repository_format(struct repository_format *fmt);\n  * reentrant, as it calls into other non-reentrant git code.\n  */\n const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);\n-#define find_unique_abbrev(oid, len) repo_find_unique_abbrev(the_repository, oid, len)\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n-#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n /* set default permissions by passing mode arguments to open(2) */\n int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n@@ -1330,17 +1328,8 @@ enum get_oid_result get_oid_with_context(struct repository *repo, const char *st\n \t\t\t\t\t unsigned flags, struct object_id *oid,\n \t\t\t\t\t struct object_context *oc);\n \n-#define get_oid(str, oid)\t\trepo_get_oid(the_repository, str, oid)\n-#define get_oid_commit(str, oid)\trepo_get_oid_commit(the_repository, str, oid)\n-#define get_oid_committish(str, oid)\trepo_get_oid_committish(the_repository, str, oid)\n-#define get_oid_tree(str, oid)\t\trepo_get_oid_tree(the_repository, str, oid)\n-#define get_oid_treeish(str, oid)\trepo_get_oid_treeish(the_repository, str, oid)\n-#define get_oid_blob(str, oid)\t\trepo_get_oid_blob(the_repository, str, oid)\n-#define get_oid_mb(str, oid) \t\trepo_get_oid_mb(the_repository, str, oid)\n-\n typedef int each_abbrev_fn(const struct object_id *oid, void *);\n int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);\n-#define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)\n \n int set_disambiguate_hint_config(const char *var, const char *value);\n \n@@ -1388,8 +1377,6 @@ int repo_interpret_branch_name(struct repository *r,\n \t\t\t       const char *str, int len,\n \t\t\t       struct strbuf *buf,\n \t\t\t       const struct interpret_branch_name_options *options);\n-#define interpret_branch_name(str, len, buf, options) \\\n-\trepo_interpret_branch_name(the_repository, str, len, buf, options)\n \n int validate_headref(const char *ref);\n \n@@ -1409,8 +1396,6 @@ void *read_object_with_reference(struct repository *r,\n struct object *repo_peel_to_type(struct repository *r,\n \t\t\t\t const char *name, int namelen,\n \t\t\t\t struct object *o, enum object_type);\n-#define peel_to_type(name, namelen, obj, type) \\\n-\trepo_peel_to_type(the_repository, name, namelen, obj, type)\n \n const char *git_editor(void);\n const char *git_sequence_editor(void);\ndiff --git a/checkout.c b/checkout.c\nindex 2e39dae684f..1247b882248 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -23,7 +23,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)\n \tmemset(&query, 0, sizeof(struct refspec_item));\n \tquery.src = cb->src_ref;\n \tif (remote_find_tracking(remote, &query) ||\n-\t    get_oid(query.dst, cb->dst_oid)) {\n+\t    repo_get_oid(the_repository, query.dst, cb->dst_oid)) {\n \t\tfree(query.dst);\n \t\treturn 0;\n \t}\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 91051dc3258..e917362faf7 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -949,11 +949,11 @@ static void show_combined_header(struct combine_diff_path *elem,\n \t\t\t \"\", elem->path, line_prefix, c_meta, c_reset);\n \tprintf(\"%s%sindex \", line_prefix, c_meta);\n \tfor (i = 0; i < num_parent; i++) {\n-\t\tabb = find_unique_abbrev(&elem->parent[i].oid,\n-\t\t\t\t\t abbrev);\n+\t\tabb = repo_find_unique_abbrev(the_repository,\n+\t\t\t\t\t      &elem->parent[i].oid, abbrev);\n \t\tprintf(\"%s%s\", i ? \",\" : \"\", abb);\n \t}\n-\tabb = find_unique_abbrev(&elem->oid, abbrev);\n+\tabb = repo_find_unique_abbrev(the_repository, &elem->oid, abbrev);\n \tprintf(\"..%s%s\\n\", abb, c_reset);\n \n \tif (mode_differs) {\ndiff --git a/commit.c b/commit.c\nindex 7b63d3b0e1c..c0b1db3d3e1 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -81,7 +81,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)\n \tstruct object_id oid;\n \tstruct commit *commit;\n \n-\tif (get_oid_committish(name, &oid))\n+\tif (repo_get_oid_committish(the_repository, name, &oid))\n \t\treturn NULL;\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (parse_commit(commit))\n@@ -1274,7 +1274,8 @@ void verify_merge_signature(struct commit *commit, int verbosity,\n \n \tret = check_commit_signature(commit, &signature_check);\n \n-\tfind_unique_abbrev_r(hex, &commit->object.oid, DEFAULT_ABBREV);\n+\trepo_find_unique_abbrev_r(the_repository, hex, &commit->object.oid,\n+\t\t\t\t  DEFAULT_ABBREV);\n \tswitch (signature_check.result) {\n \tcase 'G':\n \t\tif (ret || (check_trust && signature_check.trust_level < TRUST_MARGINAL))\n@@ -1635,10 +1636,11 @@ struct commit *get_merge_parent(const char *name)\n \tstruct object *obj;\n \tstruct commit *commit;\n \tstruct object_id oid;\n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn NULL;\n \tobj = parse_object(the_repository, &oid);\n-\tcommit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);\n+\tcommit = (struct commit *)repo_peel_to_type(the_repository, name, 0,\n+\t\t\t\t\t\t    obj, OBJ_COMMIT);\n \tif (commit && !merge_remote_util(commit))\n \t\tset_merge_remote_desc(commit, name, obj);\n \treturn commit;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nnew file mode 100644\nindex 00000000000..dcdba314fc2\n--- /dev/null\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -0,0 +1,44 @@\n+// Fully migrated \"the_repository\" additions\n+@@\n+@@\n+(\n+// cache.h\n+- get_oid\n++ repo_get_oid\n+|\n+- get_oid_commit\n++ repo_get_oid_commit\n+|\n+- get_oid_committish\n++ repo_get_oid_committish\n+|\n+- get_oid_tree\n++ repo_get_oid_tree\n+|\n+- get_oid_treeish\n++ repo_get_oid_treeish\n+|\n+- get_oid_blob\n++ repo_get_oid_blob\n+|\n+- get_oid_mb\n++ repo_get_oid_mb\n+|\n+- find_unique_abbrev\n++ repo_find_unique_abbrev\n+|\n+- find_unique_abbrev_r\n++ repo_find_unique_abbrev_r\n+|\n+- for_each_abbrev\n++ repo_for_each_abbrev\n+|\n+- interpret_branch_name\n++ repo_interpret_branch_name\n+|\n+- peel_to_type\n++ repo_peel_to_type\n+)\n+  (\n++ the_repository,\n+  ...)\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 8b3f2580e6b..2d200ab83e7 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,44 +5,7 @@\n @@\n @@\n (\n-// cache.h\n-- get_oid\n-+ repo_get_oid\n-|\n-- get_oid_commit\n-+ repo_get_oid_commit\n-|\n-- get_oid_committish\n-+ repo_get_oid_committish\n-|\n-- get_oid_tree\n-+ repo_get_oid_tree\n-|\n-- get_oid_treeish\n-+ repo_get_oid_treeish\n-|\n-- get_oid_blob\n-+ repo_get_oid_blob\n-|\n-- get_oid_mb\n-+ repo_get_oid_mb\n-|\n-- find_unique_abbrev\n-+ repo_find_unique_abbrev\n-|\n-- find_unique_abbrev_r\n-+ repo_find_unique_abbrev_r\n-|\n-- for_each_abbrev\n-+ repo_for_each_abbrev\n-|\n-- interpret_branch_name\n-+ repo_interpret_branch_name\n-|\n-- peel_to_type\n-+ repo_peel_to_type\n // commit-reach.h\n-|\n - get_merge_bases\n + repo_get_merge_bases\n |\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 70b3578b907..628e13c8b03 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -582,7 +582,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)\n \tif (revs->pending.nr == 1) {\n \t\tstruct object_id oid;\n \n-\t\tif (get_oid(\"HEAD\", &oid))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\t\tdie(_(\"unable to get HEAD\"));\n \n \t\tmb_child[1] = lookup_commit_reference(the_repository, &oid);\ndiff --git a/diff.c b/diff.c\nindex 1617aa50a98..81f115d32c9 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4364,7 +4364,7 @@ static int similarity_index(struct diff_filepair *p)\n static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)\n {\n \tif (startup_info->have_repository)\n-\t\treturn find_unique_abbrev(oid, abbrev);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid, abbrev);\n \telse {\n \t\tchar *hex = oid_to_hex(oid);\n \t\tif (abbrev < 0)\n@@ -5000,7 +5000,7 @@ static int diff_opt_find_object(const struct option *option,\n \tstruct object_id oid;\n \n \tBUG_ON_OPT_NEG(unset);\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"unable to resolve '%s'\"), arg);\n \n \tif (!opt->objfind)\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex 24cc44bdbc9..bb56d957a64 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -603,7 +603,9 @@ static void find_merge_parents(struct merge_parents *result,\n \t\t * util field yet.\n \t\t */\n \t\tobj = parse_object(the_repository, &oid);\n-\t\tparent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);\n+\t\tparent = (struct commit *)repo_peel_to_type(the_repository,\n+\t\t\t\t\t\t\t    NULL, 0, obj,\n+\t\t\t\t\t\t\t    OBJ_COMMIT);\n \t\tif (!parent)\n \t\t\tcontinue;\n \t\tcommit_list_insert(parent, &parents);\ndiff --git a/log-tree.c b/log-tree.c\nindex 3adcb576e4c..49411c5c6a6 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -236,7 +236,8 @@ static void show_parents(struct commit *commit, int abbrev, FILE *file)\n \tstruct commit_list *p;\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n-\t\tfprintf(file, \" %s\", find_unique_abbrev(&parent->object.oid, abbrev));\n+\t\tfprintf(file, \" %s\",\n+\t\t\trepo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev));\n \t}\n }\n \n@@ -244,7 +245,8 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre\n {\n \tstruct commit_list *p = lookup_decoration(&opt->children, &commit->object);\n \tfor ( ; p; p = p->next) {\n-\t\tfprintf(opt->diffopt.file, \" %s\", find_unique_abbrev(&p->item->object.oid, abbrev));\n+\t\tfprintf(opt->diffopt.file, \" %s\",\n+\t\t\trepo_find_unique_abbrev(the_repository, &p->item->object.oid, abbrev));\n \t}\n }\n \n@@ -647,7 +649,8 @@ void show_log(struct rev_info *opt)\n \n \t\tif (!opt->graph)\n \t\t\tput_revision_mark(opt, commit);\n-\t\tfputs(find_unique_abbrev(&commit->object.oid, abbrev_commit), opt->diffopt.file);\n+\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev_commit),\n+\t\t      opt->diffopt.file);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit, opt->diffopt.file);\n \t\tif (opt->children.name)\n@@ -709,8 +712,8 @@ void show_log(struct rev_info *opt)\n \n \t\tif (!opt->graph)\n \t\t\tput_revision_mark(opt, commit);\n-\t\tfputs(find_unique_abbrev(&commit->object.oid,\n-\t\t\t\t\t abbrev_commit),\n+\t\tfputs(repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t\t      abbrev_commit),\n \t\t      opt->diffopt.file);\n \t\tif (opt->print_parents)\n \t\t\tshow_parents(commit, abbrev_commit, opt->diffopt.file);\n@@ -718,7 +721,7 @@ void show_log(struct rev_info *opt)\n \t\t\tshow_children(opt, commit, abbrev_commit);\n \t\tif (parent)\n \t\t\tfprintf(opt->diffopt.file, \" (from %s)\",\n-\t\t\t       find_unique_abbrev(&parent->object.oid, abbrev_commit));\n+\t\t\t       repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev_commit));\n \t\tfputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), opt->diffopt.file);\n \t\tshow_decorations(opt, commit);\n \t\tif (opt->commit_format == CMIT_FMT_ONELINE) {\ndiff --git a/mailmap.c b/mailmap.c\nindex da2589b0822..ed8289aea58 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -213,7 +213,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)\n \n \tif (!name)\n \t\treturn 0;\n-\tif (get_oid(name, &oid) < 0)\n+\tif (repo_get_oid(the_repository, name, &oid) < 0)\n \t\treturn 0;\n \n \tbuf = read_object_file(&oid, &type, &size);\ndiff --git a/notes-merge.c b/notes-merge.c\nindex 5b1a9ff13f7..f9137ec768f 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -567,7 +567,7 @@ int notes_merge(struct notes_merge_options *o,\n \ttrace_printf(\"\\tlocal commit: %.7s\\n\", oid_to_hex(&local_oid));\n \n \t/* Dereference o->remote_ref into remote_oid */\n-\tif (get_oid(o->remote_ref, &remote_oid)) {\n+\tif (repo_get_oid(the_repository, o->remote_ref, &remote_oid)) {\n \t\t/*\n \t\t * Failed to get remote_oid. If o->remote_ref looks like an\n \t\t * unborn ref, perform the merge using an empty notes tree.\ndiff --git a/notes.c b/notes.c\nindex a7187236e98..427cfdac294 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -946,7 +946,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob)\n \t\tfor_each_glob_ref(string_list_add_one_ref, glob, list);\n \t} else {\n \t\tstruct object_id oid;\n-\t\tif (get_oid(glob, &oid))\n+\t\tif (repo_get_oid(the_repository, glob, &oid))\n \t\t\twarning(\"notes ref %s is invalid\", glob);\n \t\tif (!unsorted_string_list_has_string(list, glob))\n \t\t\tstring_list_append(list, glob);\n@@ -1023,7 +1023,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,\n \tt->dirty = 0;\n \n \tif (flags & NOTES_INIT_EMPTY || !notes_ref ||\n-\t    get_oid_treeish(notes_ref, &object_oid))\n+\t    repo_get_oid_treeish(the_repository, notes_ref, &object_oid))\n \t\treturn;\n \tif (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))\n \t\tdie(\"Cannot use notes ref %s\", notes_ref);\n@@ -1350,7 +1350,7 @@ void expand_loose_notes_ref(struct strbuf *sb)\n {\n \tstruct object_id object;\n \n-\tif (get_oid(sb->buf, &object)) {\n+\tif (repo_get_oid(the_repository, sb->buf, &object)) {\n \t\t/* fallback to expand_notes_ref */\n \t\texpand_notes_ref(sb);\n \t}\ndiff --git a/object-name.c b/object-name.c\nindex 69db1ec498a..19ba23216a5 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1667,7 +1667,8 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)\n \tstruct interpret_branch_name_options options = {\n \t\t.allowed = allowed\n \t};\n-\tint used = interpret_branch_name(name, len, sb, &options);\n+\tint used = repo_interpret_branch_name(the_repository, name, len, sb,\n+\t\t\t\t\t      &options);\n \n \tif (used < 0)\n \t\tused = 0;\n@@ -1720,7 +1721,7 @@ int get_oidf(struct object_id *oid, const char *fmt, ...)\n \tstrbuf_vaddf(&sb, fmt, ap);\n \tva_end(ap);\n \n-\tret = get_oid(sb.buf, oid);\n+\tret = repo_get_oid(the_repository, sb.buf, oid);\n \tstrbuf_release(&sb);\n \n \treturn ret;\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex d346dbe2100..0f7b40d0c08 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -91,7 +91,7 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)\n \n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(\"malformed object name %s\", arg);\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (!commit)\n@@ -110,7 +110,7 @@ int parse_opt_commit(const struct option *opt, const char *arg, int unset)\n \n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(\"malformed object name %s\", arg);\n \tcommit = lookup_commit_reference(the_repository, &oid);\n \tif (!commit)\n@@ -129,7 +129,7 @@ int parse_opt_object_name(const struct option *opt, const char *arg, int unset)\n \t}\n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"malformed object name '%s'\"), arg);\n \toid_array_append(opt->value, &oid);\n \treturn 0;\n@@ -146,7 +146,7 @@ int parse_opt_object_id(const struct option *opt, const char *arg, int unset)\n \t}\n \tif (!arg)\n \t\treturn -1;\n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\treturn error(_(\"malformed object name '%s'\"), arg);\n \t*target = oid;\n \treturn 0;\ndiff --git a/range-diff.c b/range-diff.c\nindex 4bd65ab7496..5bcf966f6c5 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -94,7 +94,7 @@ static int read_patches(const char *range, struct string_list *list,\n \t\t\t\tstrbuf_reset(&buf);\n \t\t\t}\n \t\t\tCALLOC_ARRAY(util, 1);\n-\t\t\tif (get_oid(p, &util->oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p, &util->oid)) {\n \t\t\t\terror(_(\"could not parse commit '%s'\"), p);\n \t\t\t\tFREE_AND_NULL(util);\n \t\t\t\tstring_list_clear(list, 1);\n@@ -390,7 +390,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \n \tif (!dashes->len)\n \t\tstrbuf_addchars(dashes, '-',\n-\t\t\t\tstrlen(find_unique_abbrev(oid, abbrev)));\n+\t\t\t\tstrlen(repo_find_unique_abbrev(the_repository, oid, abbrev)));\n \n \tif (!b_util) {\n \t\tcolor = color_old;\n@@ -412,7 +412,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \t\tstrbuf_addf(buf, \"%*s:  %s \", patch_no_width, \"-\", dashes->buf);\n \telse\n \t\tstrbuf_addf(buf, \"%*d:  %s \", patch_no_width, a_util->i + 1,\n-\t\t\t    find_unique_abbrev(&a_util->oid, abbrev));\n+\t\t\t    repo_find_unique_abbrev(the_repository, &a_util->oid, abbrev));\n \n \tif (status == '!')\n \t\tstrbuf_addf(buf, \"%s%s\", color_reset, color);\n@@ -424,7 +424,7 @@ static void output_pair_header(struct diff_options *diffopt,\n \t\tstrbuf_addf(buf, \" %*s:  %s\", patch_no_width, \"-\", dashes->buf);\n \telse\n \t\tstrbuf_addf(buf, \" %*d:  %s\", patch_no_width, b_util->i + 1,\n-\t\t\t    find_unique_abbrev(&b_util->oid, abbrev));\n+\t\t\t    repo_find_unique_abbrev(the_repository, &b_util->oid, abbrev));\n \n \tcommit = lookup_commit_reference(the_repository, oid);\n \tif (commit) {\ndiff --git a/read-cache.c b/read-cache.c\nindex 1bcf6732718..c1d47b9fc83 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2630,7 +2630,7 @@ int repo_index_has_changes(struct repository *repo,\n \n \tif (tree)\n \t\tcmp = tree->object.oid;\n-\tif (tree || !get_oid_tree(\"HEAD\", &cmp)) {\n+\tif (tree || !repo_get_oid_tree(the_repository, \"HEAD\", &cmp)) {\n \t\tstruct diff_options opt;\n \n \t\trepo_diff_setup(repo, &opt);\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7407c593191..c151db0ad2f 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -187,7 +187,7 @@ int todo_list_check(struct todo_list *old_todo, struct todo_list *new_todo)\n \t\tstruct commit *commit = item->commit;\n \t\tif (commit && !*commit_seen_at(&commit_seen, commit)) {\n \t\t\tstrbuf_addf(&missing, \" - %s %.*s\\n\",\n-\t\t\t\t    find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV),\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),\n \t\t\t\t    item->arg_len,\n \t\t\t\t    todo_item_get_arg(old_todo, item));\n \t\t\t*commit_seen_at(&commit_seen, commit) = 1;\ndiff --git a/ref-filter.c b/ref-filter.c\nindex ed802778da7..4982841b3da 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1093,9 +1093,11 @@ static const char *do_grab_oid(const char *field, const struct object_id *oid,\n \tcase O_FULL:\n \t\treturn oid_to_hex(oid);\n \tcase O_LENGTH:\n-\t\treturn find_unique_abbrev(oid, atom->u.oid.length);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid,\n+\t\t\t\t\t       atom->u.oid.length);\n \tcase O_SHORT:\n-\t\treturn find_unique_abbrev(oid, DEFAULT_ABBREV);\n+\t\treturn repo_find_unique_abbrev(the_repository, oid,\n+\t\t\t\t\t       DEFAULT_ABBREV);\n \tdefault:\n \t\tBUG(\"unknown %%(%s) option\", field);\n \t}\n@@ -2783,7 +2785,7 @@ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)\n \n \tBUG_ON_OPT_NEG(unset);\n \n-\tif (get_oid(arg, &oid))\n+\tif (repo_get_oid(the_repository, arg, &oid))\n \t\tdie(_(\"malformed object name %s\"), arg);\n \n \tmerge_commit = lookup_commit_reference_gently(the_repository, &oid, 0);\ndiff --git a/remote.c b/remote.c\nindex b04e5da3383..a0f22c8751e 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1165,7 +1165,7 @@ static int try_explicit_object_name(const char *name,\n \t\treturn 0;\n \t}\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn -1;\n \n \tif (match) {\n@@ -1253,7 +1253,7 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,\n \tif (!advice_enabled(ADVICE_PUSH_UNQUALIFIED_REF_NAME))\n \t\treturn;\n \n-\tif (get_oid(matched_src_name, &oid))\n+\tif (repo_get_oid(the_repository, matched_src_name, &oid))\n \t\tBUG(\"'%s' is not a valid object, \"\n \t\t    \"match_explicit_lhs() should catch this!\",\n \t\t    matched_src_name);\n@@ -2507,7 +2507,7 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i\n \t\tentry->use_tracking = 1;\n \telse if (!colon[1])\n \t\toidclr(&entry->expect);\n-\telse if (get_oid(colon + 1, &entry->expect))\n+\telse if (repo_get_oid(the_repository, colon + 1, &entry->expect))\n \t\treturn error(_(\"cannot parse expected object name '%s'\"),\n \t\t\t     colon + 1);\n \treturn 0;\ndiff --git a/reset.c b/reset.c\nindex 58b3829ff73..8c471e22d99 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -39,7 +39,7 @@ static int update_refs(const struct reset_head_opts *opts,\n \tprefix_len = msg.len;\n \n \tif (update_orig_head) {\n-\t\tif (!get_oid(\"ORIG_HEAD\", &oid_old_orig))\n+\t\tif (!repo_get_oid(the_repository, \"ORIG_HEAD\", &oid_old_orig))\n \t\t\told_orig = &oid_old_orig;\n \t\tif (head) {\n \t\t\tif (!reflog_orig_head) {\n@@ -107,7 +107,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)\n \t\tgoto leave_reset_head;\n \t}\n \n-\tif (!get_oid(\"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n \t\thead = &head_oid;\n \t} else if (!oid || !reset_hard) {\n \t\tret = error(_(\"could not determine HEAD revision\"));\ndiff --git a/revision.c b/revision.c\nindex e4c066e90b7..e08f697c47c 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -326,7 +326,8 @@ static void add_pending_object_with_path(struct rev_info *revs,\n \tif (revs->reflog_info && obj->type == OBJ_COMMIT) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tsize_t namelen = strlen(name);\n-\t\tint len = interpret_branch_name(name, namelen, &buf, &options);\n+\t\tint len = repo_interpret_branch_name(the_repository, name,\n+\t\t\t\t\t\t     namelen, &buf, &options);\n \n \t\tif (0 < len && len < namelen && buf.len)\n \t\t\tstrbuf_addstr(&buf, name + len);\n@@ -356,7 +357,7 @@ void add_head_to_pending(struct rev_info *revs)\n {\n \tstruct object_id oid;\n \tstruct object *obj;\n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\treturn;\n \tobj = parse_object(revs->repo, &oid);\n \tif (!obj)\n@@ -1870,7 +1871,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,\n \t\tflags ^= UNINTERESTING | BOTTOM;\n \t\targ++;\n \t}\n-\tif (get_oid_committish(arg, &oid))\n+\tif (repo_get_oid_committish(the_repository, arg, &oid))\n \t\treturn 0;\n \twhile (1) {\n \t\tit = get_reference(revs, arg, &oid, 0);\n@@ -1951,10 +1952,10 @@ static void prepare_show_merge(struct rev_info *revs)\n \tint i, prune_num = 1; /* counting terminating NULL */\n \tstruct index_state *istate = revs->repo->index;\n \n-\tif (get_oid(\"HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid))\n \t\tdie(\"--merge without HEAD?\");\n \thead = lookup_commit_or_die(&oid, \"HEAD\");\n-\tif (get_oid(\"MERGE_HEAD\", &oid))\n+\tif (repo_get_oid(the_repository, \"MERGE_HEAD\", &oid))\n \t\tdie(\"--merge without MERGE_HEAD?\");\n \tother = lookup_commit_or_die(&oid, \"MERGE_HEAD\");\n \tadd_pending_object(revs, &head->object, \"HEAD\");\ndiff --git a/sequencer.c b/sequencer.c\nindex 3be23d7ca20..d73827632d8 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -417,7 +417,8 @@ struct commit_message {\n \n static const char *short_commit_name(struct commit *commit)\n {\n-\treturn find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t       DEFAULT_ABBREV);\n }\n \n static int get_message(struct commit *commit, struct commit_message *out)\n@@ -559,7 +560,7 @@ static void update_abort_safety_file(void)\n \tif (!file_exists(git_path_seq_dir()))\n \t\treturn;\n \n-\tif (!get_oid(\"HEAD\", &head))\n+\tif (!repo_get_oid(the_repository, \"HEAD\", &head))\n \t\twrite_file(git_path_abort_safety_file(), \"%s\", oid_to_hex(&head));\n \telse\n \t\twrite_file(git_path_abort_safety_file(), \"%s\", \"\");\n@@ -1404,7 +1405,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \tstruct commit *current_head;\n \tstruct object_id oid;\n \n-\tif (get_oid(\"HEAD\", &oid)) {\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n \t\tcurrent_head = NULL;\n \t} else {\n \t\tcurrent_head = lookup_commit_reference(r, &oid);\n@@ -1995,7 +1996,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstruct commit *head_commit;\n \t\tconst char *head_message, *body;\n \n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n@@ -2065,7 +2066,7 @@ static void flush_rewritten_pending(void)\n \tFILE *out;\n \n \tif (strbuf_read_file(&buf, rebase_path_rewritten_pending(), (GIT_MAX_HEXSZ + 1) * 2) > 0 &&\n-\t    !get_oid(\"HEAD\", &newoid) &&\n+\t    !repo_get_oid(the_repository, \"HEAD\", &newoid) &&\n \t    (out = fopen_or_warn(rebase_path_rewritten_list(), \"a\"))) {\n \t\tchar *bol = buf.buf, *eol;\n \n@@ -2150,7 +2151,7 @@ static int do_pick_commit(struct repository *r,\n \t\tif (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))\n \t\t\treturn error(_(\"your index file is unmerged.\"));\n \t} else {\n-\t\tunborn = get_oid(\"HEAD\", &head);\n+\t\tunborn = repo_get_oid(the_repository, \"HEAD\", &head);\n \t\t/* Do we want to generate a root commit? */\n \t\tif (is_pick_or_similar(command) && opts->have_squash_onto &&\n \t\t    oideq(&head, &opts->squash_onto)) {\n@@ -2604,7 +2605,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \tend_of_object_name = (char *) bol + strcspn(bol, \" \\t\\n\");\n \tsaved = *end_of_object_name;\n \t*end_of_object_name = '\\0';\n-\tstatus = get_oid(bol, &commit_oid);\n+\tstatus = repo_get_oid(the_repository, bol, &commit_oid);\n \tif (status < 0)\n \t\terror(_(\"could not parse '%s'\"), bol); /* return later */\n \t*end_of_object_name = saved;\n@@ -3025,7 +3026,7 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\t}\n \n \t\tif (read_oneliner(&buf, rebase_path_squash_onto(), 0)) {\n-\t\t\tif (get_oid_committish(buf.buf, &opts->squash_onto) < 0) {\n+\t\t\tif (repo_get_oid_committish(the_repository, buf.buf, &opts->squash_onto) < 0) {\n \t\t\t\tret = error(_(\"unusable squash-onto\"));\n \t\t\t\tgoto done_rebase_i;\n \t\t\t}\n@@ -3226,7 +3227,7 @@ static int rollback_is_safe(void)\n \telse\n \t\tdie_errno(_(\"could not read '%s'\"), git_path_abort_safety_file());\n \n-\tif (get_oid(\"HEAD\", &actual_head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &actual_head))\n \t\toidclr(&actual_head);\n \n \treturn oideq(&actual_head, &expected_head);\n@@ -3537,7 +3538,7 @@ static int intend_to_amend(void)\n \tstruct object_id head;\n \tchar *p;\n \n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\treturn error(_(\"cannot read HEAD\"));\n \n \tp = oid_to_hex(&head);\n@@ -3703,7 +3704,7 @@ static int do_label(struct repository *r, const char *name, int len)\n \tif (!transaction) {\n \t\terror(\"%s\", err.buf);\n \t\tret = -1;\n-\t} else if (get_oid(\"HEAD\", &head_oid)) {\n+\t} else if (repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n \t\terror(_(\"could not read HEAD\"));\n \t\tret = -1;\n \t} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,\n@@ -4459,7 +4460,7 @@ void create_autostash(struct repository *r, const char *path)\n \t\tif (capture_command(&stash, &buf, GIT_MAX_HEXSZ))\n \t\t\tdie(_(\"Cannot autostash\"));\n \t\tstrbuf_trim_trailing_newline(&buf);\n-\t\tif (get_oid(buf.buf, &oid))\n+\t\tif (repo_get_oid(the_repository, buf.buf, &oid))\n \t\t\tdie(_(\"Unexpected stash response: '%s'\"),\n \t\t\t    buf.buf);\n \t\tstrbuf_reset(&buf);\n@@ -4584,7 +4585,7 @@ static int stopped_at_head(struct repository *r)\n \tstruct commit *commit;\n \tstruct commit_message message;\n \n-\tif (get_oid(\"HEAD\", &head) ||\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n \t    parse_commit(commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n@@ -4734,7 +4735,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t * otherwise we do not.\n \t\t\t\t */\n \t\t\t\tif (item->command == TODO_REWORD &&\n-\t\t\t\t    !get_oid(\"HEAD\", &oid) &&\n+\t\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n \t\t\t\t    (oideq(&item->commit->object.oid, &oid) ||\n \t\t\t\t     (opts->have_squash_onto &&\n \t\t\t\t      oideq(&opts->squash_onto, &oid))))\n@@ -4823,7 +4824,7 @@ static int pick_commits(struct repository *r,\n \t\t\tstruct object_id head, orig;\n \t\t\tint res;\n \n-\t\t\tif (get_oid(\"HEAD\", &head)) {\n+\t\t\tif (repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\t\t\tres = error(_(\"cannot read HEAD\"));\n cleanup_head_ref:\n \t\t\t\tstrbuf_release(&head_ref);\n@@ -4870,8 +4871,8 @@ static int pick_commits(struct repository *r,\n \t\t\tlog_tree_opt.disable_stdin = 1;\n \n \t\t\tif (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n-\t\t\t    !get_oid(buf.buf, &orig) &&\n-\t\t\t    !get_oid(\"HEAD\", &head)) {\n+\t\t\t    !repo_get_oid(the_repository, buf.buf, &orig) &&\n+\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\t\t\tdiff_tree_oid(&orig, &head, \"\",\n \t\t\t\t\t      &log_tree_opt.diffopt);\n \t\t\t\tlog_tree_diff_flush(&log_tree_opt);\n@@ -4963,7 +4964,7 @@ static int commit_staged_changes(struct repository *r,\n \t\tstruct strbuf rev = STRBUF_INIT;\n \t\tstruct object_id head, to_amend;\n \n-\t\tif (get_oid(\"HEAD\", &head))\n+\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\t\treturn error(_(\"cannot amend non-existing commit\"));\n \t\tif (!read_oneliner(&rev, rebase_path_amend(), 0))\n \t\t\treturn error(_(\"invalid file: '%s'\"), rebase_path_amend());\n@@ -5188,7 +5189,7 @@ int sequencer_pick_revisions(struct repository *r,\n \t\tif (!strlen(name))\n \t\t\tcontinue;\n \n-\t\tif (!get_oid(name, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n \t\t\tif (!lookup_commit_reference_gently(r, &oid, 1)) {\n \t\t\t\tenum object_type type = oid_object_info(r,\n \t\t\t\t\t\t\t\t\t&oid,\n@@ -5231,7 +5232,7 @@ int sequencer_pick_revisions(struct repository *r,\n \tif (walk_revs_populate_todo(&todo_list, opts) ||\n \t\t\tcreate_seq_dir(r) < 0)\n \t\treturn -1;\n-\tif (get_oid(\"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n \t\treturn error(_(\"can't revert as initial commit\"));\n \tif (save_head(oid_to_hex(&oid)))\n \t\treturn -1;\n@@ -5363,7 +5364,8 @@ static const char *label_oid(struct object_id *oid, const char *label,\n \t\tstrbuf_grow(&state->buf, GIT_MAX_HEXSZ);\n \t\tlabel = p = state->buf.buf;\n \n-\t\tfind_unique_abbrev_r(p, oid, default_abbrev);\n+\t\trepo_find_unique_abbrev_r(the_repository, p, oid,\n+\t\t\t\t\t  default_abbrev);\n \n \t\t/*\n \t\t * We may need to extend the abbreviated hash so that there is\n@@ -6096,7 +6098,8 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla\n \tstruct object_id oid = onto->object.oid;\n \tint res;\n \n-\tfind_unique_abbrev_r(shortonto, &oid, DEFAULT_ABBREV);\n+\trepo_find_unique_abbrev_r(the_repository, shortonto, &oid,\n+\t\t\t\t  DEFAULT_ABBREV);\n \n \tif (buf->len == 0) {\n \t\tstruct todo_item *item = append_new_todo(todo_list);\n@@ -6372,8 +6375,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)\n \t\tif (file_exists(git_path_seq_dir()))\n \t\t\t*whence = FROM_CHERRY_PICK_MULTI;\n \t\tif (file_exists(rebase_path()) &&\n-\t\t    !get_oid(\"REBASE_HEAD\", &rebase_head) &&\n-\t\t    !get_oid(\"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n+\t\t    !repo_get_oid(the_repository, \"REBASE_HEAD\", &rebase_head) &&\n+\t\t    !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n \t\t    oideq(&rebase_head, &cherry_pick_head))\n \t\t\t*whence = FROM_REBASE_PICK;\n \t\telse\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 89a7bf0a93d..57972c3e131 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -537,7 +537,7 @@ static int gitmodule_oid_from_commit(const struct object_id *treeish_name,\n \t}\n \n \tstrbuf_addf(rev, \"%s:.gitmodules\", oid_to_hex(treeish_name));\n-\tif (get_oid(rev->buf, gitmodules_oid) >= 0)\n+\tif (repo_get_oid(the_repository, rev->buf, gitmodules_oid) >= 0)\n \t\tret = 1;\n \n \treturn ret;\ndiff --git a/submodule.c b/submodule.c\nindex 2a057c35b74..f028044e2dc 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -66,7 +66,7 @@ int is_writing_gitmodules_ok(void)\n {\n \tstruct object_id oid;\n \treturn file_exists(GITMODULES_FILE) ||\n-\t\t(get_oid(GITMODULES_INDEX, &oid) < 0 && get_oid(GITMODULES_HEAD, &oid) < 0);\n+\t\t(repo_get_oid(the_repository, GITMODULES_INDEX, &oid) < 0 && repo_get_oid(the_repository, GITMODULES_HEAD, &oid) < 0);\n }\n \n /*\n@@ -1626,7 +1626,7 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,\n \t\tif (!task->repo) {\n \t\t\tstrbuf_addf(err, _(\"Could not access submodule '%s' at commit %s\\n\"),\n \t\t\t\t    cs_data->path,\n-\t\t\t\t    find_unique_abbrev(cs_data->super_oid, DEFAULT_ABBREV));\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, cs_data->super_oid, DEFAULT_ABBREV));\n \n \t\t\tfetch_task_release(task);\n \t\t\tfree(task);\n@@ -1637,8 +1637,8 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,\n \t\t\tstrbuf_addf(err,\n \t\t\t\t    _(\"Fetching submodule %s%s at commit %s\\n\"),\n \t\t\t\t    spf->prefix, task->sub->path,\n-\t\t\t\t    find_unique_abbrev(cs_data->super_oid,\n-\t\t\t\t\t\t       DEFAULT_ABBREV));\n+\t\t\t\t    repo_find_unique_abbrev(the_repository, cs_data->super_oid,\n+\t\t\t\t\t\t\t    DEFAULT_ABBREV));\n \n \t\tspf->changed_count++;\n \t\t/*\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex b1edb92a032..3f8d5761780 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -26,7 +26,8 @@\n \n static const char *short_commit_name(struct commit *commit)\n {\n-\treturn find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n+\t\t\t\t       DEFAULT_ABBREV);\n }\n \n static struct commit *peel_committish(const char *name)\n@@ -34,10 +35,11 @@ static struct commit *peel_committish(const char *name)\n \tstruct object *obj;\n \tstruct object_id oid;\n \n-\tif (get_oid(name, &oid))\n+\tif (repo_get_oid(the_repository, name, &oid))\n \t\treturn NULL;\n \tobj = parse_object(the_repository, &oid);\n-\treturn (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);\n+\treturn (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,\n+\t\t\t\t\t\t  OBJ_COMMIT);\n }\n \n static char *get_author(const char *message)\n@@ -120,7 +122,7 @@ int cmd__fast_rebase(int argc, const char **argv)\n \tstrbuf_addf(&branch_name, \"refs/heads/%s\", argv[4]);\n \n \t/* Sanity check */\n-\tif (get_oid(\"HEAD\", &head))\n+\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n \t\tdie(_(\"Cannot read HEAD\"));\n \tassert(oideq(&onto->object.oid, &head));\n \ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 04bc2563f3e..f2ae92ca2c8 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -10,9 +10,9 @@ int cmd__match_trees(int ac, const char **av)\n \n \tsetup_git_directory();\n \n-\tif (get_oid(av[1], &hash1))\n+\tif (repo_get_oid(the_repository, av[1], &hash1))\n \t\tdie(\"cannot parse %s as an object name\", av[1]);\n-\tif (get_oid(av[2], &hash2))\n+\tif (repo_get_oid(the_repository, av[2], &hash2))\n \t\tdie(\"cannot parse %s as an object name\", av[2]);\n \tone = parse_tree_indirect(&hash1);\n \tif (!one)\ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex 883d40efd45..8c9b6e7f695 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -50,7 +50,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\tif (!strcmp(\"put\", cmd) && p1 && p2) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -68,7 +68,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\t} else if (!strcmp(\"get\", cmd) && p1) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\n@@ -81,7 +81,7 @@ int cmd__oidmap(int argc, const char **argv)\n \n \t\t} else if (!strcmp(\"remove\", cmd) && p1) {\n \n-\t\t\tif (get_oid(p1, &oid)) {\n+\t\t\tif (repo_get_oid(the_repository, p1, &oid)) {\n \t\t\t\tprintf(\"Unknown oid: %s\\n\", p1);\n \t\t\t\tcontinue;\n \t\t\t}\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex de8f26639d4..afb9bb3189f 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -58,7 +58,7 @@ int cmd__reach(int ac, const char **av)\n \t\tif (buf.len < 3)\n \t\t\tcontinue;\n \n-\t\tif (get_oid_committish(buf.buf + 2, &oid))\n+\t\tif (repo_get_oid_committish(the_repository, buf.buf + 2, &oid))\n \t\t\tdie(\"failed to resolve %s\", buf.buf + 2);\n \n \t\torig = parse_object(r, &oid);\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 22a41c40926..91c82d4159d 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -42,7 +42,7 @@ int cmd__submodule_config(int argc, const char **argv)\n \n \t\tif (commit[0] == '\\0')\n \t\t\toidclr(&commit_oid);\n-\t\telse if (get_oid(commit, &commit_oid) < 0)\n+\t\telse if (repo_get_oid(the_repository, commit, &commit_oid) < 0)\n \t\t\tdie_usage(argc, argv, \"Commit not found.\");\n \n \t\tif (lookup_name) {\ndiff --git a/tag.c b/tag.c\nindex 18b718cca66..85c348ad824 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -52,7 +52,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\treturn error(\"%s: cannot verify a non-tag object of type %s.\",\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV),\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),\n \t\t\t\ttype_name(type));\n \n \tbuf = read_object_file(oid, &type, &size);\n@@ -60,7 +60,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\treturn error(\"%s: unable to read file.\",\n \t\t\t\tname_to_report ?\n \t\t\t\tname_to_report :\n-\t\t\t\tfind_unique_abbrev(oid, DEFAULT_ABBREV));\n+\t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));\n \n \tret = run_gpg_verify(buf, size, flags);\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 82ac63e2609..1939763ab5d 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -1082,7 +1082,7 @@ static int push_refs_with_export(struct transport *transport,\n \t\tstruct object_id oid;\n \n \t\tprivate = apply_refspecs(&data->rs, ref->name);\n-\t\tif (private && !get_oid(private, &oid)) {\n+\t\tif (private && !repo_get_oid(the_repository, private, &oid)) {\n \t\t\tstrbuf_addf(&buf, \"^%s\", private);\n \t\t\tstring_list_append_nodup(&revlist_args,\n \t\t\t\t\t\t strbuf_detach(&buf, NULL));\ndiff --git a/transport.c b/transport.c\nindex 906dbad5a08..dbbfeb8d010 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -779,7 +779,8 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count,\n static int measure_abbrev(const struct object_id *oid, int sofar)\n {\n \tchar hex[GIT_MAX_HEXSZ + 1];\n-\tint w = find_unique_abbrev_r(hex, oid, DEFAULT_ABBREV);\n+\tint w = repo_find_unique_abbrev_r(the_repository, hex, oid,\n+\t\t\t\t\t  DEFAULT_ABBREV);\n \n \treturn (w < sofar) ? sofar : w;\n }\ndiff --git a/wt-status.c b/wt-status.c\nindex 90525bd26fd..0f0b92eece4 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1338,7 +1338,7 @@ static void abbrev_oid_in_line(struct strbuf *line)\n \t\t * it after abbreviation.\n \t\t */\n \t\tstrbuf_trim(split[1]);\n-\t\tif (!get_oid(split[1]->buf, &oid)) {\n+\t\tif (!repo_get_oid(the_repository, split[1]->buf, &oid)) {\n \t\t\tstrbuf_reset(split[1]);\n \t\t\tstrbuf_add_unique_abbrev(split[1], &oid,\n \t\t\t\t\t\t DEFAULT_ABBREV);\n@@ -1504,8 +1504,8 @@ static void show_cherry_pick_in_progress(struct wt_status *s,\n \telse\n \t\tstatus_printf_ln(s, color,\n \t\t\t_(\"You are currently cherry-picking commit %s.\"),\n-\t\t\tfind_unique_abbrev(&s->state.cherry_pick_head_oid,\n-\t\t\t\t\t   DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &s->state.cherry_pick_head_oid,\n+\t\t\t\t\t\tDEFAULT_ABBREV));\n \n \tif (s->hints) {\n \t\tif (has_unmerged(s))\n@@ -1534,8 +1534,8 @@ static void show_revert_in_progress(struct wt_status *s,\n \telse\n \t\tstatus_printf_ln(s, color,\n \t\t\t_(\"You are currently reverting commit %s.\"),\n-\t\t\tfind_unique_abbrev(&s->state.revert_head_oid,\n-\t\t\t\t\t   DEFAULT_ABBREV));\n+\t\t\trepo_find_unique_abbrev(the_repository, &s->state.revert_head_oid,\n+\t\t\t\t\t\tDEFAULT_ABBREV));\n \tif (s->hints) {\n \t\tif (has_unmerged(s))\n \t\t\tstatus_printf_ln(s, color,\n@@ -1677,9 +1677,9 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\tstate->detached_from = xstrdup(from);\n \t} else\n \t\tstate->detached_from =\n-\t\t\txstrdup(find_unique_abbrev(&cb.noid, DEFAULT_ABBREV));\n+\t\t\txstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));\n \toidcpy(&state->detached_oid, &cb.noid);\n-\tstate->detached_at = !get_oid(\"HEAD\", &oid) &&\n+\tstate->detached_at = !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n \t\t\t     oideq(&oid, &state->detached_oid);\n \n \tfree(ref);\n@@ -1770,13 +1770,13 @@ void wt_status_get_state(struct repository *r,\n \t} else if (wt_status_check_rebase(NULL, state)) {\n \t\t;\t\t/* all set */\n \t} else if (refs_ref_exists(get_main_ref_store(r), \"CHERRY_PICK_HEAD\") &&\n-\t\t   !get_oid(\"CHERRY_PICK_HEAD\", &oid)) {\n+\t\t   !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &oid)) {\n \t\tstate->cherry_pick_in_progress = 1;\n \t\toidcpy(&state->cherry_pick_head_oid, &oid);\n \t}\n \twt_status_check_bisect(NULL, state);\n \tif (refs_ref_exists(get_main_ref_store(r), \"REVERT_HEAD\") &&\n-\t    !get_oid(\"REVERT_HEAD\", &oid)) {\n+\t    !repo_get_oid(the_repository, \"REVERT_HEAD\", &oid)) {\n \t\tstate->revert_in_progress = 1;\n \t\toidcpy(&state->revert_head_oid, &oid);\n \t}\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474287","messageId":"patch-v2-08.17-f442e7b9acc-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 08/17] cocci: apply the \"diff.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:49Z","receivedAt":"2023-03-28T13:59:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"diff.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/log.c                                   | 2 +-\n builtin/rebase.c                                | 2 +-\n builtin/stash.c                                 | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n diff.h                                          | 3 ---\n log-tree.c                                      | 2 +-\n range-diff.c                                    | 2 +-\n 8 files changed, 9 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex a55325025a4..11ba99d6b48 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1385,7 +1385,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,\n \t\t\t.other_arg = &other_arg\n \t\t};\n \n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.file = rev->diffopt.file;\n \t\topts.use_color = rev->diffopt.use_color;\n \t\tdiff_setup_done(&opts);\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 3e2cdabfda5..80a5b7486f8 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1787,7 +1787,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \n \t\t/* We want color (if set), but no pager */\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.stat_width = -1; /* use full terminal width */\n \t\topts.stat_graph_width = -1; /* respect statGraphWidth config */\n \t\topts.output_format |=\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex dd5f67e7e6e..447c3b678f3 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -428,7 +428,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)\n \t * to the index before a merge was run) and the current index\n \t * (reflecting the changes brought in by the merge).\n \t */\n-\tdiff_setup(&diff_opts);\n+\trepo_diff_setup(the_repository, &diff_opts);\n \tdiff_opts.flags.recursive = 1;\n \tdiff_opts.detect_rename = 0;\n \tdiff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 0cdf3f46304..3c0bd8781e7 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -73,6 +73,10 @@\n |\n - get_commit_tree\n + repo_get_commit_tree\n+// diff.h\n+|\n+- diff_setup\n++ repo_diff_setup\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex bf19e6a2487..00461ee86b3 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// diff.h\n-- diff_setup\n-+ repo_diff_setup\n // object-store.h\n-|\n - read_object_file\n + repo_read_object_file\n |\ndiff --git a/diff.h b/diff.h\nindex 09627f6e84a..c759bedc269 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -536,9 +536,6 @@ int git_diff_basic_config(const char *var, const char *value, void *cb);\n int git_diff_heuristic_config(const char *var, const char *value, void *cb);\n void init_diff_ui_defaults(void);\n int git_diff_ui_config(const char *var, const char *value, void *cb);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define diff_setup(diffopts) repo_diff_setup(the_repository, diffopts)\n-#endif\n void repo_diff_setup(struct repository *, struct diff_options *);\n struct option *add_diff_options(const struct option *, struct diff_options *);\n int diff_opt_parse(struct diff_options *, const char **, int, const char *);\ndiff --git a/log-tree.c b/log-tree.c\nindex 97d374c76d6..5c97bc403fb 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -852,7 +852,7 @@ void show_log(struct rev_info *opt)\n \t\t * Pass minimum required diff-options to range-diff; others\n \t\t * can be added later if deemed desirable.\n \t\t */\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \t\topts.file = opt->diffopt.file;\n \t\topts.use_color = opt->diffopt.use_color;\n \t\tdiff_setup_done(&opts);\ndiff --git a/range-diff.c b/range-diff.c\nindex 5bcf966f6c5..15d0bc35a87 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -485,7 +485,7 @@ static void output(struct string_list *a, struct string_list *b,\n \tif (range_diff_opts->diffopt)\n \t\tmemcpy(&opts, range_diff_opts->diffopt, sizeof(opts));\n \telse\n-\t\tdiff_setup(&opts);\n+\t\trepo_diff_setup(the_repository, &opts);\n \n \topts.no_free = 1;\n \tif (!opts.output_format)\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474289","messageId":"patch-v2-07.17-7d64ace3551-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 07/17] cocci: apply the \"commit.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:48Z","receivedAt":"2023-03-28T13:59:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"commit.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n blame.c                                       |  4 +-\n builtin/am.c                                  |  7 +-\n builtin/blame.c                               |  6 +-\n builtin/checkout.c                            | 13 +--\n builtin/commit.c                              |  8 +-\n builtin/describe.c                            |  4 +-\n builtin/diff.c                                |  3 +-\n builtin/fast-export.c                         |  4 +-\n builtin/gc.c                                  |  4 +-\n builtin/log.c                                 |  5 +-\n builtin/merge-tree.c                          |  6 +-\n builtin/merge.c                               |  3 +-\n builtin/name-rev.c                            |  4 +-\n builtin/notes.c                               |  2 +-\n builtin/rebase.c                              |  2 +-\n builtin/replace.c                             |  4 +-\n builtin/shortlog.c                            |  5 +-\n builtin/show-branch.c                         |  4 +-\n commit-graph.c                                |  2 +-\n commit-reach.c                                | 16 ++--\n commit.c                                      | 25 +++---\n commit.h                                      | 18 ----\n contrib/coccinelle/the_repository.cocci       | 19 +++++\n .../coccinelle/the_repository.pending.cocci   | 19 -----\n delta-islands.c                               |  5 +-\n fmt-merge-msg.c                               |  5 +-\n fsck.c                                        |  4 +-\n http-push.c                                   |  3 +-\n list-objects.c                                | 18 ++--\n merge-recursive.c                             |  2 +-\n negotiator/default.c                          |  6 +-\n negotiator/skipping.c                         |  2 +-\n notes-merge.c                                 |  5 +-\n notes-utils.c                                 |  2 +-\n object-name.c                                 |  8 +-\n pack-bitmap-write.c                           |  3 +-\n pretty.c                                      |  5 +-\n reflog.c                                      |  2 +-\n revision.c                                    | 12 +--\n sequencer.c                                   | 82 +++++++++++--------\n shallow.c                                     |  4 +-\n t/helper/test-fast-rebase.c                   |  9 +-\n tree.c                                        |  2 +-\n walker.c                                      |  4 +-\n 44 files changed, 196 insertions(+), 174 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex e45d8a3bf92..0f2751de83b 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -2430,7 +2430,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,\n \n \t\t\tif (sg_origin[i])\n \t\t\t\tcontinue;\n-\t\t\tif (parse_commit(p))\n+\t\t\tif (repo_parse_commit(the_repository, p))\n \t\t\t\tcontinue;\n \t\t\tporigin = find(sb->repo, p, origin, sb->bloom_data);\n \t\t\tif (!porigin)\n@@ -2593,7 +2593,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt)\n \t\t * so hold onto it in the meantime.\n \t\t */\n \t\tblame_origin_incref(suspect);\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tif (sb->reverse ||\n \t\t    (!(commit->object.flags & UNINTERESTING) &&\n \t\t     !(revs->max_age != -1 && commit->date < revs->max_age)))\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 775beac2a92..d89660d138d 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -1330,7 +1330,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)\n \tsize_t ident_len;\n \tstruct ident_split id;\n \n-\tbuffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());\n+\tbuffer = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t      get_commit_output_encoding());\n \n \tident_line = find_commit_header(buffer, \"author\", &ident_len);\n \tif (!ident_line)\n@@ -1362,7 +1363,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)\n \t\tdie(_(\"unable to parse commit %s\"), oid_to_hex(&commit->object.oid));\n \tstate->msg = xstrdup(msg + 2);\n \tstate->msg_len = strlen(state->msg);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n /**\n@@ -1405,7 +1406,7 @@ static void write_index_patch(const struct am_state *state)\n \n \tif (!repo_get_oid(the_repository, \"HEAD\", &head)) {\n \t\tstruct commit *commit = lookup_commit_or_die(&head, \"HEAD\");\n-\t\ttree = get_commit_tree(commit);\n+\t\ttree = repo_get_commit_tree(the_repository, commit);\n \t} else\n \t\ttree = lookup_tree(the_repository,\n \t\t\t\t   the_repository->hash_algo->empty_tree);\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 6c266019ebb..7f92f9c1d39 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -201,13 +201,13 @@ static void get_commit_info(struct commit *commit,\n \tconst char *message;\n \n \tencoding = get_log_output_encoding();\n-\tmessage = logmsg_reencode(commit, NULL, encoding);\n+\tmessage = repo_logmsg_reencode(the_repository, commit, NULL, encoding);\n \tget_ac_line(message, \"\\nauthor \",\n \t\t    &ret->author, &ret->author_mail,\n \t\t    &ret->author_time, &ret->author_tz);\n \n \tif (!detailed) {\n-\t\tunuse_commit_buffer(commit, message);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n \t\treturn;\n \t}\n \n@@ -221,7 +221,7 @@ static void get_commit_info(struct commit *commit,\n \telse\n \t\tstrbuf_addf(&ret->summary, \"(%s)\", oid_to_hex(&commit->object.oid));\n \n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n }\n \n /*\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 18f3fc76ced..ad6d5304b64 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -654,7 +654,7 @@ static void describe_detached_head(const char *msg, struct commit *commit)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \n-\tif (!parse_commit(commit))\n+\tif (!repo_parse_commit(the_repository, commit))\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);\n \tif (print_sha1_ellipsis()) {\n \t\tfprintf(stderr, \"%s %s... %s\\n\", msg,\n@@ -769,7 +769,8 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\tBUG(\"'switch --orphan' should never accept a commit as starting point\");\n \t\tnew_tree = parse_tree_indirect(the_hash_algo->empty_tree);\n \t} else\n-\t\tnew_tree = get_commit_tree(new_branch_info->commit);\n+\t\tnew_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\tnew_branch_info->commit);\n \tif (opts->discard_changes) {\n \t\tret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info);\n \t\tif (ret)\n@@ -831,7 +832,8 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\t\t */\n \t\t\tif (!old_branch_info->commit)\n \t\t\t\treturn 1;\n-\t\t\told_tree = get_commit_tree(old_branch_info->commit);\n+\t\t\told_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\told_branch_info->commit);\n \n \t\t\tif (repo_index_has_changes(the_repository, old_tree, &sb))\n \t\t\t\tdie(_(\"cannot continue with staged changes in \"\n@@ -1020,7 +1022,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)\n \tstrbuf_addstr(sb, \"  \");\n \tstrbuf_add_unique_abbrev(sb, &commit->object.oid, DEFAULT_ABBREV);\n \tstrbuf_addch(sb, ' ');\n-\tif (!parse_commit(commit))\n+\tif (!repo_parse_commit(the_repository, commit))\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, sb);\n \tstrbuf_addch(sb, '\\n');\n }\n@@ -1220,7 +1222,8 @@ static void setup_new_branch_info_and_source_tree(\n \t\t*source_tree = parse_tree_indirect(rev);\n \t} else {\n \t\tparse_commit_or_die(new_branch_info->commit);\n-\t\t*source_tree = get_commit_tree(new_branch_info->commit);\n+\t\t*source_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t    new_branch_info->commit);\n \t}\n }\n \ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 95bca976a58..c64fc50e923 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -712,7 +712,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n {\n \tconst char *buffer, *subject, *fmt;\n \n-\tbuffer = get_commit_buffer(commit, NULL);\n+\tbuffer = repo_get_commit_buffer(the_repository, commit, NULL);\n \tfind_commit_subject(buffer, &subject);\n \t/*\n \t * If we amend the 'amend!' commit then we don't want to\n@@ -720,7 +720,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n \t */\n \tfmt = starts_with(subject, \"amend!\") ? \"%b\" : \"%B\";\n \tformat_commit_message(commit, fmt, sb, ctx);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n static int prepare_to_commit(const char *index_file, const char *prefix,\n@@ -1183,7 +1183,7 @@ static const char *read_commit_message(const char *name)\n \tif (!commit)\n \t\tdie(_(\"could not lookup commit %s\"), name);\n \tout_enc = get_commit_output_encoding();\n-\treturn logmsg_reencode(commit, NULL, out_enc);\n+\treturn repo_logmsg_reencode(the_repository, commit, NULL, out_enc);\n }\n \n /*\n@@ -1714,7 +1714,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t\tcurrent_head = NULL;\n \telse {\n \t\tcurrent_head = lookup_commit_or_die(&oid, \"HEAD\");\n-\t\tif (parse_commit(current_head))\n+\t\tif (repo_parse_commit(the_repository, current_head))\n \t\t\tdie(_(\"could not parse HEAD commit\"));\n \t}\n \tverbose = -1; /* unspecified */\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex de3743e803a..3e5595e0ed3 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -262,7 +262,7 @@ static unsigned long finish_depth_computation(\n \t\t\tbest->depth++;\n \t\twhile (parents) {\n \t\t\tstruct commit *p = parents->item;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (!(p->object.flags & SEEN))\n \t\t\t\tcommit_list_insert_by_date(p, list);\n \t\t\tp->object.flags |= c->object.flags;\n@@ -405,7 +405,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)\n \t\t}\n \t\twhile (parents) {\n \t\t\tstruct commit *p = parents->item;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (!(p->object.flags & SEEN))\n \t\t\t\tcommit_list_insert_by_date(p, &list);\n \t\t\tp->object.flags |= c->object.flags;\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 26f1e532c66..1091c377af7 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -548,7 +548,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t\tif (!obj)\n \t\t\tdie(_(\"invalid object '%s' given.\"), name);\n \t\tif (obj->type == OBJ_COMMIT)\n-\t\t\tobj = &get_commit_tree(((struct commit *)obj))->object;\n+\t\t\tobj = &repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t    ((struct commit *)obj))->object;\n \n \t\tif (obj->type == OBJ_TREE) {\n \t\t\tif (sdiff.skip && bitmap_get(sdiff.skip, i))\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 78493c6d2bf..fc5859dc9fa 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -619,7 +619,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,\n \trev->diffopt.output_format = DIFF_FORMAT_CALLBACK;\n \n \tparse_commit_or_die(commit);\n-\tcommit_buffer = get_commit_buffer(commit, NULL);\n+\tcommit_buffer = repo_get_commit_buffer(the_repository, commit, NULL);\n \tauthor = strstr(commit_buffer, \"\\nauthor \");\n \tif (!author)\n \t\tdie(\"could not find author in commit %s\",\n@@ -700,7 +700,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,\n \t\t\t  ? strlen(message) : 0),\n \t       reencoded ? reencoded : message ? message : \"\");\n \tfree(reencoded);\n-\tunuse_commit_buffer(commit, commit_buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, commit_buffer);\n \n \tfor (i = 0, p = commit->parents; p; p = p->next) {\n \t\tstruct object *obj = &p->item->object;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex c58fe8c936c..9dc80344b64 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -821,7 +821,7 @@ static int dfs_on_ref(const char *refname UNUSED,\n \tcommit = lookup_commit(the_repository, oid);\n \tif (!commit)\n \t\treturn 0;\n-\tif (parse_commit(commit) ||\n+\tif (repo_parse_commit(the_repository, commit) ||\n \t    commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH)\n \t\treturn 0;\n \n@@ -838,7 +838,7 @@ static int dfs_on_ref(const char *refname UNUSED,\n \t\tcommit = pop_commit(&stack);\n \n \t\tfor (parent = commit->parents; parent; parent = parent->next) {\n-\t\t\tif (parse_commit(parent->item) ||\n+\t\t\tif (repo_parse_commit(the_repository, parent->item) ||\n \t\t\t    commit_graph_position(parent->item) != COMMIT_NOT_FROM_GRAPH ||\n \t\t\t    parent->item->object.flags & SEEN)\n \t\t\t\tcontinue;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex e16bda87ba3..a55325025a4 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1328,10 +1328,11 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,\n \tlog_write_email_headers(rev, head, &pp.after_subject, &need_8bit_cte, 0);\n \n \tfor (i = 0; !need_8bit_cte && i < nr; i++) {\n-\t\tconst char *buf = get_commit_buffer(list[i], NULL);\n+\t\tconst char *buf = repo_get_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t list[i], NULL);\n \t\tif (has_non_ascii(buf))\n \t\t\tneed_8bit_cte = 1;\n-\t\tunuse_commit_buffer(list[i], buf);\n+\t\trepo_unuse_commit_buffer(the_repository, list[i], buf);\n \t}\n \n \tif (!branch_name)\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 234db21548b..dd23ee684c7 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -444,9 +444,9 @@ static int real_merge(struct merge_tree_options *o,\n \t\t\tdie(_(\"could not lookup commit %s\"), merge_base);\n \n \t\topt.ancestor = merge_base;\n-\t\tbase_tree = get_commit_tree(base_commit);\n-\t\tparent1_tree = get_commit_tree(parent1);\n-\t\tparent2_tree = get_commit_tree(parent2);\n+\t\tbase_tree = repo_get_commit_tree(the_repository, base_commit);\n+\t\tparent1_tree = repo_get_commit_tree(the_repository, parent1);\n+\t\tparent2_tree = repo_get_commit_tree(the_repository, parent2);\n \t\tmerge_incore_nonrecursive(&opt, base_tree, parent1_tree, parent2_tree, &result);\n \t} else {\n \t\t/*\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 5dfc650a7bc..559aab1c380 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1610,7 +1610,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t * Must first ensure that index matches HEAD before\n \t\t\t * attempting a trivial merge.\n \t\t\t */\n-\t\t\tstruct tree *head_tree = get_commit_tree(head_commit);\n+\t\t\tstruct tree *head_tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t      head_commit);\n \t\t\tstruct strbuf sb = STRBUF_INIT;\n \n \t\t\tif (repo_index_has_changes(the_repository, head_tree,\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex cd9c000f56b..9d0dd0ad017 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -182,7 +182,7 @@ static void name_rev(struct commit *start_commit,\n \tsize_t parents_to_queue_nr, parents_to_queue_alloc = 0;\n \tstruct rev_name *start_name;\n \n-\tparse_commit(start_commit);\n+\trepo_parse_commit(the_repository, start_commit);\n \tif (commit_is_before_cutoff(start_commit))\n \t\treturn;\n \n@@ -212,7 +212,7 @@ static void name_rev(struct commit *start_commit,\n \t\t\tstruct rev_name *parent_name;\n \t\t\tint generation, distance;\n \n-\t\t\tparse_commit(parent);\n+\t\t\trepo_parse_commit(the_repository, parent);\n \t\t\tif (commit_is_before_cutoff(parent))\n \t\t\t\tcontinue;\n \ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 73c9c691781..9aea5a4b27b 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -722,7 +722,7 @@ static int merge_commit(struct notes_merge_options *o)\n \t\tdie(_(\"failed to read ref NOTES_MERGE_PARTIAL\"));\n \telse if (!(partial = lookup_commit_reference(the_repository, &oid)))\n \t\tdie(_(\"could not find commit from NOTES_MERGE_PARTIAL.\"));\n-\telse if (parse_commit(partial))\n+\telse if (repo_parse_commit(the_repository, partial))\n \t\tdie(_(\"could not parse commit from NOTES_MERGE_PARTIAL.\"));\n \n \tif (partial->parents)\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 6390dd2fcc1..3e2cdabfda5 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -854,7 +854,7 @@ static int checkout_up_to_date(struct rebase_options *options)\n static int is_linear_history(struct commit *from, struct commit *to)\n {\n \twhile (to && to != from) {\n-\t\tparse_commit(to);\n+\t\trepo_parse_commit(the_repository, to);\n \t\tif (!to->parents)\n \t\t\treturn 1;\n \t\tif (to->parents->next)\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex f765a3e2d75..ef70f2d1005 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -460,9 +460,9 @@ static int create_graft(int argc, const char **argv, int force, int gentle)\n \tif (!commit)\n \t\treturn error(_(\"could not parse %s\"), old_ref);\n \n-\tbuffer = get_commit_buffer(commit, &size);\n+\tbuffer = repo_get_commit_buffer(the_repository, commit, &size);\n \tstrbuf_add(&buf, buffer, size);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \n \tif (replace_parents(&buf, argc - 1, &argv[1]) < 0) {\n \t\tstrbuf_release(&buf);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 27a87167e19..8afd1ad865e 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -179,7 +179,8 @@ static void insert_records_from_trailers(struct shortlog *log,\n \t * Using format_commit_message(\"%B\") would be simpler here, but\n \t * this saves us copying the message.\n \t */\n-\tcommit_buffer = logmsg_reencode(commit, NULL, ctx->output_encoding);\n+\tcommit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t     ctx->output_encoding);\n \tbody = strstr(commit_buffer, \"\\n\\n\");\n \tif (!body)\n \t\treturn;\n@@ -202,7 +203,7 @@ static void insert_records_from_trailers(struct shortlog *log,\n \ttrailer_iterator_release(&iter);\n \n \tstrbuf_release(&ident);\n-\tunuse_commit_buffer(commit, commit_buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, commit_buffer);\n }\n \n static int shortlog_needs_dedup(const struct shortlog *log)\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 9d208db3b43..7aea28f5b06 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -241,7 +241,7 @@ static void join_revs(struct commit_list **list_p,\n \t\t\tparents = parents->next;\n \t\t\tif ((this_flag & flags) == flags)\n \t\t\t\tcontinue;\n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \t\t\tif (mark_seen(p, seen_p) && !still_interesting)\n \t\t\t\textra--;\n \t\t\tp->object.flags |= flags;\n@@ -843,7 +843,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\tif (!commit)\n \t\t\tdie(_(\"cannot find commit %s (%s)\"),\n \t\t\t    ref_name[num_rev], oid_to_hex(&revkey));\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tmark_seen(commit, &seen);\n \n \t\t/* rev#0 uses bit REV_SHIFT, rev#1 uses bit REV_SHIFT+1,\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 5e6098ff356..a30c4c96940 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2550,7 +2550,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)\n \n \t\tgraph_commit = lookup_commit(r, &cur_oid);\n \t\todb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));\n-\t\tif (parse_commit_internal(odb_commit, 0, 0)) {\n+\t\tif (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) {\n \t\t\tgraph_report(_(\"failed to parse commit %s from object database for commit-graph\"),\n \t\t\t\t     oid_to_hex(&cur_oid));\n \t\t\tcontinue;\ndiff --git a/commit-reach.c b/commit-reach.c\nindex 4a2ea9ca1f7..b9eb0952d7b 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -587,7 +587,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)\n \t\treturn 0;\n \tnew_commit = (struct commit *) o;\n \n-\tif (parse_commit(new_commit) < 0)\n+\tif (repo_parse_commit(the_repository, new_commit) < 0)\n \t\treturn 0;\n \n \tcommit_list_insert(old_commit, &old_commit_list);\n@@ -751,7 +751,7 @@ int can_all_from_reach_with_flag(struct object_array *from,\n \t\t}\n \n \t\tlist[nr_commits] = (struct commit *)from_one;\n-\t\tif (parse_commit(list[nr_commits]) ||\n+\t\tif (repo_parse_commit(the_repository, list[nr_commits]) ||\n \t\t    commit_graph_generation(list[nr_commits]) < min_generation) {\n \t\t\tresult = 0;\n \t\t\tgoto cleanup;\n@@ -786,7 +786,7 @@ int can_all_from_reach_with_flag(struct object_array *from,\n \t\t\t\tif (!(parent->item->object.flags & assign_flag)) {\n \t\t\t\t\tparent->item->object.flags |= assign_flag;\n \n-\t\t\t\t\tif (parse_commit(parent->item) ||\n+\t\t\t\t\tif (repo_parse_commit(the_repository, parent->item) ||\n \t\t\t\t\t    parent->item->date < min_commit_date ||\n \t\t\t\t\t    commit_graph_generation(parent->item) < min_generation)\n \t\t\t\t\t\tcontinue;\n@@ -832,7 +832,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,\n \twhile (from_iter) {\n \t\tadd_object_array(&from_iter->item->object, NULL, &from_objs);\n \n-\t\tif (!parse_commit(from_iter->item)) {\n+\t\tif (!repo_parse_commit(the_repository, from_iter->item)) {\n \t\t\ttimestamp_t generation;\n \t\t\tif (from_iter->item->date < min_commit_date)\n \t\t\t\tmin_commit_date = from_iter->item->date;\n@@ -846,7 +846,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,\n \t}\n \n \twhile (to_iter) {\n-\t\tif (!parse_commit(to_iter->item)) {\n+\t\tif (!repo_parse_commit(the_repository, to_iter->item)) {\n \t\t\ttimestamp_t generation;\n \t\t\tif (to_iter->item->date < min_commit_date)\n \t\t\t\tmin_commit_date = to_iter->item->date;\n@@ -896,7 +896,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\ttimestamp_t generation;\n \t\tstruct commit *c = *item;\n \n-\t\tparse_commit(c);\n+\t\trepo_parse_commit(the_repository, c);\n \t\tgeneration = commit_graph_generation(c);\n \t\tif (generation < min_generation)\n \t\t\tmin_generation = generation;\n@@ -911,7 +911,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\tstruct commit *c = *item;\n \t\tif (!(c->object.flags & PARENT2)) {\n \t\t\tc->object.flags |= PARENT2;\n-\t\t\tparse_commit(c);\n+\t\t\trepo_parse_commit(the_repository, c);\n \n \t\t\tprio_queue_put(&queue, *item);\n \t\t}\n@@ -930,7 +930,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,\n \t\tfor (parents = current->parents; parents; parents = parents->next) {\n \t\t\tstruct commit *p = parents->item;\n \n-\t\t\tparse_commit(p);\n+\t\t\trepo_parse_commit(the_repository, p);\n \n \t\t\tif (commit_graph_generation(p) < min_generation)\n \t\t\t\tcontinue;\ndiff --git a/commit.c b/commit.c\nindex aa2e58ea207..127ec79b2d3 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -84,7 +84,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)\n \tif (repo_get_oid_committish(the_repository, name, &oid))\n \t\treturn NULL;\n \tcommit = lookup_commit_reference(the_repository, &oid);\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn NULL;\n \treturn commit;\n }\n@@ -383,7 +383,7 @@ struct tree *repo_get_commit_tree(struct repository *r,\n \n struct object_id *get_commit_tree_oid(const struct commit *commit)\n {\n-\tstruct tree *tree = get_commit_tree(commit);\n+\tstruct tree *tree = repo_get_commit_tree(the_repository, commit);\n \treturn tree ? &tree->object.oid : NULL;\n }\n \n@@ -556,7 +556,7 @@ int repo_parse_commit_gently(struct repository *r,\n \n void parse_commit_or_die(struct commit *item)\n {\n-\tif (parse_commit(item))\n+\tif (repo_parse_commit(the_repository, item))\n \t\tdie(\"unable to parse commit %s\",\n \t\t    item ? oid_to_hex(&item->object.oid) : \"(null)\");\n }\n@@ -689,7 +689,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,\n \n \twhile (parents) {\n \t\tstruct commit *commit = parents->item;\n-\t\tif (!parse_commit(commit) && !(commit->object.flags & mark)) {\n+\t\tif (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) {\n \t\t\tcommit->object.flags |= mark;\n \t\t\tcommit_list_insert_by_date(commit, list);\n \t\t}\n@@ -763,7 +763,8 @@ define_commit_slab(author_date_slab, timestamp_t);\n void record_author_date(struct author_date_slab *author_date,\n \t\t\tstruct commit *commit)\n {\n-\tconst char *buffer = get_commit_buffer(commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    NULL);\n \tstruct ident_split ident;\n \tconst char *ident_line;\n \tsize_t ident_len;\n@@ -783,7 +784,7 @@ void record_author_date(struct author_date_slab *author_date,\n \t*(author_date_slab_at(author_date, commit)) = date;\n \n fail_exit:\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n int compare_commits_by_author_date(const void *a_, const void *b_,\n@@ -966,7 +967,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)\n \tcommit = lookup_commit(the_repository, oid);\n \tif (!commit ||\n \t    (commit->object.flags & TMP_MARK) ||\n-\t    parse_commit(commit))\n+\t    repo_parse_commit(the_repository, commit))\n \t\treturn;\n \n \tALLOC_GROW(revs->commit, revs->nr + 1, revs->alloc);\n@@ -1099,10 +1100,11 @@ int parse_signed_commit(const struct commit *commit,\n \t\t\tconst struct git_hash_algo *algop)\n {\n \tunsigned long size;\n-\tconst char *buffer = get_commit_buffer(commit, &size);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    &size);\n \tint ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);\n \n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \treturn ret;\n }\n \n@@ -1321,9 +1323,10 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,\n {\n \tstruct commit_extra_header *extra = NULL;\n \tunsigned long size;\n-\tconst char *buffer = get_commit_buffer(commit, &size);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    &size);\n \textra = read_commit_extra_header_lines(buffer, size, exclude);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n \treturn extra;\n }\n \ndiff --git a/commit.h b/commit.h\nindex 06657b4c6e7..d87d5cd2a09 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -109,11 +109,6 @@ static inline int repo_parse_commit_no_graph(struct repository *r,\n \treturn repo_parse_commit_internal(r, commit, 0, 0);\n }\n \n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)\n-#define parse_commit(item) repo_parse_commit(the_repository, item)\n-#endif\n-\n void parse_commit_or_die(struct commit *item);\n \n struct buffer_slab;\n@@ -140,9 +135,6 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,\n const void *repo_get_commit_buffer(struct repository *r,\n \t\t\t\t   const struct commit *,\n \t\t\t\t   unsigned long *size);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define get_commit_buffer(c, s) repo_get_commit_buffer(the_repository, c, s)\n-#endif\n \n /*\n  * Tell the commit subsystem that we are done with a particular commit buffer.\n@@ -153,9 +145,6 @@ const void *repo_get_commit_buffer(struct repository *r,\n void repo_unuse_commit_buffer(struct repository *r,\n \t\t\t      const struct commit *,\n \t\t\t      const void *buffer);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define unuse_commit_buffer(c, b) repo_unuse_commit_buffer(the_repository, c, b)\n-#endif\n \n /*\n  * Free any cached object buffer associated with the commit.\n@@ -163,7 +152,6 @@ void repo_unuse_commit_buffer(struct repository *r,\n void free_commit_buffer(struct parsed_object_pool *pool, struct commit *);\n \n struct tree *repo_get_commit_tree(struct repository *, const struct commit *);\n-#define get_commit_tree(c) repo_get_commit_tree(the_repository, c)\n struct object_id *get_commit_tree_oid(const struct commit *);\n \n /*\n@@ -205,16 +193,10 @@ void free_commit_list(struct commit_list *list);\n \n struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n \n-const char *logmsg_reencode(const struct commit *commit,\n-\t\t\t    char **commit_encoding,\n-\t\t\t    const char *output_encoding);\n const char *repo_logmsg_reencode(struct repository *r,\n \t\t\t\t const struct commit *commit,\n \t\t\t\t char **commit_encoding,\n \t\t\t\t const char *output_encoding);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define logmsg_reencode(c, enc, out) repo_logmsg_reencode(the_repository, c, enc, out)\n-#endif\n \n const char *skip_blank_lines(const char *msg);\n \ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 1ab63f0196b..0cdf3f46304 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -54,6 +54,25 @@\n |\n - in_merge_bases_many\n + repo_in_merge_bases_many\n+// commit.h\n+|\n+- parse_commit_internal\n++ repo_parse_commit_internal\n+|\n+- parse_commit\n++ repo_parse_commit\n+|\n+- get_commit_buffer\n++ repo_get_commit_buffer\n+|\n+- unuse_commit_buffer\n++ repo_unuse_commit_buffer\n+|\n+- logmsg_reencode\n++ repo_logmsg_reencode\n+|\n+- get_commit_tree\n++ repo_get_commit_tree\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex e9209fc0cc4..bf19e6a2487 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,26 +5,7 @@\n @@\n @@\n (\n-// commit.h\n-- parse_commit_internal\n-+ repo_parse_commit_internal\n-|\n-- parse_commit\n-+ repo_parse_commit\n-|\n-- get_commit_buffer\n-+ repo_get_commit_buffer\n-|\n-- unuse_commit_buffer\n-+ repo_unuse_commit_buffer\n-|\n-- logmsg_reencode\n-+ repo_logmsg_reencode\n-|\n-- get_commit_tree\n-+ repo_get_commit_tree\n // diff.h\n-|\n - diff_setup\n + repo_diff_setup\n // object-store.h\ndiff --git a/delta-islands.c b/delta-islands.c\nindex fe12c93005b..7a412ccbf63 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -508,8 +508,9 @@ void propagate_island_marks(struct commit *commit)\n \t\tstruct commit_list *p;\n \t\tstruct island_bitmap *root_marks = kh_value(island_marks, pos);\n \n-\t\tparse_commit(commit);\n-\t\tset_island_marks(&get_commit_tree(commit)->object, root_marks);\n+\t\trepo_parse_commit(the_repository, commit);\n+\t\tset_island_marks(&repo_get_commit_tree(the_repository, commit)->object,\n+\t\t\t\t root_marks);\n \t\tfor (p = commit->parents; p; p = p->next)\n \t\t\tset_island_marks(&p->item->object, root_marks);\n \t}\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex bb56d957a64..29a1afa2485 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -269,9 +269,10 @@ static void record_person_from_buf(int which, struct string_list *people,\n static void record_person(int which, struct string_list *people,\n \t\t\t  struct commit *commit)\n {\n-\tconst char *buffer = get_commit_buffer(commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository, commit,\n+\t\t\t\t\t\t    NULL);\n \trecord_person_from_buf(which, people, buffer);\n-\tunuse_commit_buffer(commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n static int cmp_string_list_util_as_integral(const void *a_, const void *b_)\ndiff --git a/fsck.c b/fsck.c\nindex 871c0a9a252..0d752d57717 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -355,7 +355,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio\n \tint result;\n \tconst char *name;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn -1;\n \n \tname = fsck_get_object_name(options, &commit->object.oid);\n@@ -363,7 +363,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio\n \t\tfsck_put_object_name(options, get_commit_tree_oid(commit),\n \t\t\t\t     \"%s:\", name);\n \n-\tresult = options->walk((struct object *)get_commit_tree(commit),\n+\tresult = options->walk((struct object *) repo_get_commit_tree(the_repository, commit),\n \t\t\t       OBJ_TREE, data, options);\n \tif (result < 0)\n \t\treturn result;\ndiff --git a/http-push.c b/http-push.c\nindex 2693d73cf9a..e149daeff3d 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1332,7 +1332,8 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)\n \tint count = 0;\n \n \twhile ((commit = get_revision(revs)) != NULL) {\n-\t\tp = process_tree(get_commit_tree(commit), p);\n+\t\tp = process_tree(repo_get_commit_tree(the_repository, commit),\n+\t\t\t\t p);\n \t\tcommit->object.flags |= LOCAL;\n \t\tif (!(commit->object.flags & UNINTERESTING))\n \t\t\tcount += add_send_request(&commit->object, lock);\ndiff --git a/list-objects.c b/list-objects.c\nindex ab5745bbfe4..d75132cfd73 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -228,7 +228,8 @@ static void mark_edge_parents_uninteresting(struct commit *commit,\n \t\tstruct commit *parent = parents->item;\n \t\tif (!(parent->object.flags & UNINTERESTING))\n \t\t\tcontinue;\n-\t\tmark_tree_uninteresting(revs->repo, get_commit_tree(parent));\n+\t\tmark_tree_uninteresting(revs->repo,\n+\t\t\t\t\trepo_get_commit_tree(the_repository, parent));\n \t\tif (revs->edge_hint && !(parent->object.flags & SHOWN)) {\n \t\t\tparent->object.flags |= SHOWN;\n \t\t\tshow_edge(parent);\n@@ -245,7 +246,8 @@ static void add_edge_parents(struct commit *commit,\n \n \tfor (parents = commit->parents; parents; parents = parents->next) {\n \t\tstruct commit *parent = parents->item;\n-\t\tstruct tree *tree = get_commit_tree(parent);\n+\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t parent);\n \n \t\tif (!tree)\n \t\t\tcontinue;\n@@ -276,7 +278,8 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \n \t\tfor (list = revs->commits; list; list = list->next) {\n \t\t\tstruct commit *commit = list->item;\n-\t\t\tstruct tree *tree = get_commit_tree(commit);\n+\t\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t commit);\n \n \t\t\tif (commit->object.flags & UNINTERESTING)\n \t\t\t\ttree->object.flags |= UNINTERESTING;\n@@ -292,7 +295,7 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \t\t\tstruct commit *commit = list->item;\n \t\t\tif (commit->object.flags & UNINTERESTING) {\n \t\t\t\tmark_tree_uninteresting(revs->repo,\n-\t\t\t\t\t\t\tget_commit_tree(commit));\n+\t\t\t\t\t\t\trepo_get_commit_tree(the_repository, commit));\n \t\t\t\tif (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {\n \t\t\t\t\tcommit->object.flags |= SHOWN;\n \t\t\t\t\tshow_edge(commit);\n@@ -310,7 +313,7 @@ void mark_edges_uninteresting(struct rev_info *revs,\n \t\t\tif (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))\n \t\t\t\tcontinue;\n \t\t\tmark_tree_uninteresting(revs->repo,\n-\t\t\t\t\t\tget_commit_tree(commit));\n+\t\t\t\t\t\trepo_get_commit_tree(the_repository, commit));\n \t\t\tif (!(obj->flags & SHOWN)) {\n \t\t\t\tobj->flags |= SHOWN;\n \t\t\t\tshow_edge(commit);\n@@ -377,8 +380,9 @@ static void do_traverse(struct traversal_context *ctx)\n \t\t */\n \t\tif (!ctx->revs->tree_objects)\n \t\t\t; /* do not bother loading tree */\n-\t\telse if (get_commit_tree(commit)) {\n-\t\t\tstruct tree *tree = get_commit_tree(commit);\n+\t\telse if (repo_get_commit_tree(the_repository, commit)) {\n+\t\t\tstruct tree *tree = repo_get_commit_tree(the_repository,\n+\t\t\t\t\t\t\t\t commit);\n \t\t\ttree->object.flags |= NOT_USER_GIVEN;\n \t\t\tadd_pending_tree(ctx->revs, tree);\n \t\t} else if (commit->object.parsed) {\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex cfb201d682b..6eeb4844f38 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3797,7 +3797,7 @@ static struct commit *get_ref(struct repository *repo,\n \t\treturn make_virtual_commit(repo, (struct tree*)object, name);\n \tif (object->type != OBJ_COMMIT)\n \t\treturn NULL;\n-\tif (parse_commit((struct commit *)object))\n+\tif (repo_parse_commit(the_repository, (struct commit *)object))\n \t\treturn NULL;\n \treturn (struct commit *)object;\n }\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex b7e79feaf04..658d9dd6b95 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -25,7 +25,7 @@ static void rev_list_push(struct negotiation_state *ns,\n \tif (!(commit->object.flags & mark)) {\n \t\tcommit->object.flags |= mark;\n \n-\t\tif (parse_commit(commit))\n+\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\treturn;\n \n \t\tprio_queue_put(&ns->rev_list, commit);\n@@ -69,7 +69,7 @@ static void mark_common(struct negotiation_state *ns, struct commit *commit,\n \t\t\tif (!ancestors_only && !(o->flags & POPPED))\n \t\t\t\tns->non_common_revs--;\n \t\t\tif (!o->parsed && !dont_parse)\n-\t\t\t\tif (parse_commit(commit))\n+\t\t\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\t\t\treturn;\n \n \t\t\tfor (parents = commit->parents;\n@@ -96,7 +96,7 @@ static const struct object_id *get_rev(struct negotiation_state *ns)\n \t\t\treturn NULL;\n \n \t\tcommit = prio_queue_get(&ns->rev_list);\n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tparents = commit->parents;\n \n \t\tcommit->object.flags |= POPPED;\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex 264acf8bbea..c4de512e6e6 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -184,7 +184,7 @@ static const struct object_id *get_rev(struct data *data)\n \t\tif (!(commit->object.flags & COMMON) && !entry->ttl)\n \t\t\tto_send = commit;\n \n-\t\tparse_commit(commit);\n+\t\trepo_parse_commit(the_repository, commit);\n \t\tfor (p = commit->parents; p; p = p->next)\n \t\t\tparent_pushed |= push_parent(data, entry, p->item);\n \ndiff --git a/notes-merge.c b/notes-merge.c\nindex 699edcfe105..d26c826963e 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -679,7 +679,8 @@ int notes_merge_commit(struct notes_merge_options *o,\n \tDIR *dir;\n \tstruct dirent *e;\n \tstruct strbuf path = STRBUF_INIT;\n-\tconst char *buffer = get_commit_buffer(partial_commit, NULL);\n+\tconst char *buffer = repo_get_commit_buffer(the_repository,\n+\t\t\t\t\t\t    partial_commit, NULL);\n \tconst char *msg = strstr(buffer, \"\\n\\n\");\n \tint baselen;\n \n@@ -726,7 +727,7 @@ int notes_merge_commit(struct notes_merge_options *o,\n \n \tcreate_notes_commit(o->repo, partial_tree, partial_commit->parents, msg,\n \t\t\t    strlen(msg), result_oid);\n-\tunuse_commit_buffer(partial_commit, buffer);\n+\trepo_unuse_commit_buffer(the_repository, partial_commit, buffer);\n \tif (o->verbosity >= 4)\n \t\tprintf(\"Finalized notes merge commit: %s\\n\",\n \t\t\toid_to_hex(result_oid));\ndiff --git a/notes-utils.c b/notes-utils.c\nindex d7d18e30f5a..0550cfded86 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r,\n \t\tstruct object_id parent_oid;\n \t\tif (!read_ref(t->ref, &parent_oid)) {\n \t\t\tstruct commit *parent = lookup_commit(r, &parent_oid);\n-\t\t\tif (parse_commit(parent))\n+\t\t\tif (repo_parse_commit(the_repository, parent))\n \t\t\t\tdie(\"Failed to find/parse commit %s\", t->ref);\n \t\t\tcommit_list_insert(parent, &parents);\n \t\t}\ndiff --git a/object-name.c b/object-name.c\nindex 19ba23216a5..b297cbd0a18 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1037,7 +1037,7 @@ static enum get_oid_result get_parent(struct repository *r,\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(r, &oid);\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn MISSING_OBJECT;\n \tif (!idx) {\n \t\toidcpy(result, &commit->object.oid);\n@@ -1071,7 +1071,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,\n \t\treturn MISSING_OBJECT;\n \n \twhile (generation--) {\n-\t\tif (parse_commit(commit) || !commit->parents)\n+\t\tif (repo_parse_commit(the_repository, commit) || !commit->parents)\n \t\t\treturn MISSING_OBJECT;\n \t\tcommit = commit->parents->item;\n \t}\n@@ -1362,10 +1362,10 @@ static int get_oid_oneline(struct repository *r,\n \t\tcommit = pop_most_recent_commit(&list, ONELINE_SEEN);\n \t\tif (!parse_object(r, &commit->object.oid))\n \t\t\tcontinue;\n-\t\tbuf = get_commit_buffer(commit, NULL);\n+\t\tbuf = repo_get_commit_buffer(the_repository, commit, NULL);\n \t\tp = strstr(buf, \"\\n\\n\");\n \t\tmatches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));\n-\t\tunuse_commit_buffer(commit, buf);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, buf);\n \n \t\tif (matches) {\n \t\t\toidcpy(oid, &commit->object.oid);\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 891d9d2772e..a3cafa8e201 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -427,7 +427,8 @@ static int fill_bitmap_commit(struct bb_commit *ent,\n \t\tif (!found)\n \t\t\treturn -1;\n \t\tbitmap_set(ent->bitmap, pos);\n-\t\tprio_queue_put(tree_queue, get_commit_tree(c));\n+\t\tprio_queue_put(tree_queue,\n+\t\t\t       repo_get_commit_tree(the_repository, c));\n \n \t\tfor (p = c->parents; p; p = p->next) {\n \t\t\tpos = find_object_pos(&p->item->object.oid, &found);\ndiff --git a/pretty.c b/pretty.c\nindex 05b557d0961..34e0a3bc786 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2207,7 +2207,8 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \t}\n \n \tencoding = get_log_output_encoding();\n-\tmsg = reencoded = logmsg_reencode(commit, NULL, encoding);\n+\tmsg = reencoded = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t       encoding);\n \n \tif (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))\n \t\tindent = 0;\n@@ -2264,7 +2265,7 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \tif (cmit_fmt_is_mail(pp->fmt) && sb->len <= beginning_of_body)\n \t\tstrbuf_addch(sb, '\\n');\n \n-\tunuse_commit_buffer(commit, reencoded);\n+\trepo_unuse_commit_buffer(the_repository, commit, reencoded);\n }\n \n void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,\ndiff --git a/reflog.c b/reflog.c\nindex 04630f56ec6..6e8362e7a2f 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -186,7 +186,7 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb)\n \t\tstruct commit *commit = pop_commit(&pending);\n \t\tif (commit->object.flags & REACHABLE)\n \t\t\tcontinue;\n-\t\tif (parse_commit(commit))\n+\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\tcontinue;\n \t\tcommit->object.flags |= REACHABLE;\n \t\tif (commit->date < expire_limit) {\ndiff --git a/revision.c b/revision.c\nindex b6a1b47c306..8f22b7b06dc 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -780,8 +780,8 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,\n static int rev_compare_tree(struct rev_info *revs,\n \t\t\t    struct commit *parent, struct commit *commit, int nth_parent)\n {\n-\tstruct tree *t1 = get_commit_tree(parent);\n-\tstruct tree *t2 = get_commit_tree(commit);\n+\tstruct tree *t1 = repo_get_commit_tree(the_repository, parent);\n+\tstruct tree *t2 = repo_get_commit_tree(the_repository, commit);\n \tint bloom_ret = 1;\n \n \tif (!t1)\n@@ -827,7 +827,7 @@ static int rev_compare_tree(struct rev_info *revs,\n \n static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)\n {\n-\tstruct tree *t1 = get_commit_tree(commit);\n+\tstruct tree *t1 = repo_get_commit_tree(the_repository, commit);\n \n \tif (!t1)\n \t\treturn 0;\n@@ -965,7 +965,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \tif (!revs->prune)\n \t\treturn;\n \n-\tif (!get_commit_tree(commit))\n+\tif (!repo_get_commit_tree(the_repository, commit))\n \t\treturn;\n \n \tif (!commit->parents) {\n@@ -3881,7 +3881,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \t * in it.\n \t */\n \tencoding = get_log_output_encoding();\n-\tmessage = logmsg_reencode(commit, NULL, encoding);\n+\tmessage = repo_logmsg_reencode(the_repository, commit, NULL, encoding);\n \n \t/* Copy the commit to temporary if we are using \"fake\" headers */\n \tif (buf.len)\n@@ -3917,7 +3917,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)\n \t\tretval = grep_buffer(&opt->grep_filter,\n \t\t\t\t     (char *)message, strlen(message));\n \tstrbuf_release(&buf);\n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n \treturn retval;\n }\n \ndiff --git a/sequencer.c b/sequencer.c\nindex 3578dc25510..749455a2597 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -426,7 +426,8 @@ static int get_message(struct commit *commit, struct commit_message *out)\n \tconst char *abbrev, *subject;\n \tint subject_len;\n \n-\tout->message = logmsg_reencode(commit, NULL, get_commit_output_encoding());\n+\tout->message = repo_logmsg_reencode(the_repository, commit, NULL,\n+\t\t\t\t\t    get_commit_output_encoding());\n \tabbrev = short_commit_name(commit);\n \n \tsubject_len = find_commit_subject(out->message, &subject);\n@@ -443,7 +444,7 @@ static void free_message(struct commit *commit, struct commit_message *msg)\n \tfree(msg->parent_label);\n \tfree(msg->label);\n \tfree(msg->subject);\n-\tunuse_commit_buffer(commit, msg->message);\n+\trepo_unuse_commit_buffer(the_repository, commit, msg->message);\n }\n \n static void print_advice(struct repository *r, int show_hint,\n@@ -691,8 +692,8 @@ static int do_recursive_merge(struct repository *r,\n \to.show_rename_progress = 1;\n \n \thead_tree = parse_tree_indirect(head);\n-\tnext_tree = next ? get_commit_tree(next) : empty_tree(r);\n-\tbase_tree = base ? get_commit_tree(base) : empty_tree(r);\n+\tnext_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);\n+\tbase_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);\n \n \tfor (i = 0; i < opts->xopts_nr; i++)\n \t\tparse_merge_opt(&o, opts->xopts[i]);\n@@ -770,7 +771,7 @@ static int is_index_unchanged(struct repository *r)\n \t * the commit is invalid, parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n-\tif (parse_commit(head_commit))\n+\tif (repo_parse_commit(the_repository, head_commit))\n \t\treturn -1;\n \n \tif (!(cache_tree_oid = get_cache_tree_oid(istate)))\n@@ -1335,7 +1336,7 @@ void print_commit_summary(struct repository *r,\n \tcommit = lookup_commit(r, oid);\n \tif (!commit)\n \t\tdie(_(\"couldn't look up newly created commit\"));\n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\tdie(_(\"could not parse newly created commit\"));\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n@@ -1415,7 +1416,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \t\t\twarning(_(\"HEAD %s is not a commit!\"),\n \t\t\t\toid_to_hex(&oid));\n \t\t}\n-\t\tif (parse_commit(current_head))\n+\t\tif (repo_parse_commit(the_repository, current_head))\n \t\t\treturn error(_(\"could not parse HEAD commit\"));\n \t}\n \t*head = current_head;\n@@ -1458,8 +1459,9 @@ static int try_to_commit(struct repository *r,\n \tif (flags & AMEND_MSG) {\n \t\tconst char *exclude_gpgsig[] = { \"gpgsig\", \"gpgsig-sha256\", NULL };\n \t\tconst char *out_enc = get_commit_output_encoding();\n-\t\tconst char *message = logmsg_reencode(current_head, NULL,\n-\t\t\t\t\t\t      out_enc);\n+\t\tconst char *message = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t   current_head, NULL,\n+\t\t\t\t\t\t\t   out_enc);\n \n \t\tif (!msg) {\n \t\t\tconst char *orig_message = NULL;\n@@ -1470,7 +1472,8 @@ static int try_to_commit(struct repository *r,\n \t\t\thook_commit = \"HEAD\";\n \t\t}\n \t\tauthor = amend_author = get_author(message);\n-\t\tunuse_commit_buffer(current_head, message);\n+\t\trepo_unuse_commit_buffer(the_repository, current_head,\n+\t\t\t\t\t message);\n \t\tif (!author) {\n \t\t\tres = error(_(\"unable to parse commit author\"));\n \t\t\tgoto out;\n@@ -1667,12 +1670,12 @@ static int is_original_commit_empty(struct commit *commit)\n {\n \tconst struct object_id *ptree_oid;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn error(_(\"could not parse commit %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tif (commit->parents) {\n \t\tstruct commit *parent = commit->parents->item;\n-\t\tif (parse_commit(parent))\n+\t\tif (repo_parse_commit(the_repository, parent))\n \t\t\treturn error(_(\"could not parse parent commit %s\"),\n \t\t\t\toid_to_hex(&parent->object.oid));\n \t\tptree_oid = get_commit_tree_oid(parent);\n@@ -2000,13 +2003,14 @@ static int update_squash_messages(struct repository *r,\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n-\t\tif (!(head_message = logmsg_reencode(head_commit, NULL, encoding)))\n+\t\tif (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))\n \t\t\treturn error(_(\"could not read HEAD's commit message\"));\n \n \t\tfind_commit_subject(head_message, &body);\n \t\tif (command == TODO_FIXUP && !flag && write_message(body, strlen(body),\n \t\t\t\t\t\t\trebase_path_fixup_msg(), 0) < 0) {\n-\t\t\tunuse_commit_buffer(head_commit, head_message);\n+\t\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n+\t\t\t\t\t\t head_message);\n \t\t\treturn error(_(\"cannot write '%s'\"), rebase_path_fixup_msg());\n \t\t}\n \t\tstrbuf_addf(&buf, \"%c \", comment_line_char);\n@@ -2021,10 +2025,11 @@ static int update_squash_messages(struct repository *r,\n \t\telse\n \t\t\tstrbuf_addstr(&buf, body);\n \n-\t\tunuse_commit_buffer(head_commit, head_message);\n+\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n+\t\t\t\t\t head_message);\n \t}\n \n-\tif (!(message = logmsg_reencode(commit, NULL, encoding)))\n+\tif (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))\n \t\treturn error(_(\"could not read commit message of %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tfind_commit_subject(message, &body);\n@@ -2039,7 +2044,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstrbuf_add_commented_lines(&buf, body, strlen(body));\n \t} else\n \t\treturn error(_(\"unknown command: %d\"), command);\n-\tunuse_commit_buffer(commit, message);\n+\trepo_unuse_commit_buffer(the_repository, commit, message);\n \n \tif (!res)\n \t\tres = write_message(buf.buf, buf.len, rebase_path_squash_msg(),\n@@ -2213,7 +2218,7 @@ static int do_pick_commit(struct repository *r,\n \t\tmsg_file = NULL;\n \t\tgoto fast_forward_edit;\n \t}\n-\tif (parent && parse_commit(parent) < 0)\n+\tif (parent && repo_parse_commit(the_repository, parent) < 0)\n \t\t/* TRANSLATORS: The first %s will be a \"todo\" command like\n \t\t   \"revert\" or \"pick\", the second %s a SHA1. */\n \t\treturn error(_(\"%s: cannot parse parent commit %s\"),\n@@ -3126,7 +3131,9 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \n \twhile ((commit = get_revision(opts->revs))) {\n \t\tstruct todo_item *item = append_new_todo(todo_list);\n-\t\tconst char *commit_buffer = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t\t commit, NULL,\n+\t\t\t\t\t\t\t\t encoding);\n \t\tconst char *subject;\n \t\tint subject_len;\n \n@@ -3138,7 +3145,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n \t\t\tshort_commit_name(commit), subject_len, subject);\n-\t\tunuse_commit_buffer(commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\t\t\t\t commit_buffer);\n \t}\n \n \tif (!todo_list->nr)\n@@ -3522,10 +3530,13 @@ static int make_patch(struct repository *r,\n \tstrbuf_addf(&buf, \"%s/message\", get_dir(opts));\n \tif (!file_exists(buf.buf)) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *commit_buffer = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t\t commit, NULL,\n+\t\t\t\t\t\t\t\t encoding);\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tres |= write_message(subject, strlen(subject), buf.buf, 1);\n-\t\tunuse_commit_buffer(commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\t\t\t\t commit_buffer);\n \t}\n \tstrbuf_release(&buf);\n \trelease_revisions(&log_tree_opt);\n@@ -3992,7 +4003,9 @@ static int do_merge(struct repository *r,\n \n \tif (commit) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *message = logmsg_reencode(commit, NULL, encoding);\n+\t\tconst char *message = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t\t   commit, NULL,\n+\t\t\t\t\t\t\t   encoding);\n \t\tconst char *body;\n \t\tint len;\n \n@@ -4005,7 +4018,7 @@ static int do_merge(struct repository *r,\n \t\tfind_commit_subject(message, &body);\n \t\tlen = strlen(body);\n \t\tret = write_message(body, len, git_path_merge_msg(r), 0);\n-\t\tunuse_commit_buffer(commit, message);\n+\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n \t\tif (ret) {\n \t\t\terror_errno(_(\"could not write '%s'\"),\n \t\t\t\t    git_path_merge_msg(r));\n@@ -4588,7 +4601,7 @@ static int stopped_at_head(struct repository *r)\n \n \tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n-\t    parse_commit(commit) || get_message(commit, &message))\n+\t    repo_parse_commit(the_repository, commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n \telse {\n \t\tfprintf(stderr, _(\"Stopped at %s\\n\"), message.label);\n@@ -5045,13 +5058,15 @@ static int commit_staged_changes(struct repository *r,\n \t\t\t\tconst char *encoding = get_commit_output_encoding();\n \n \t\t\t\tif (parse_head(r, &commit) ||\n-\t\t\t\t    !(p = logmsg_reencode(commit, NULL, encoding)) ||\n+\t\t\t\t    !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||\n \t\t\t\t    write_message(p, strlen(p), path, 0)) {\n-\t\t\t\t\tunuse_commit_buffer(commit, p);\n+\t\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t\t commit, p);\n \t\t\t\t\treturn error(_(\"could not write file: \"\n \t\t\t\t\t\t       \"'%s'\"), path);\n \t\t\t\t}\n-\t\t\t\tunuse_commit_buffer(commit, p);\n+\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\t\t\t\t commit, p);\n \t\t\t}\n \t\t}\n \n@@ -5928,7 +5943,7 @@ static int skip_unnecessary_picks(struct repository *r,\n \t\t\tcontinue;\n \t\tif (item->command != TODO_PICK)\n \t\t\tbreak;\n-\t\tif (parse_commit(item->commit)) {\n+\t\tif (repo_parse_commit(the_repository, item->commit)) {\n \t\t\treturn error(_(\"could not parse commit '%s'\"),\n \t\t\t\toid_to_hex(&item->commit->object.oid));\n \t\t}\n@@ -6261,12 +6276,15 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)\n \t\t\treturn error(_(\"the script was already rearranged.\"));\n \t\t}\n \n-\t\tparse_commit(item->commit);\n-\t\tcommit_buffer = logmsg_reencode(item->commit, NULL, \"UTF-8\");\n+\t\trepo_parse_commit(the_repository, item->commit);\n+\t\tcommit_buffer = repo_logmsg_reencode(the_repository,\n+\t\t\t\t\t\t     item->commit, NULL,\n+\t\t\t\t\t\t     \"UTF-8\");\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tformat_subject(&buf, subject, \" \");\n \t\tsubject = subjects[i] = strbuf_detach(&buf, &subject_len);\n-\t\tunuse_commit_buffer(item->commit, commit_buffer);\n+\t\trepo_unuse_commit_buffer(the_repository, item->commit,\n+\t\t\t\t\t commit_buffer);\n \t\tif (skip_fixupish(subject, &p)) {\n \t\t\tstruct commit *commit2;\n \ndiff --git a/shallow.c b/shallow.c\nindex db9856ef8ad..138bcfe009c 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -249,7 +249,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,\n \t\tstruct commit *c = p->item;\n \t\tstruct commit_list *parent;\n \n-\t\tif (parse_commit(c))\n+\t\tif (repo_parse_commit(the_repository, c))\n \t\t\tdie(\"unable to parse commit %s\",\n \t\t\t    oid_to_hex(&c->object.oid));\n \n@@ -585,7 +585,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,\n \t\tif (c->object.flags & BOTTOM)\n \t\t\tcontinue;\n \n-\t\tif (parse_commit(c))\n+\t\tif (repo_parse_commit(the_repository, c))\n \t\t\tdie(\"unable to parse commit %s\",\n \t\t\t    oid_to_hex(&c->object.oid));\n \ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 3f8d5761780..e07448c1a17 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -66,7 +66,8 @@ static struct commit *create_commit(struct tree *tree,\n \tstruct commit_extra_header *extra;\n \tstruct strbuf msg = STRBUF_INIT;\n \tconst char *out_enc = get_commit_output_encoding();\n-\tconst char *message = logmsg_reencode(based_on, NULL, out_enc);\n+\tconst char *message = repo_logmsg_reencode(the_repository, based_on,\n+\t\t\t\t\t\t   NULL, out_enc);\n \tconst char *orig_message = NULL;\n \tconst char *exclude_gpgsig[] = { \"gpgsig\", NULL };\n \n@@ -157,7 +158,7 @@ int cmd__fast_rebase(int argc, const char **argv)\n \tmemset(&result, 0, sizeof(result));\n \tmerge_opt.show_rename_progress = 1;\n \tmerge_opt.branch1 = \"HEAD\";\n-\thead_tree = get_commit_tree(onto);\n+\thead_tree = repo_get_commit_tree(the_repository, onto);\n \tresult.tree = head_tree;\n \tlast_commit = onto;\n \twhile ((commit = get_revision(&revs))) {\n@@ -168,8 +169,8 @@ int cmd__fast_rebase(int argc, const char **argv)\n \t\tassert(commit->parents && !commit->parents->next);\n \t\tbase = commit->parents->item;\n \n-\t\tnext_tree = get_commit_tree(commit);\n-\t\tbase_tree = get_commit_tree(base);\n+\t\tnext_tree = repo_get_commit_tree(the_repository, commit);\n+\t\tbase_tree = repo_get_commit_tree(the_repository, base);\n \n \t\tmerge_opt.branch2 = short_commit_name(commit);\n \t\tmerge_opt.ancestor = xstrfmt(\"parent of %s\", merge_opt.branch2);\ndiff --git a/tree.c b/tree.c\nindex 76a6534f678..e33f4009ac9 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -59,7 +59,7 @@ int read_tree_at(struct repository *r,\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\n \n-\t\t\tif (parse_commit(commit))\n+\t\t\tif (repo_parse_commit(the_repository, commit))\n \t\t\t\tdie(\"Invalid commit %s in submodule path %s%s\",\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\ndiff --git a/walker.c b/walker.c\nindex c0469363789..5275070de76 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -80,7 +80,7 @@ static int process_commit(struct walker *walker, struct commit *commit)\n {\n \tstruct commit_list *parents;\n \n-\tif (parse_commit(commit))\n+\tif (repo_parse_commit(the_repository, commit))\n \t\treturn -1;\n \n \twhile (complete && complete->item->date >= commit->date) {\n@@ -94,7 +94,7 @@ static int process_commit(struct walker *walker, struct commit *commit)\n \n \twalker_say(walker, \"walk %s\\n\", oid_to_hex(&commit->object.oid));\n \n-\tif (process(walker, &get_commit_tree(commit)->object))\n+\tif (process(walker, &repo_get_commit_tree(the_repository, commit)->object))\n \t\treturn -1;\n \n \tfor (parents = commit->parents; parents; parents = parents->next) {\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474290","messageId":"patch-v2-10.17-10e05c56231-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 10/17] cocci: apply the \"pretty.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:51Z","receivedAt":"2023-03-28T14:00:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"pretty.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n archive.c                                       |  3 ++-\n bisect.c                                        |  3 ++-\n builtin/bisect.c                                | 10 ++++++----\n builtin/commit.c                                | 13 ++++++++-----\n builtin/notes.c                                 |  3 ++-\n builtin/shortlog.c                              |  6 ++++--\n contrib/coccinelle/the_repository.cocci         |  4 ++++\n contrib/coccinelle/the_repository.pending.cocci |  4 ----\n fmt-merge-msg.c                                 |  3 ++-\n log-tree.c                                      |  9 ++++++---\n notes-cache.c                                   |  3 ++-\n object-name.c                                   |  6 ++++--\n pretty.c                                        |  3 ++-\n pretty.h                                        |  4 ----\n sequencer.c                                     | 12 ++++++++----\n t/helper/test-revision-walking.c                |  3 ++-\n 16 files changed, 54 insertions(+), 35 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex c6eaa6d6146..98de324362a 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -61,7 +61,8 @@ static void format_subst(const struct commit *commit,\n \t\tstrbuf_add(&fmt, b + 8, c - b - 8);\n \n \t\tstrbuf_add(buf, src, b - src);\n-\t\tformat_commit_message(commit, fmt.buf, buf, ctx);\n+\t\trepo_format_commit_message(the_repository, commit, fmt.buf,\n+\t\t\t\t\t   buf, ctx);\n \t\tlen -= c + 1 - src;\n \t\tsrc  = c + 1;\n \t}\ndiff --git a/bisect.c b/bisect.c\nindex 5998e4b2e32..d55f2a4da5d 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -753,7 +753,8 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,\n \t}\n \n \tcommit = lookup_commit_reference(the_repository, bisect_rev);\n-\tformat_commit_message(commit, \"[%H] %s%n\", &commit_msg, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"[%H] %s%n\",\n+\t\t\t\t   &commit_msg, &pp);\n \tfputs(commit_msg.buf, stdout);\n \tstrbuf_release(&commit_msg);\n \ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex f925ceeb3c0..6b01e3c3e8e 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -267,7 +267,8 @@ static void log_commit(FILE *fp, char *fmt, const char *state,\n \tstruct strbuf commit_msg = STRBUF_INIT;\n \tchar *label = xstrfmt(fmt, state);\n \n-\tformat_commit_message(commit, \"%s\", &commit_msg, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &commit_msg,\n+\t\t\t\t   &pp);\n \n \tfprintf(fp, \"# %s: [%s] %s\\n\", label, oid_to_hex(&commit->object.oid),\n \t\tcommit_msg.buf);\n@@ -605,8 +606,8 @@ static int bisect_skipped_commits(struct bisect_terms *terms)\n \n \twhile ((commit = get_revision(&revs)) != NULL) {\n \t\tstrbuf_reset(&commit_name);\n-\t\tformat_commit_message(commit, \"%s\",\n-\t\t\t\t      &commit_name, &pp);\n+\t\trepo_format_commit_message(the_repository, commit, \"%s\",\n+\t\t\t\t\t   &commit_name, &pp);\n \t\tfprintf(fp, \"# possible first %s commit: [%s] %s\\n\",\n \t\t\tterms->term_bad, oid_to_hex(&commit->object.oid),\n \t\t\tcommit_name.buf);\n@@ -635,7 +636,8 @@ static int bisect_successful(struct bisect_terms *terms)\n \n \tread_ref(bad_ref, &oid);\n \tcommit = lookup_commit_reference_by_name(bad_ref);\n-\tformat_commit_message(commit, \"%s\", &commit_name, &pp);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &commit_name,\n+\t\t\t\t   &pp);\n \n \tres = append_to_file(git_path_bisect_log(), \"# first %s commit: [%s] %s\\n\",\n \t\t\t    terms->term_bad, oid_to_hex(&commit->object.oid),\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex c64fc50e923..b8b4893ab20 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -719,7 +719,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,\n \t * duplicate the subject line.\n \t */\n \tfmt = starts_with(subject, \"amend!\") ? \"%b\" : \"%B\";\n-\tformat_commit_message(commit, fmt, sb, ctx);\n+\trepo_format_commit_message(the_repository, commit, fmt, sb, ctx);\n \trepo_unuse_commit_buffer(the_repository, commit, buffer);\n }\n \n@@ -760,8 +760,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tif (!c)\n \t\t\t\tdie(_(\"could not lookup commit %s\"), squash_message);\n \t\t\tctx.output_encoding = get_commit_output_encoding();\n-\t\t\tformat_commit_message(c, \"squash! %s\\n\\n\", &sb,\n-\t\t\t\t\t      &ctx);\n+\t\t\trepo_format_commit_message(the_repository, c,\n+\t\t\t\t\t\t   \"squash! %s\\n\\n\", &sb,\n+\t\t\t\t\t\t   &ctx);\n \t\t}\n \t}\n \n@@ -795,7 +796,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tdie(_(\"could not lookup commit %s\"), fixup_commit);\n \t\tctx.output_encoding = get_commit_output_encoding();\n \t\tfmt = xstrfmt(\"%s! %%s\\n\\n\", fixup_prefix);\n-\t\tformat_commit_message(commit, fmt, &sb, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit, fmt, &sb,\n+\t\t\t\t\t   &ctx);\n \t\tfree(fmt);\n \t\thook_arg1 = \"message\";\n \n@@ -1135,7 +1137,8 @@ static const char *find_author_by_nickname(const char *name)\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode.type = DATE_NORMAL;\n \t\tstrbuf_release(&buf);\n-\t\tformat_commit_message(commit, \"%aN <%aE>\", &buf, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   \"%aN <%aE>\", &buf, &ctx);\n \t\trelease_revisions(&revs);\n \t\treturn strbuf_detach(&buf, NULL);\n \t}\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 4b13943be7f..859a56591aa 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -744,7 +744,8 @@ static int merge_commit(struct notes_merge_options *o)\n \n \t/* Reuse existing commit message in reflog message */\n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\tformat_commit_message(partial, \"%s\", &msg, &pretty_ctx);\n+\trepo_format_commit_message(the_repository, partial, \"%s\", &msg,\n+\t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \tstrbuf_insertstr(&msg, 0, \"notes: \");\n \tupdate_ref(msg.buf, o->local_ref, &oid,\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 8afd1ad865e..62f91b8b932 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -223,7 +223,8 @@ static void insert_records_from_format(struct shortlog *log,\n \tfor_each_string_list_item(item, &log->format) {\n \t\tstrbuf_reset(&buf);\n \n-\t\tformat_commit_message(commit, item->string, &buf, ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   item->string, &buf, ctx);\n \n \t\tif (!shortlog_needs_dedup(log) || strset_add(dups, buf.buf))\n \t\t\tinsert_one_record(log, buf.buf, oneline);\n@@ -249,7 +250,8 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tif (log->user_format)\n \t\t\tpretty_print_commit(&ctx, commit, &oneline);\n \t\telse\n-\t\t\tformat_commit_message(commit, \"%s\", &oneline, &ctx);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%s\", &oneline, &ctx);\n \t}\n \toneline_str = oneline.len ? oneline.buf : \"<none>\";\n \ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex fa159aba5b5..ff4c56114f1 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -87,6 +87,10 @@\n |\n - has_object_file_with_flags\n + repo_has_object_file_with_flags\n+// pretty.h\n+|\n+- format_commit_message\n++ repo_format_commit_message\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 69e9694111e..375850e773c 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// pretty.h\n-- format_commit_message\n-+ repo_format_commit_message\n // packfile.h\n-|\n - approximate_object_count\n + repo_approximate_object_count\n // promisor-remote.h\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex 5aab1d06619..5236b75fab2 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -383,7 +383,8 @@ static void shortlog(const char *name,\n \t\tif (subjects.nr > limit)\n \t\t\tcontinue;\n \n-\t\tformat_commit_message(commit, \"%s\", &sb, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit, \"%s\", &sb,\n+\t\t\t\t\t   &ctx);\n \t\tstrbuf_ltrim(&sb);\n \n \t\tif (!sb.len)\ndiff --git a/log-tree.c b/log-tree.c\nindex 5c97bc403fb..f65c36e19dc 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -410,7 +410,8 @@ void fmt_output_commit(struct strbuf *filename,\n \tstruct pretty_print_context ctx = {0};\n \tstruct strbuf subject = STRBUF_INIT;\n \n-\tformat_commit_message(commit, \"%f\", &subject, &ctx);\n+\trepo_format_commit_message(the_repository, commit, \"%f\", &subject,\n+\t\t\t\t   &ctx);\n \tfmt_output_subject(filename, subject.buf, info);\n \tstrbuf_release(&subject);\n }\n@@ -988,8 +989,10 @@ static int do_remerge_diff(struct rev_info *opt,\n \to.msg_header_prefix = \"remerge\";\n \n \tctx.abbrev = DEFAULT_ABBREV;\n-\tformat_commit_message(parent1, \"%h (%s)\", &parent1_desc, &ctx);\n-\tformat_commit_message(parent2, \"%h (%s)\", &parent2_desc, &ctx);\n+\trepo_format_commit_message(the_repository, parent1, \"%h (%s)\",\n+\t\t\t\t   &parent1_desc, &ctx);\n+\trepo_format_commit_message(the_repository, parent2, \"%h (%s)\",\n+\t\t\t\t   &parent2_desc, &ctx);\n \to.branch1 = parent1_desc.buf;\n \to.branch2 = parent2_desc.buf;\n \ndiff --git a/notes-cache.c b/notes-cache.c\nindex 38466091360..e5e9092d367 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -23,7 +23,8 @@ static int notes_cache_match_validity(struct repository *r,\n \t\treturn 0;\n \n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\tformat_commit_message(commit, \"%s\", &msg, &pretty_ctx);\n+\trepo_format_commit_message(the_repository, commit, \"%s\", &msg,\n+\t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \n \tret = !strcmp(msg.buf, validity);\ndiff --git a/object-name.c b/object-name.c\nindex b297cbd0a18..c7cef682f20 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -395,8 +395,10 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)\n \t\tif (commit) {\n \t\t\tstruct pretty_print_context pp = {0};\n \t\t\tpp.date_mode.type = DATE_SHORT;\n-\t\t\tformat_commit_message(commit, \"%ad\", &date, &pp);\n-\t\t\tformat_commit_message(commit, \"%s\", &msg, &pp);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%ad\", &date, &pp);\n+\t\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t\t   \"%s\", &msg, &pp);\n \t\t}\n \n \t\t/*\ndiff --git a/pretty.c b/pretty.c\nindex 34e0a3bc786..0ce6ab7e196 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2202,7 +2202,8 @@ void pretty_print_commit(struct pretty_print_context *pp,\n \tint need_8bit_cte = pp->need_8bit_cte;\n \n \tif (pp->fmt == CMIT_FMT_USERFORMAT) {\n-\t\tformat_commit_message(commit, user_format, sb, pp);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   user_format, sb, pp);\n \t\treturn;\n \t}\n \ndiff --git a/pretty.h b/pretty.h\nindex 921dd6e0cae..421209e9ec2 100644\n--- a/pretty.h\n+++ b/pretty.h\n@@ -120,10 +120,6 @@ void repo_format_commit_message(struct repository *r,\n \t\t\tconst struct commit *commit,\n \t\t\tconst char *format, struct strbuf *sb,\n \t\t\tconst struct pretty_print_context *context);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define format_commit_message(c, f, s, con) \\\n-\trepo_format_commit_message(the_repository, c, f, s, con)\n-#endif\n \n /*\n  * Parse given arguments from \"arg\", check it for correctness and\ndiff --git a/sequencer.c b/sequencer.c\nindex 749455a2597..d0ad37700fd 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1341,8 +1341,10 @@ void print_commit_summary(struct repository *r,\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n \n-\tformat_commit_message(commit, \"%an <%ae>\", &author_ident, &pctx);\n-\tformat_commit_message(commit, \"%cn <%ce>\", &committer_ident, &pctx);\n+\trepo_format_commit_message(the_repository, commit, \"%an <%ae>\",\n+\t\t\t\t   &author_ident, &pctx);\n+\trepo_format_commit_message(the_repository, commit, \"%cn <%ce>\",\n+\t\t\t\t   &committer_ident, &pctx);\n \tif (strbuf_cmp(&author_ident, &committer_ident)) {\n \t\tstrbuf_addstr(&format, \"\\n Author: \");\n \t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n@@ -1350,7 +1352,8 @@ void print_commit_summary(struct repository *r,\n \tif (flags & SUMMARY_SHOW_AUTHOR_DATE) {\n \t\tstruct strbuf date = STRBUF_INIT;\n \n-\t\tformat_commit_message(commit, \"%ad\", &date, &pctx);\n+\t\trepo_format_commit_message(the_repository, commit, \"%ad\",\n+\t\t\t\t\t   &date, &pctx);\n \t\tstrbuf_addstr(&format, \"\\n Date: \");\n \t\tstrbuf_addbuf_percentquote(&format, &date);\n \t\tstrbuf_release(&date);\n@@ -2123,7 +2126,8 @@ static void refer_to_commit(struct replay_opts *opts,\n \t\t\t.abbrev = DEFAULT_ABBREV,\n \t\t\t.date_mode.type = DATE_SHORT,\n \t\t};\n-\t\tformat_commit_message(commit, \"%h (%s, %ad)\", msgbuf, &ctx);\n+\t\trepo_format_commit_message(the_repository, commit,\n+\t\t\t\t\t   \"%h (%s, %ad)\", msgbuf, &ctx);\n \t} else {\n \t\tstrbuf_addstr(msgbuf, oid_to_hex(&commit->object.oid));\n \t}\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex 4a45d5bac2a..c7b22cb33d5 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -19,7 +19,8 @@ static void print_commit(struct commit *commit)\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n \tctx.date_mode.type = DATE_NORMAL;\n-\tformat_commit_message(commit, \" %m %s\", &sb, &ctx);\n+\trepo_format_commit_message(the_repository, commit, \" %m %s\", &sb,\n+\t\t\t\t   &ctx);\n \tprintf(\"%s\\n\", sb.buf);\n \tstrbuf_release(&sb);\n }\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474291","messageId":"patch-v2-11.17-13955394126-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 11/17] cocci: apply the \"packfile.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:52Z","receivedAt":"2023-03-28T14:00:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"packfile.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/gc.c                                    | 2 +-\n commit-graph.c                                  | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n packfile.h                                      | 1 -\n 5 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 9dc80344b64..a61d62bcf7b 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -285,7 +285,7 @@ static uint64_t total_ram(void)\n \n static uint64_t estimate_repack_memory(struct packed_git *pack)\n {\n-\tunsigned long nr_objects = approximate_object_count();\n+\tunsigned long nr_objects = repo_approximate_object_count(the_repository);\n \tsize_t os_cache, heap;\n \n \tif (!pack || !nr_objects)\ndiff --git a/commit-graph.c b/commit-graph.c\nindex a30c4c96940..6403567dfee 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2361,7 +2361,7 @@ int write_commit_graph(struct object_directory *odb,\n \t\t\treplace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE;\n \t}\n \n-\tctx->approx_nr_objects = approximate_object_count();\n+\tctx->approx_nr_objects = repo_approximate_object_count(the_repository);\n \n \tif (ctx->append && ctx->r->objects->commit_graph) {\n \t\tstruct commit_graph *g = ctx->r->objects->commit_graph;\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex ff4c56114f1..a325361f961 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -91,6 +91,10 @@\n |\n - format_commit_message\n + repo_format_commit_message\n+// packfile.h\n+|\n+- approximate_object_count\n++ repo_approximate_object_count\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 375850e773c..9b426e49e66 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// packfile.h\n-- approximate_object_count\n-+ repo_approximate_object_count\n // promisor-remote.h\n-|\n - promisor_remote_reinit\n + repo_promisor_remote_reinit\n |\ndiff --git a/packfile.h b/packfile.h\nindex a3f6723857b..6ec16567971 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -65,7 +65,6 @@ struct packed_git *get_all_packs(struct repository *r);\n  * for speed.\n  */\n unsigned long repo_approximate_object_count(struct repository *r);\n-#define approximate_object_count() repo_approximate_object_count(the_repository)\n \n struct packed_git *find_sha1_pack(const unsigned char *sha1,\n \t\t\t\t  struct packed_git *packs);\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474293","messageId":"patch-v2-09.17-1866d473f1b-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 09/17] cocci: apply the \"object-store.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:50Z","receivedAt":"2023-03-28T14:00:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"object-store.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n apply.c                                       |  9 +++++---\n archive.c                                     |  2 +-\n bisect.c                                      |  5 ++--\n blame.c                                       | 11 +++++----\n builtin/cat-file.c                            | 23 +++++++++++--------\n builtin/clone.c                               |  6 ++---\n builtin/difftool.c                            |  3 ++-\n builtin/fast-export.c                         |  5 ++--\n builtin/fast-import.c                         |  7 +++---\n builtin/fetch.c                               | 12 +++++-----\n builtin/grep.c                                |  6 +++--\n builtin/index-pack.c                          |  9 +++++---\n builtin/log.c                                 |  2 +-\n builtin/merge-tree.c                          |  9 +++++---\n builtin/mktag.c                               |  3 ++-\n builtin/notes.c                               |  7 +++---\n builtin/pack-objects.c                        | 22 ++++++++++++------\n builtin/receive-pack.c                        |  2 +-\n builtin/remote.c                              |  2 +-\n builtin/show-ref.c                            |  2 +-\n builtin/tag.c                                 |  4 ++--\n builtin/unpack-file.c                         |  2 +-\n builtin/unpack-objects.c                      |  5 ++--\n bulk-checkin.c                                |  2 +-\n bundle.c                                      |  2 +-\n cache-tree.c                                  |  8 +++----\n combine-diff.c                                |  2 +-\n commit.c                                      |  3 ++-\n contrib/coccinelle/the_repository.cocci       | 10 ++++++++\n .../coccinelle/the_repository.pending.cocci   | 10 --------\n dir.c                                         |  2 +-\n entry.c                                       |  3 ++-\n fetch-pack.c                                  |  8 +++----\n fmt-merge-msg.c                               |  3 ++-\n fsck.c                                        |  2 +-\n http-push.c                                   | 11 +++++----\n http-walker.c                                 |  4 ++--\n list-objects.c                                |  2 +-\n mailmap.c                                     |  2 +-\n match-trees.c                                 |  4 ++--\n merge-blobs.c                                 |  6 +++--\n merge-ort.c                                   |  2 +-\n merge-recursive.c                             |  5 ++--\n notes-cache.c                                 |  2 +-\n notes-merge.c                                 |  2 +-\n notes.c                                       | 12 ++++++----\n object-file.c                                 |  2 +-\n object-store.h                                |  7 ------\n read-cache.c                                  |  5 ++--\n reflog.c                                      |  5 ++--\n remote.c                                      |  2 +-\n rerere.c                                      |  5 ++--\n send-pack.c                                   |  6 ++---\n shallow.c                                     |  6 ++---\n submodule-config.c                            |  3 ++-\n tag.c                                         |  5 ++--\n tree.c                                        |  3 ++-\n upload-pack.c                                 |  8 +++----\n walker.c                                      |  2 +-\n xdiff-interface.c                             |  2 +-\n 60 files changed, 184 insertions(+), 142 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex ed6abc7722f..23789bb2d12 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3203,7 +3203,8 @@ static int apply_binary(struct apply_state *state,\n \t\tunsigned long size;\n \t\tchar *result;\n \n-\t\tresult = read_object_file(&oid, &type, &size);\n+\t\tresult = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t\t       &size);\n \t\tif (!result)\n \t\t\treturn error(_(\"the necessary postimage %s for \"\n \t\t\t\t       \"'%s' cannot be read\"),\n@@ -3266,7 +3267,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns\n \t\tunsigned long sz;\n \t\tchar *result;\n \n-\t\tresult = read_object_file(oid, &type, &sz);\n+\t\tresult = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t       &sz);\n \t\tif (!result)\n \t\t\treturn -1;\n \t\t/* XXX read_sha1_file NUL-terminates */\n@@ -3494,7 +3496,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)\n \n \tclear_image(image);\n \n-\timage->buf = read_object_file(result_id, &type, &size);\n+\timage->buf = repo_read_object_file(the_repository, result_id, &type,\n+\t\t\t\t\t   &size);\n \tif (!image->buf || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(result_id));\n \timage->len = size;\ndiff --git a/archive.c b/archive.c\nindex cb7ca69cce1..c6eaa6d6146 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -86,7 +86,7 @@ static void *object_file_to_archive(const struct archiver_args *args,\n \t\t\t       (args->tree ? &args->tree->object.oid : NULL), oid);\n \n \tpath += args->baselen;\n-\tbuffer = read_object_file(oid, type, sizep);\n+\tbuffer = repo_read_object_file(the_repository, oid, type, sizep);\n \tif (buffer && S_ISREG(mode)) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n \t\tsize_t size = 0;\ndiff --git a/bisect.c b/bisect.c\nindex b1639a9de7f..5998e4b2e32 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -149,8 +149,9 @@ static void show_list(const char *debug, int counted, int nr,\n \t\tunsigned commit_flags = commit->object.flags;\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tchar *buf = read_object_file(&commit->object.oid, &type,\n-\t\t\t\t\t     &size);\n+\t\tchar *buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &commit->object.oid, &type,\n+\t\t\t\t\t\t  &size);\n \t\tconst char *subject_start;\n \t\tint subject_len;\n \ndiff --git a/blame.c b/blame.c\nindex 0f2751de83b..c42ceea5ae1 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -1029,8 +1029,9 @@ static void fill_origin_blob(struct diff_options *opt,\n \t\t\t\t    &o->blob_oid, 1, &file->ptr, &file_size))\n \t\t\t;\n \t\telse\n-\t\t\tfile->ptr = read_object_file(&o->blob_oid, &type,\n-\t\t\t\t\t\t     &file_size);\n+\t\t\tfile->ptr = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t  &o->blob_oid, &type,\n+\t\t\t\t\t\t\t  &file_size);\n \t\tfile->size = file_size;\n \n \t\tif (!file->ptr)\n@@ -2839,8 +2840,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,\n \t\t\t\t    &sb->final_buf_size))\n \t\t\t;\n \t\telse\n-\t\t\tsb->final_buf = read_object_file(&o->blob_oid, &type,\n-\t\t\t\t\t\t\t &sb->final_buf_size);\n+\t\t\tsb->final_buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t      &o->blob_oid,\n+\t\t\t\t\t\t\t      &type,\n+\t\t\t\t\t\t\t      &sb->final_buf_size);\n \n \t\tif (!sb->final_buf)\n \t\t\tdie(_(\"cannot read blob %s for path %s\"),\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 9e7e03ade41..a7bcb55b40d 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -64,7 +64,7 @@ static int filter_object(const char *path, unsigned mode,\n {\n \tenum object_type type;\n \n-\t*buf = read_object_file(oid, &type, size);\n+\t*buf = repo_read_object_file(the_repository, oid, &type, size);\n \tif (!*buf)\n \t\treturn error(_(\"cannot read object %s '%s'\"),\n \t\t\t     oid_to_hex(oid), path);\n@@ -156,7 +156,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\tgoto cleanup;\n \n \tcase 'e':\n-\t\treturn !has_object_file(&oid);\n+\t\treturn !repo_has_object_file(the_repository, &oid);\n \n \tcase 'w':\n \n@@ -191,7 +191,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\t\tret = stream_blob(&oid);\n \t\t\tgoto cleanup;\n \t\t}\n-\t\tbuf = read_object_file(&oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t\t    &size);\n \t\tif (!buf)\n \t\t\tdie(\"Cannot read object %s\", obj_name);\n \n@@ -211,8 +212,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n \t\tif (exp_type_id == OBJ_BLOB) {\n \t\t\tstruct object_id blob_oid;\n \t\t\tif (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {\n-\t\t\t\tchar *buffer = read_object_file(&oid, &type,\n-\t\t\t\t\t\t\t\t&size);\n+\t\t\t\tchar *buffer = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t\t     &oid,\n+\t\t\t\t\t\t\t\t     &type,\n+\t\t\t\t\t\t\t\t     &size);\n \t\t\t\tconst char *target;\n \t\t\t\tif (!skip_prefix(buffer, \"object \", &target) ||\n \t\t\t\t    get_oid_hex(target, &blob_oid))\n@@ -387,9 +390,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d\n \t\t\t\tif (!textconv_object(the_repository,\n \t\t\t\t\t\t     data->rest, 0100644, oid,\n \t\t\t\t\t\t     1, &contents, &size))\n-\t\t\t\t\tcontents = read_object_file(oid,\n-\t\t\t\t\t\t\t\t    &type,\n-\t\t\t\t\t\t\t\t    &size);\n+\t\t\t\t\tcontents = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t\t\t oid,\n+\t\t\t\t\t\t\t\t\t &type,\n+\t\t\t\t\t\t\t\t\t &size);\n \t\t\t\tif (!contents)\n \t\t\t\t\tdie(\"could not convert '%s' %s\",\n \t\t\t\t\t    oid_to_hex(oid), data->rest);\n@@ -406,7 +410,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d\n \t\tunsigned long size;\n \t\tvoid *contents;\n \n-\t\tcontents = read_object_file(oid, &type, &size);\n+\t\tcontents = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t &size);\n \n \t\tif (use_mailmap) {\n \t\t\tsize_t s = size;\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 462c286274c..e50e7e2c06e 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -548,9 +548,9 @@ static void write_followtags(const struct ref *refs, const char *msg)\n \t\t\tcontinue;\n \t\tif (ends_with(ref->name, \"^{}\"))\n \t\t\tcontinue;\n-\t\tif (!has_object_file_with_flags(&ref->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK |\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,\n+\t\t\t\t\t\t     OBJECT_INFO_QUICK |\n+\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\tcontinue;\n \t\tupdate_ref(msg, ref->name, &ref->old_oid, NULL, 0,\n \t\t\t   UPDATE_REFS_DIE_ON_ERR);\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 01681d0fb88..74466332b58 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -296,7 +296,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)\n \t} else {\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tdata = read_object_file(oid, &type, &size);\n+\t\tdata = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t     &size);\n \t\tif (!data)\n \t\t\tdie(_(\"could not read object %s for symlink %s\"),\n \t\t\t\toid_to_hex(oid), path);\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex fc5859dc9fa..166f51b100a 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -297,7 +297,7 @@ static void export_blob(const struct object_id *oid)\n \t\tobject = (struct object *)lookup_blob(the_repository, oid);\n \t\teaten = 0;\n \t} else {\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf)\n \t\t\tdie(\"could not read blob %s\", oid_to_hex(oid));\n \t\tif (check_object_signature(the_repository, oid, buf, size,\n@@ -767,7 +767,8 @@ static void handle_tag(const char *name, struct tag *tag)\n \t\treturn;\n \t}\n \n-\tbuf = read_object_file(&tag->object.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &tag->object.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\tdie(\"could not read tag %s\", oid_to_hex(&tag->object.oid));\n \tmessage = memmem(buf, size, \"\\n\\n\", 2);\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex e4566490d91..7a7987b67de 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1266,7 +1266,7 @@ static void load_tree(struct tree_entry *root)\n \t\t\tdie(\"Can't load tree %s\", oid_to_hex(oid));\n \t} else {\n \t\tenum object_type type;\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf || type != OBJ_TREE)\n \t\t\tdie(\"Can't load tree %s\", oid_to_hex(oid));\n \t}\n@@ -2937,7 +2937,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)\n \tchar *buf;\n \n \tif (!oe || oe->pack_id == MAX_PACK_ID) {\n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t} else {\n \t\ttype = oe->type;\n \t\tbuf = gfi_unpack_entry(oe, &size);\n@@ -3045,7 +3045,8 @@ static struct object_entry *dereference(struct object_entry *oe,\n \t\tbuf = gfi_unpack_entry(oe, &size);\n \t} else {\n \t\tenum object_type unused;\n-\t\tbuf = read_object_file(oid, &unused, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &unused,\n+\t\t\t\t\t    &size);\n \t}\n \tif (!buf)\n \t\tdie(\"Can't load object %s\", oid_to_hex(oid));\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 16dc2a33cac..0ee5d269768 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -408,9 +408,9 @@ static void find_non_local_tags(const struct ref *refs,\n \t\t */\n \t\tif (ends_with(ref->name, \"^{}\")) {\n \t\t\tif (item &&\n-\t\t\t    !has_object_file_with_flags(&ref->old_oid, quick_flags) &&\n+\t\t\t    !repo_has_object_file_with_flags(the_repository, &ref->old_oid, quick_flags) &&\n \t\t\t    !oidset_contains(&fetch_oids, &ref->old_oid) &&\n-\t\t\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t\t\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t\t\t    !oidset_contains(&fetch_oids, &item->oid))\n \t\t\t\tclear_item(item);\n \t\t\titem = NULL;\n@@ -424,7 +424,7 @@ static void find_non_local_tags(const struct ref *refs,\n \t\t * fetch.\n \t\t */\n \t\tif (item &&\n-\t\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t\t    !oidset_contains(&fetch_oids, &item->oid))\n \t\t\tclear_item(item);\n \n@@ -445,7 +445,7 @@ static void find_non_local_tags(const struct ref *refs,\n \t * checked to see if it needs fetching.\n \t */\n \tif (item &&\n-\t    !has_object_file_with_flags(&item->oid, quick_flags) &&\n+\t    !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&\n \t    !oidset_contains(&fetch_oids, &item->oid))\n \t\tclear_item(item);\n \n@@ -1322,8 +1322,8 @@ static int check_exist_and_connected(struct ref *ref_map)\n \t * we need all direct targets to exist.\n \t */\n \tfor (r = rm; r; r = r->next) {\n-\t\tif (!has_object_file_with_flags(&r->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, &r->old_oid,\n+\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\treturn -1;\n \t}\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex c590fcb19dd..49fc0c69095 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -562,7 +562,8 @@ static int grep_cache(struct grep_opt *opt,\n \t\t\tvoid *data;\n \t\t\tunsigned long size;\n \n-\t\t\tdata = read_object_file(&ce->oid, &type, &size);\n+\t\t\tdata = repo_read_object_file(the_repository, &ce->oid,\n+\t\t\t\t\t\t     &type, &size);\n \t\t\tinit_tree_desc(&tree, data, size);\n \n \t\t\thit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);\n@@ -652,7 +653,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,\n \t\t\tvoid *data;\n \t\t\tunsigned long size;\n \n-\t\t\tdata = read_object_file(&entry.oid, &type, &size);\n+\t\t\tdata = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t     &entry.oid, &type, &size);\n \t\t\tif (!data)\n \t\t\t\tdie(_(\"unable to read tree (%s)\"),\n \t\t\t\t    oid_to_hex(&entry.oid));\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex b451755f405..e823a73b357 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -804,7 +804,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \tif (startup_info->have_repository) {\n \t\tread_lock();\n \t\tcollision_test_needed =\n-\t\t\thas_object_file_with_flags(oid, OBJECT_INFO_QUICK);\n+\t\t\trepo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t\t\tOBJECT_INFO_QUICK);\n \t\tread_unlock();\n \t}\n \n@@ -824,7 +825,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \t\t\tdie(_(\"cannot read existing object info %s\"), oid_to_hex(oid));\n \t\tif (has_type != type || has_size != size)\n \t\t\tdie(_(\"SHA1 COLLISION FOUND WITH %s !\"), oid_to_hex(oid));\n-\t\thas_data = read_object_file(oid, &has_type, &has_size);\n+\t\thas_data = repo_read_object_file(the_repository, oid,\n+\t\t\t\t\t\t &has_type, &has_size);\n \t\tread_unlock();\n \t\tif (!data)\n \t\t\tdata = new_data = get_data_from_pack(obj_entry);\n@@ -1417,7 +1419,8 @@ static void fix_unresolved_deltas(struct hashfile *f)\n \n \t\tif (objects[d->obj_no].real_type != OBJ_REF_DELTA)\n \t\t\tcontinue;\n-\t\tdata = read_object_file(&d->oid, &type, &size);\n+\t\tdata = repo_read_object_file(the_repository, &d->oid, &type,\n+\t\t\t\t\t     &size);\n \t\tif (!data)\n \t\t\tcontinue;\n \ndiff --git a/builtin/log.c b/builtin/log.c\nindex 11ba99d6b48..28085547aa8 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -676,7 +676,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)\n {\n \tunsigned long size;\n \tenum object_type type;\n-\tchar *buf = read_object_file(oid, &type, &size);\n+\tchar *buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tint offset = 0;\n \n \tif (!buf)\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex dd23ee684c7..590532706eb 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -70,7 +70,9 @@ static void *result(struct merge_list *entry, unsigned long *size)\n \tconst char *path = entry->path;\n \n \tif (!entry->stage)\n-\t\treturn read_object_file(&entry->blob->object.oid, &type, size);\n+\t\treturn repo_read_object_file(the_repository,\n+\t\t\t\t\t     &entry->blob->object.oid, &type,\n+\t\t\t\t\t     size);\n \tbase = NULL;\n \tif (entry->stage == 1) {\n \t\tbase = entry->blob;\n@@ -93,8 +95,9 @@ static void *origin(struct merge_list *entry, unsigned long *size)\n \tenum object_type type;\n \twhile (entry) {\n \t\tif (entry->stage == 2)\n-\t\t\treturn read_object_file(&entry->blob->object.oid,\n-\t\t\t\t\t\t&type, size);\n+\t\t\treturn repo_read_object_file(the_repository,\n+\t\t\t\t\t\t     &entry->blob->object.oid,\n+\t\t\t\t\t\t     &type, size);\n \t\tentry = entry->link;\n \t}\n \treturn NULL;\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 42c2457c705..4849b8b37c3 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -52,7 +52,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)\n \tvoid *buffer;\n \tconst struct object_id *repl;\n \n-\tbuffer = read_object_file(tagged_oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, tagged_oid, &type,\n+\t\t\t\t       &size);\n \tif (!buffer)\n \t\tdie(_(\"could not read tagged object '%s'\"),\n \t\t    oid_to_hex(tagged_oid));\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 9aea5a4b27b..4b13943be7f 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -126,7 +126,7 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)\n {\n \tunsigned long size;\n \tenum object_type type;\n-\tchar *buf = read_object_file(oid, &type, &size);\n+\tchar *buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (buf) {\n \t\tif (size)\n \t\t\twrite_or_die(fd, buf, size);\n@@ -261,7 +261,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)\n \n \tif (repo_get_oid(the_repository, arg, &object))\n \t\tdie(_(\"failed to resolve '%s' as a valid ref.\"), arg);\n-\tif (!(buf = read_object_file(&object, &type, &len)))\n+\tif (!(buf = repo_read_object_file(the_repository, &object, &type, &len)))\n \t\tdie(_(\"failed to read object '%s'.\"), arg);\n \tif (type != OBJ_BLOB) {\n \t\tfree(buf);\n@@ -618,7 +618,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)\n \t\t/* Append buf to previous note contents */\n \t\tunsigned long size;\n \t\tenum object_type type;\n-\t\tchar *prev_buf = read_object_file(note, &type, &size);\n+\t\tchar *prev_buf = repo_read_object_file(the_repository, note,\n+\t\t\t\t\t\t       &type, &size);\n \n \t\tstrbuf_grow(&d.buf, size + 1);\n \t\tif (d.buf.len && prev_buf && size)\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 545b8bddc8e..068e6326c1d 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -290,11 +290,13 @@ static void *get_delta(struct object_entry *entry)\n \tvoid *buf, *base_buf, *delta_buf;\n \tenum object_type type;\n \n-\tbuf = read_object_file(&entry->idx.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &entry->idx.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\tdie(_(\"unable to read %s\"), oid_to_hex(&entry->idx.oid));\n-\tbase_buf = read_object_file(&DELTA(entry)->idx.oid, &type,\n-\t\t\t\t    &base_size);\n+\tbase_buf = repo_read_object_file(the_repository,\n+\t\t\t\t\t &DELTA(entry)->idx.oid, &type,\n+\t\t\t\t\t &base_size);\n \tif (!base_buf)\n \t\tdie(\"unable to read %s\",\n \t\t    oid_to_hex(&DELTA(entry)->idx.oid));\n@@ -456,7 +458,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent\n \t\t\t\t       &size, NULL)) != NULL)\n \t\t\tbuf = NULL;\n \t\telse {\n-\t\t\tbuf = read_object_file(&entry->idx.oid, &type, &size);\n+\t\t\tbuf = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t    &entry->idx.oid, &type,\n+\t\t\t\t\t\t    &size);\n \t\t\tif (!buf)\n \t\t\t\tdie(_(\"unable to read %s\"),\n \t\t\t\t    oid_to_hex(&entry->idx.oid));\n@@ -1667,7 +1671,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)\n \t/* Did not find one.  Either we got a bogus request or\n \t * we need to read and perhaps cache.\n \t */\n-\tdata = read_object_file(oid, &type, &size);\n+\tdata = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!data)\n \t\treturn NULL;\n \tif (type != OBJ_TREE) {\n@@ -2527,7 +2531,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,\n \t/* Load data if not already done */\n \tif (!trg->data) {\n \t\tpacking_data_lock(&to_pack);\n-\t\ttrg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);\n+\t\ttrg->data = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &trg_entry->idx.oid, &type,\n+\t\t\t\t\t\t  &sz);\n \t\tpacking_data_unlock(&to_pack);\n \t\tif (!trg->data)\n \t\t\tdie(_(\"object %s cannot be read\"),\n@@ -2540,7 +2546,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,\n \t}\n \tif (!src->data) {\n \t\tpacking_data_lock(&to_pack);\n-\t\tsrc->data = read_object_file(&src_entry->idx.oid, &type, &sz);\n+\t\tsrc->data = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t  &src_entry->idx.oid, &type,\n+\t\t\t\t\t\t  &sz);\n \t\tpacking_data_unlock(&to_pack);\n \t\tif (!src->data) {\n \t\t\tif (src_entry->preferred_base) {\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex e2b7202b04c..90d117beaf5 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1493,7 +1493,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)\n \t\t}\n \t}\n \n-\tif (!is_null_oid(new_oid) && !has_object_file(new_oid)) {\n+\tif (!is_null_oid(new_oid) && !repo_has_object_file(the_repository, new_oid)) {\n \t\terror(\"unpack should have generated %s, \"\n \t\t      \"but I can't find it!\", oid_to_hex(new_oid));\n \t\tret = \"bad pack\";\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 729f6f3643a..a6b100dce7f 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -443,7 +443,7 @@ static int get_push_ref_states(const struct ref *remote_refs,\n \t\t\tinfo->status = PUSH_STATUS_UPTODATE;\n \t\telse if (is_null_oid(&ref->old_oid))\n \t\t\tinfo->status = PUSH_STATUS_CREATE;\n-\t\telse if (has_object_file(&ref->old_oid) &&\n+\t\telse if (repo_has_object_file(the_repository, &ref->old_oid) &&\n \t\t\t ref_newer(&ref->new_oid, &ref->old_oid))\n \t\t\tinfo->status = PUSH_STATUS_FASTFORWARD;\n \t\telse\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex b5a68e23e65..63a5bb1efae 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -27,7 +27,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n \tconst char *hex;\n \tstruct object_id peeled;\n \n-\tif (!has_object_file(oid))\n+\tif (!repo_has_object_file(the_repository, oid))\n \t\tdie(\"git show-ref: bad ref %s (%s)\", refname,\n \t\t    oid_to_hex(oid));\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 7af7eaa4139..61fd55d62e2 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -211,7 +211,7 @@ static void write_tag_body(int fd, const struct object_id *oid)\n \tstruct strbuf payload = STRBUF_INIT;\n \tstruct strbuf signature = STRBUF_INIT;\n \n-\torig = buf = read_object_file(oid, &type, &size);\n+\torig = buf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn;\n \tif (parse_signature(buf, size, &payload, &signature)) {\n@@ -362,7 +362,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)\n \t\tstrbuf_addstr(sb, \"object of unknown type\");\n \t\tbreak;\n \tcase OBJ_COMMIT:\n-\t\tif ((buf = read_object_file(oid, &type, &size))) {\n+\t\tif ((buf = repo_read_object_file(the_repository, oid, &type, &size))) {\n \t\t\tsubject_len = find_commit_subject(buf, &subject_start);\n \t\t\tstrbuf_insert(sb, sb->len, subject_start, subject_len);\n \t\t} else {\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex b9e258a553f..9cbc295e193 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -11,7 +11,7 @@ static char *create_temp_file(struct object_id *oid)\n \tunsigned long size;\n \tint fd;\n \n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(oid));\n \ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 1908dcfcffb..2e0ca419190 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -444,7 +444,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \t\tdelta_data = get_data(delta_size);\n \t\tif (!delta_data)\n \t\t\treturn;\n-\t\tif (has_object_file(&base_oid))\n+\t\tif (repo_has_object_file(the_repository, &base_oid))\n \t\t\t; /* Ok we have this one */\n \t\telse if (resolve_against_held(nr, &base_oid,\n \t\t\t\t\t      delta_data, delta_size))\n@@ -510,7 +510,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \tif (resolve_against_held(nr, &base_oid, delta_data, delta_size))\n \t\treturn;\n \n-\tbase = read_object_file(&base_oid, &type, &base_size);\n+\tbase = repo_read_object_file(the_repository, &base_oid, &type,\n+\t\t\t\t     &base_size);\n \tif (!base) {\n \t\terror(\"failed to read delta-pack base object %s\",\n \t\t      oid_to_hex(&base_oid));\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex d64cd5c52d0..556a34ba7d4 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -126,7 +126,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id\n \tint i;\n \n \t/* The object may already exist in the repository */\n-\tif (has_object_file(oid))\n+\tif (repo_has_object_file(the_repository, oid))\n \t\treturn 1;\n \n \t/* Might want to keep the list sorted */\ndiff --git a/bundle.c b/bundle.c\nindex 99d7de97f6c..bce0c7f99e8 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -294,7 +294,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)\n \tif (revs->max_age == -1 && revs->min_age == -1)\n \t\tgoto out;\n \n-\tbuf = read_object_file(&tag->oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &tag->oid, &type, &size);\n \tif (!buf)\n \t\tgoto out;\n \tline = memmem(buf, size, \"\\ntagger \", 8);\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 9d46ecef091..d71b9befd9a 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -231,7 +231,7 @@ int cache_tree_fully_valid(struct cache_tree *it)\n \tint i;\n \tif (!it)\n \t\treturn 0;\n-\tif (it->entry_count < 0 || !has_object_file(&it->oid))\n+\tif (it->entry_count < 0 || !repo_has_object_file(the_repository, &it->oid))\n \t\treturn 0;\n \tfor (i = 0; i < it->subtree_nr; i++) {\n \t\tif (!cache_tree_fully_valid(it->down[i]->cache_tree))\n@@ -282,7 +282,7 @@ static int update_one(struct cache_tree *it,\n \t\t}\n \t}\n \n-\tif (0 <= it->entry_count && has_object_file(&it->oid))\n+\tif (0 <= it->entry_count && repo_has_object_file(the_repository, &it->oid))\n \t\treturn it->entry_count;\n \n \t/*\n@@ -388,7 +388,7 @@ static int update_one(struct cache_tree *it,\n \t\tce_missing_ok = mode == S_IFGITLINK || missing_ok ||\n \t\t\t!must_check_existence(ce);\n \t\tif (is_null_oid(oid) ||\n-\t\t    (!ce_missing_ok && !has_object_file(oid))) {\n+\t\t    (!ce_missing_ok && !repo_has_object_file(the_repository, oid))) {\n \t\t\tstrbuf_release(&buffer);\n \t\t\tif (expected_missing)\n \t\t\t\treturn -1;\n@@ -436,7 +436,7 @@ static int update_one(struct cache_tree *it,\n \t\tstruct object_id oid;\n \t\thash_object_file(the_hash_algo, buffer.buf, buffer.len,\n \t\t\t\t OBJ_TREE, &oid);\n-\t\tif (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (repo_has_object_file_with_flags(the_repository, &oid, OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\toidcpy(&it->oid, &oid);\n \t\telse\n \t\t\tto_invalidate = 1;\ndiff --git a/combine-diff.c b/combine-diff.c\nindex e917362faf7..6077d4ec498 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -333,7 +333,7 @@ static char *grab_blob(struct repository *r,\n \t\t*size = fill_textconv(r, textconv, df, &blob);\n \t\tfree_filespec(df);\n \t} else {\n-\t\tblob = read_object_file(oid, &type, size);\n+\t\tblob = repo_read_object_file(the_repository, oid, &type, size);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"object '%s' is not a blob!\", oid_to_hex(oid));\n \t}\ndiff --git a/commit.c b/commit.c\nindex 127ec79b2d3..cfd14f7d975 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -1215,7 +1215,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header\n \tdesc = merge_remote_util(parent);\n \tif (!desc || !desc->obj)\n \t\treturn;\n-\tbuf = read_object_file(&desc->obj->oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &desc->obj->oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf || type != OBJ_TAG)\n \t\tgoto free_return;\n \tif (!parse_signature(buf, size, &payload, &signature))\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 3c0bd8781e7..fa159aba5b5 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -77,6 +77,16 @@\n |\n - diff_setup\n + repo_diff_setup\n+// object-store.h\n+|\n+- read_object_file\n++ repo_read_object_file\n+|\n+- has_object_file\n++ repo_has_object_file\n+|\n+- has_object_file_with_flags\n++ repo_has_object_file_with_flags\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 00461ee86b3..69e9694111e 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,17 +5,7 @@\n @@\n @@\n (\n-// object-store.h\n-- read_object_file\n-+ repo_read_object_file\n-|\n-- has_object_file\n-+ repo_has_object_file\n-|\n-- has_object_file_with_flags\n-+ repo_has_object_file_with_flags\n // pretty.h\n-|\n - format_commit_message\n + repo_format_commit_message\n // packfile.h\ndiff --git a/dir.c b/dir.c\nindex d5bb199f4b4..b06a100514d 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -268,7 +268,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,\n \t*size_out = 0;\n \t*data_out = NULL;\n \n-\tdata = read_object_file(oid, &type, &sz);\n+\tdata = repo_read_object_file(the_repository, oid, &type, &sz);\n \tif (!data || type != OBJ_BLOB) {\n \t\tfree(data);\n \t\treturn -1;\ndiff --git a/entry.c b/entry.c\nindex c97cfa833bb..8c21f98b9e8 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -87,7 +87,8 @@ void *read_blob_entry(const struct cache_entry *ce, size_t *size)\n {\n \tenum object_type type;\n \tunsigned long ul;\n-\tvoid *blob_data = read_object_file(&ce->oid, &type, &ul);\n+\tvoid *blob_data = repo_read_object_file(the_repository, &ce->oid,\n+\t\t\t\t\t\t&type, &ul);\n \n \t*size = ul;\n \tif (blob_data) {\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 4ddabb4ec76..12675052f97 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -764,9 +764,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,\n \t\tif (!commit) {\n \t\t\tstruct object *o;\n \n-\t\t\tif (!has_object_file_with_flags(&ref->old_oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK |\n-\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\t\tif (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,\n+\t\t\t\t\t\t\t     OBJECT_INFO_QUICK |\n+\t\t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\t\tcontinue;\n \t\t\to = parse_object(the_repository, &ref->old_oid);\n \t\t\tif (!o || o->type != OBJ_COMMIT)\n@@ -1965,7 +1965,7 @@ static void update_shallow(struct fetch_pack_args *args,\n \t\tstruct oid_array extra = OID_ARRAY_INIT;\n \t\tstruct object_id *oid = si->shallow->oid;\n \t\tfor (i = 0; i < si->shallow->nr; i++)\n-\t\t\tif (has_object_file(&oid[i]))\n+\t\t\tif (repo_has_object_file(the_repository, &oid[i]))\n \t\t\t\toid_array_append(&extra, &oid[i]);\n \t\tif (extra.nr) {\n \t\t\tsetup_alternate_shallow(&shallow_lock,\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex 29a1afa2485..5aab1d06619 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -518,7 +518,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)\n \t\tstruct object_id *oid = origins.items[i].util;\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tchar *buf = read_object_file(oid, &type, &size);\n+\t\tchar *buf = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t  &size);\n \t\tchar *origbuf = buf;\n \t\tunsigned long len = size;\n \t\tstruct signature_check sigc = { NULL };\ndiff --git a/fsck.c b/fsck.c\nindex 0d752d57717..adbe8bf59e7 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1334,7 +1334,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,\n \t\tif (oidset_contains(blobs_done, oid))\n \t\t\tcontinue;\n \n-\t\tbuf = read_object_file(oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \t\tif (!buf) {\n \t\t\tif (is_promisor_object(oid))\n \t\t\t\tcontinue;\ndiff --git a/http-push.c b/http-push.c\nindex e149daeff3d..8c852ff646b 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -363,7 +363,8 @@ static void start_put(struct transfer_request *request)\n \tssize_t size;\n \tgit_zstream stream;\n \n-\tunpacked = read_object_file(&request->obj->oid, &type, &len);\n+\tunpacked = repo_read_object_file(the_repository, &request->obj->oid,\n+\t\t\t\t\t &type, &len);\n \thdrlen = format_object_header(hdr, sizeof(hdr), type, len);\n \n \t/* Set it up */\n@@ -1428,7 +1429,7 @@ static void one_remote_ref(const char *refname)\n \t * Fetch a copy of the object if it doesn't exist locally - it\n \t * may be required for updating server info later.\n \t */\n-\tif (repo->can_update_info_refs && !has_object_file(&ref->old_oid)) {\n+\tif (repo->can_update_info_refs && !repo_has_object_file(the_repository, &ref->old_oid)) {\n \t\tobj = lookup_unknown_object(the_repository, &ref->old_oid);\n \t\tfprintf(stderr,\t\"  fetch %s for %s\\n\",\n \t\t\toid_to_hex(&ref->old_oid), refname);\n@@ -1629,14 +1630,14 @@ static int delete_remote_branch(const char *pattern, int force)\n \t\t\treturn error(\"Remote HEAD symrefs too deep\");\n \t\tif (is_null_oid(&head_oid))\n \t\t\treturn error(\"Unable to resolve remote HEAD\");\n-\t\tif (!has_object_file(&head_oid))\n+\t\tif (!repo_has_object_file(the_repository, &head_oid))\n \t\t\treturn error(\"Remote HEAD resolves to object %s\\nwhich does not exist locally, perhaps you need to fetch?\", oid_to_hex(&head_oid));\n \n \t\t/* Remote branch must resolve to a known object */\n \t\tif (is_null_oid(&remote_ref->old_oid))\n \t\t\treturn error(\"Unable to resolve remote branch %s\",\n \t\t\t\t     remote_ref->name);\n-\t\tif (!has_object_file(&remote_ref->old_oid))\n+\t\tif (!repo_has_object_file(the_repository, &remote_ref->old_oid))\n \t\t\treturn 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));\n \n \t\t/* Remote branch must be an ancestor of remote HEAD */\n@@ -1856,7 +1857,7 @@ int cmd_main(int argc, const char **argv)\n \t\tif (!force_all &&\n \t\t    !is_null_oid(&ref->old_oid) &&\n \t\t    !ref->force) {\n-\t\t\tif (!has_object_file(&ref->old_oid) ||\n+\t\t\tif (!repo_has_object_file(the_repository, &ref->old_oid) ||\n \t\t\t    !ref_newer(&ref->peer_ref->new_oid,\n \t\t\t\t       &ref->old_oid)) {\n \t\t\t\t/*\ndiff --git a/http-walker.c b/http-walker.c\nindex c3e902c40e6..4588e6a340a 100644\n--- a/http-walker.c\n+++ b/http-walker.c\n@@ -136,7 +136,7 @@ static int fill_active_slot(struct walker *walker)\n \tlist_for_each_safe(pos, tmp, head) {\n \t\tobj_req = list_entry(pos, struct object_request, node);\n \t\tif (obj_req->state == WAITING) {\n-\t\t\tif (has_object_file(&obj_req->oid))\n+\t\t\tif (repo_has_object_file(the_repository, &obj_req->oid))\n \t\t\t\tobj_req->state = COMPLETE;\n \t\t\telse {\n \t\t\t\tstart_object_request(walker, obj_req);\n@@ -493,7 +493,7 @@ static int fetch_object(struct walker *walker, unsigned char *hash)\n \tif (!obj_req)\n \t\treturn error(\"Couldn't find request for %s in the queue\", hex);\n \n-\tif (has_object_file(&obj_req->oid)) {\n+\tif (repo_has_object_file(the_repository, &obj_req->oid)) {\n \t\tif (obj_req->req)\n \t\t\tabort_http_object_request(obj_req->req);\n \t\tabort_object_request(obj_req);\ndiff --git a/list-objects.c b/list-objects.c\nindex d75132cfd73..6e6e7ce61ea 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -65,7 +65,7 @@ static void process_blob(struct traversal_context *ctx,\n \t * of missing objects.\n \t */\n \tif (ctx->revs->exclude_promisor_objects &&\n-\t    !has_object_file(&obj->oid) &&\n+\t    !repo_has_object_file(the_repository, &obj->oid) &&\n \t    is_promisor_object(&obj->oid))\n \t\treturn;\n \ndiff --git a/mailmap.c b/mailmap.c\nindex ed8289aea58..f68f664bb1b 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -216,7 +216,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)\n \tif (repo_get_oid(the_repository, name, &oid) < 0)\n \t\treturn 0;\n \n-\tbuf = read_object_file(&oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &oid, &type, &size);\n \tif (!buf)\n \t\treturn error(\"unable to read mailmap object at %s\", name);\n \tif (type != OBJ_BLOB)\ndiff --git a/match-trees.c b/match-trees.c\nindex c38dcbac7c6..5877fc64a8f 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -56,7 +56,7 @@ static void *fill_tree_desc_strict(struct tree_desc *desc,\n \tenum object_type type;\n \tunsigned long size;\n \n-\tbuffer = read_object_file(hash, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, hash, &type, &size);\n \tif (!buffer)\n \t\tdie(\"unable to read tree (%s)\", oid_to_hex(hash));\n \tif (type != OBJ_TREE)\n@@ -189,7 +189,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,\n \tif (*subpath)\n \t\tsubpath++;\n \n-\tbuf = read_object_file(oid1, &type, &sz);\n+\tbuf = repo_read_object_file(the_repository, oid1, &type, &sz);\n \tif (!buf)\n \t\tdie(\"cannot read tree %s\", oid_to_hex(oid1));\n \tinit_tree_desc(&desc, buf, sz);\ndiff --git a/merge-blobs.c b/merge-blobs.c\nindex aedcab81138..5632ff6abb6 100644\n--- a/merge-blobs.c\n+++ b/merge-blobs.c\n@@ -12,7 +12,8 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)\n \tunsigned long size;\n \tenum object_type type;\n \n-\tbuf = read_object_file(&obj->object.oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, &obj->object.oid, &type,\n+\t\t\t\t    &size);\n \tif (!buf)\n \t\treturn -1;\n \tif (type != OBJ_BLOB) {\n@@ -78,7 +79,8 @@ void *merge_blobs(struct index_state *istate, const char *path,\n \t\t\treturn NULL;\n \t\tif (!our)\n \t\t\tour = their;\n-\t\treturn read_object_file(&our->object.oid, &type, size);\n+\t\treturn repo_read_object_file(the_repository, &our->object.oid,\n+\t\t\t\t\t     &type, size);\n \t}\n \n \tif (fill_mmfile_blob(&f1, our) < 0)\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 186e26d90a0..607e2c263f1 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -3506,7 +3506,7 @@ static int read_oid_strbuf(struct merge_options *opt,\n \tvoid *buf;\n \tenum object_type type;\n \tunsigned long size;\n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn err(opt, _(\"cannot read object %s\"), oid_to_hex(oid));\n \tif (type != OBJ_BLOB) {\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 6eeb4844f38..9c80b7aa3a7 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -951,7 +951,8 @@ static int update_file_flags(struct merge_options *opt,\n \t\t\tgoto update_index;\n \t\t}\n \n-\t\tbuf = read_object_file(&contents->oid, &type, &size);\n+\t\tbuf = repo_read_object_file(the_repository, &contents->oid,\n+\t\t\t\t\t    &type, &size);\n \t\tif (!buf) {\n \t\t\tret = err(opt, _(\"cannot read object %s '%s'\"),\n \t\t\t\t  oid_to_hex(&contents->oid), path);\n@@ -3021,7 +3022,7 @@ static int read_oid_strbuf(struct merge_options *opt,\n \tvoid *buf;\n \tenum object_type type;\n \tunsigned long size;\n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn err(opt, _(\"cannot read object %s\"), oid_to_hex(oid));\n \tif (type != OBJ_BLOB) {\ndiff --git a/notes-cache.c b/notes-cache.c\nindex 9dfd251a815..38466091360 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -81,7 +81,7 @@ char *notes_cache_get(struct notes_cache *c, struct object_id *key_oid,\n \tvalue_oid = get_note(&c->tree, key_oid);\n \tif (!value_oid)\n \t\treturn NULL;\n-\tvalue = read_object_file(value_oid, &type, &size);\n+\tvalue = repo_read_object_file(the_repository, value_oid, &type, &size);\n \n \t*outsize = size;\n \treturn value;\ndiff --git a/notes-merge.c b/notes-merge.c\nindex d26c826963e..571ecf15c7e 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -327,7 +327,7 @@ static void write_note_to_worktree(const struct object_id *obj,\n {\n \tenum object_type type;\n \tunsigned long size;\n-\tvoid *buf = read_object_file(note, &type, &size);\n+\tvoid *buf = repo_read_object_file(the_repository, note, &type, &size);\n \n \tif (!buf)\n \t\tdie(\"cannot read note %s for object %s\",\ndiff --git a/notes.c b/notes.c\nindex 427cfdac294..d40affc0f2f 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -788,7 +788,7 @@ static int prune_notes_helper(const struct object_id *object_oid,\n \tstruct note_delete_list **l = (struct note_delete_list **) cb_data;\n \tstruct note_delete_list *n;\n \n-\tif (has_object_file(object_oid))\n+\tif (repo_has_object_file(the_repository, object_oid))\n \t\treturn 0; /* nothing to do for this note */\n \n \t/* failed to find object => prune this note */\n@@ -809,13 +809,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,\n \n \t/* read in both note blob objects */\n \tif (!is_null_oid(new_oid))\n-\t\tnew_msg = read_object_file(new_oid, &new_type, &new_len);\n+\t\tnew_msg = repo_read_object_file(the_repository, new_oid,\n+\t\t\t\t\t\t&new_type, &new_len);\n \tif (!new_msg || !new_len || new_type != OBJ_BLOB) {\n \t\tfree(new_msg);\n \t\treturn 0;\n \t}\n \tif (!is_null_oid(cur_oid))\n-\t\tcur_msg = read_object_file(cur_oid, &cur_type, &cur_len);\n+\t\tcur_msg = repo_read_object_file(the_repository, cur_oid,\n+\t\t\t\t\t\t&cur_type, &cur_len);\n \tif (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {\n \t\tfree(cur_msg);\n \t\tfree(new_msg);\n@@ -871,7 +873,7 @@ static int string_list_add_note_lines(struct string_list *list,\n \t\treturn 0;\n \n \t/* read_sha1_file NUL-terminates */\n-\tdata = read_object_file(oid, &t, &len);\n+\tdata = repo_read_object_file(the_repository, oid, &t, &len);\n \tif (t != OBJ_BLOB || !data || !len) {\n \t\tfree(data);\n \t\treturn t != OBJ_BLOB || !data;\n@@ -1266,7 +1268,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid\n \tif (!oid)\n \t\treturn;\n \n-\tif (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {\n+\tif (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {\n \t\tfree(msg);\n \t\treturn;\n \t}\ndiff --git a/object-file.c b/object-file.c\nindex 8fab8dbe80b..5944f51a3e0 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -1680,7 +1680,7 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,\n \tstruct cached_object *co;\n \n \thash_object_file(the_hash_algo, buf, len, type, oid);\n-\tif (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||\n+\tif (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||\n \t    find_cached_object(oid))\n \t\treturn 0;\n \tALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);\ndiff --git a/object-store.h b/object-store.h\nindex 82201ec3e7b..62a683af4d6 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -245,9 +245,6 @@ void *repo_read_object_file(struct repository *r,\n \t\t\t    const struct object_id *oid,\n \t\t\t    enum object_type *type,\n \t\t\t    unsigned long *size);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)\n-#endif\n \n /* Read and unpack an object file into memory, write memory to an object file */\n int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);\n@@ -387,10 +384,6 @@ int has_object(struct repository *r, const struct object_id *oid,\n int repo_has_object_file(struct repository *r, const struct object_id *oid);\n int repo_has_object_file_with_flags(struct repository *r,\n \t\t\t\t    const struct object_id *oid, int flags);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define has_object_file(oid) repo_has_object_file(the_repository, oid)\n-#define has_object_file_with_flags(oid, flags) repo_has_object_file_with_flags(the_repository, oid, flags)\n-#endif\n \n /*\n  * Return true iff an alternate object database has a loose object\ndiff --git a/read-cache.c b/read-cache.c\nindex c1d47b9fc83..4518a40ac06 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -265,7 +265,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)\n \tif (strbuf_readlink(&sb, ce->name, expected_size))\n \t\treturn -1;\n \n-\tbuffer = read_object_file(&ce->oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);\n \tif (buffer) {\n \t\tif (size == sb.len)\n \t\t\tmatch = memcmp(buffer, sb.buf, size);\n@@ -3555,7 +3555,8 @@ void *read_blob_data_from_index(struct index_state *istate,\n \t}\n \tif (pos < 0)\n \t\treturn NULL;\n-\tdata = read_object_file(&istate->cache[pos]->oid, &type, &sz);\n+\tdata = repo_read_object_file(the_repository, &istate->cache[pos]->oid,\n+\t\t\t\t     &type, &sz);\n \tif (!data || type != OBJ_BLOB) {\n \t\tfree(data);\n \t\treturn NULL;\ndiff --git a/reflog.c b/reflog.c\nindex 6e8362e7a2f..510663e1e51 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -28,7 +28,8 @@ static int tree_is_complete(const struct object_id *oid)\n \tif (!tree->buffer) {\n \t\tenum object_type type;\n \t\tunsigned long size;\n-\t\tvoid *data = read_object_file(oid, &type, &size);\n+\t\tvoid *data = repo_read_object_file(the_repository, oid, &type,\n+\t\t\t\t\t\t   &size);\n \t\tif (!data) {\n \t\t\ttree->object.flags |= INCOMPLETE;\n \t\t\treturn 0;\n@@ -39,7 +40,7 @@ static int tree_is_complete(const struct object_id *oid)\n \tinit_tree_desc(&desc, tree->buffer, tree->size);\n \tcomplete = 1;\n \twhile (tree_entry(&desc, &entry)) {\n-\t\tif (!has_object_file(&entry.oid) ||\n+\t\tif (!repo_has_object_file(the_repository, &entry.oid) ||\n \t\t    (S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {\n \t\t\ttree->object.flags |= INCOMPLETE;\n \t\t\tcomplete = 0;\ndiff --git a/remote.c b/remote.c\nindex 37cb5213795..9219ebb8962 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1761,7 +1761,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,\n \t\tif (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {\n \t\t\tif (starts_with(ref->name, \"refs/tags/\"))\n \t\t\t\treject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;\n-\t\t\telse if (!has_object_file(&ref->old_oid))\n+\t\t\telse if (!repo_has_object_file(the_repository, &ref->old_oid))\n \t\t\t\treject_reason = REF_STATUS_REJECT_FETCH_FIRST;\n \t\t\telse if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) ||\n \t\t\t\t !lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))\ndiff --git a/rerere.c b/rerere.c\nindex a67abaab077..0ec546b744f 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -967,8 +967,9 @@ static int handle_cache(struct index_state *istate,\n \t\t\tbreak;\n \t\ti = ce_stage(ce) - 1;\n \t\tif (!mmfile[i].ptr) {\n-\t\t\tmmfile[i].ptr = read_object_file(&ce->oid, &type,\n-\t\t\t\t\t\t\t &size);\n+\t\t\tmmfile[i].ptr = repo_read_object_file(the_repository,\n+\t\t\t\t\t\t\t      &ce->oid, &type,\n+\t\t\t\t\t\t\t      &size);\n \t\t\tmmfile[i].size = size;\n \t\t}\n \t}\ndiff --git a/send-pack.c b/send-pack.c\nindex 423a5cfe22d..2cb313a5023 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -43,9 +43,9 @@ int option_parse_push_signed(const struct option *opt,\n static void feed_object(const struct object_id *oid, FILE *fh, int negative)\n {\n \tif (negative &&\n-\t    !has_object_file_with_flags(oid,\n-\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT |\n-\t\t\t\t\tOBJECT_INFO_QUICK))\n+\t    !repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT |\n+\t\t\t\t\t     OBJECT_INFO_QUICK))\n \t\treturn;\n \n \tif (negative)\ndiff --git a/shallow.c b/shallow.c\nindex 138bcfe009c..ce21f66e5e1 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -303,7 +303,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)\n \tif (graft->nr_parent != -1)\n \t\treturn 0;\n \tif (data->flags & QUICK) {\n-\t\tif (!has_object_file(&graft->oid))\n+\t\tif (!repo_has_object_file(the_repository, &graft->oid))\n \t\t\treturn 0;\n \t} else if (data->flags & SEEN_ONLY) {\n \t\tstruct commit *c = lookup_commit(the_repository, &graft->oid);\n@@ -468,7 +468,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)\n \tALLOC_ARRAY(info->ours, sa->nr);\n \tALLOC_ARRAY(info->theirs, sa->nr);\n \tfor (i = 0; i < sa->nr; i++) {\n-\t\tif (has_object_file(sa->oid + i)) {\n+\t\tif (repo_has_object_file(the_repository, sa->oid + i)) {\n \t\t\tstruct commit_graft *graft;\n \t\t\tgraft = lookup_commit_graft(the_repository,\n \t\t\t\t\t\t    &sa->oid[i]);\n@@ -496,7 +496,7 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)\n \tfor (i = dst = 0; i < info->nr_theirs; i++) {\n \t\tif (i != dst)\n \t\t\tinfo->theirs[dst] = info->theirs[i];\n-\t\tif (has_object_file(oid + info->theirs[i]))\n+\t\tif (repo_has_object_file(the_repository, oid + info->theirs[i]))\n \t\t\tdst++;\n \t}\n \tinfo->nr_theirs = dst;\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 57972c3e131..d0111e99937 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -590,7 +590,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \tif (submodule)\n \t\tgoto out;\n \n-\tconfig = read_object_file(&oid, &type, &config_size);\n+\tconfig = repo_read_object_file(the_repository, &oid, &type,\n+\t\t\t\t       &config_size);\n \tif (!config || type != OBJ_BLOB)\n \t\tgoto out;\n \ndiff --git a/tag.c b/tag.c\nindex 85c348ad824..911cd3178ca 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -55,7 +55,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,\n \t\t\t\trepo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),\n \t\t\t\ttype_name(type));\n \n-\tbuf = read_object_file(oid, &type, &size);\n+\tbuf = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!buf)\n \t\treturn error(\"%s: unable to read file.\",\n \t\t\t\tname_to_report ?\n@@ -217,7 +217,8 @@ int parse_tag(struct tag *item)\n \n \tif (item->object.parsed)\n \t\treturn 0;\n-\tdata = read_object_file(&item->object.oid, &type, &size);\n+\tdata = repo_read_object_file(the_repository, &item->object.oid, &type,\n+\t\t\t\t     &size);\n \tif (!data)\n \t\treturn error(\"Could not read %s\",\n \t\t\t     oid_to_hex(&item->object.oid));\ndiff --git a/tree.c b/tree.c\nindex e33f4009ac9..955b53f6a57 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -130,7 +130,8 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)\n \n \tif (item->object.parsed)\n \t\treturn 0;\n-\tbuffer = read_object_file(&item->object.oid, &type, &size);\n+\tbuffer = repo_read_object_file(the_repository, &item->object.oid,\n+\t\t\t\t       &type, &size);\n \tif (!buffer)\n \t\treturn quiet_on_missing ? -1 :\n \t\t\terror(\"Could not read %s\",\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 41b9362cf1b..54be6a61910 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -500,8 +500,8 @@ static int got_oid(struct upload_pack_data *data,\n {\n \tif (get_oid_hex(hex, oid))\n \t\tdie(\"git upload-pack: expected SHA1 object, got '%s'\", hex);\n-\tif (!has_object_file_with_flags(oid,\n-\t\t\t\t\tOBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\tif (!repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t     OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\treturn -1;\n \treturn do_got_oid(data, oid);\n }\n@@ -1601,8 +1601,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common\n \tfor (i = 0; i < data->haves.nr; i++) {\n \t\tconst struct object_id *oid = &data->haves.oid[i];\n \n-\t\tif (!has_object_file_with_flags(oid,\n-\t\t\t\t\t\tOBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n+\t\tif (!repo_has_object_file_with_flags(the_repository, oid,\n+\t\t\t\t\t\t     OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\tcontinue;\n \n \t\toid_array_append(common, oid);\ndiff --git a/walker.c b/walker.c\nindex 5275070de76..e86f85e5283 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -146,7 +146,7 @@ static int process(struct walker *walker, struct object *obj)\n \t\treturn 0;\n \tobj->flags |= SEEN;\n \n-\tif (has_object_file(&obj->oid)) {\n+\tif (repo_has_object_file(the_repository, &obj->oid)) {\n \t\t/* We already have it, so we should scan it now. */\n \t\tobj->flags |= TO_SCAN;\n \t}\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 5baf6ceb947..0617fadbfbb 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -184,7 +184,7 @@ void read_mmblob(mmfile_t *ptr, const struct object_id *oid)\n \t\treturn;\n \t}\n \n-\tptr->ptr = read_object_file(oid, &type, &size);\n+\tptr->ptr = repo_read_object_file(the_repository, oid, &type, &size);\n \tif (!ptr->ptr || type != OBJ_BLOB)\n \t\tdie(\"unable to read blob object %s\", oid_to_hex(oid));\n \tptr->size = size;\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474292","messageId":"patch-v2-12.17-8336b0321a8-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 12/17] cocci: apply the \"promisor-remote.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:53Z","receivedAt":"2023-03-28T14:00:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"promisor-remote.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/cat-file.c                              |  2 +-\n builtin/fetch.c                                 |  4 ++--\n builtin/gc.c                                    |  2 +-\n builtin/index-pack.c                            |  2 +-\n builtin/pack-objects.c                          |  2 +-\n builtin/repack.c                                |  2 +-\n cache-tree.c                                    |  4 ++--\n connected.c                                     |  4 ++--\n contrib/coccinelle/the_repository.cocci         | 10 ++++++++++\n contrib/coccinelle/the_repository.pending.cocci | 10 ----------\n diff.c                                          |  2 +-\n diffcore-break.c                                |  2 +-\n diffcore-rename.c                               |  4 ++--\n list-objects-filter-options.c                   |  7 ++++---\n merge-ort.c                                     |  2 +-\n packfile.c                                      |  2 +-\n promisor-remote.h                               | 15 ---------------\n unpack-trees.c                                  |  2 +-\n 18 files changed, 32 insertions(+), 46 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex a7bcb55b40d..44d202aa55b 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -796,7 +796,7 @@ static int batch_objects(struct batch_options *opt)\n \t\tif (!memcmp(&data.info, &empty, sizeof(empty)))\n \t\t\tdata.skip_object_info = 1;\n \n-\t\tif (has_promisor_remote())\n+\t\tif (repo_has_promisor_remote(the_repository))\n \t\t\twarning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n \n \t\tread_replace_refs = 0;\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 0ee5d269768..4198e1c1a84 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2015,7 +2015,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * If no prior partial clone/fetch and the current fetch DID NOT\n \t * request a partial-fetch, do a normal fetch.\n \t */\n-\tif (!has_promisor_remote() && !filter_options.choice)\n+\tif (!repo_has_promisor_remote(the_repository) && !filter_options.choice)\n \t\treturn;\n \n \t/*\n@@ -2271,7 +2271,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \t\t\tprintf(\"%s\\n\", oid_to_hex(oid));\n \t\toidset_clear(&acked_commits);\n \t} else if (remote) {\n-\t\tif (filter_options.choice || has_promisor_remote())\n+\t\tif (filter_options.choice || repo_has_promisor_remote(the_repository))\n \t\t\tfetch_one_setup_partial(remote);\n \t\tresult = fetch_one(remote, argc, argv, prune_tags_ok, stdin_refspecs);\n \t} else {\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex a61d62bcf7b..a204b301ac4 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -700,7 +700,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \t\t\tstrvec_push(&prune, prune_expire);\n \t\t\tif (quiet)\n \t\t\t\tstrvec_push(&prune, \"--no-progress\");\n-\t\t\tif (has_promisor_remote())\n+\t\t\tif (repo_has_promisor_remote(the_repository))\n \t\t\t\tstrvec_push(&prune,\n \t\t\t\t\t    \"--exclude-promisor-objects\");\n \t\t\tprune_cmd.git_cmd = 1;\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex e823a73b357..6bd95f54d6e 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1393,7 +1393,7 @@ static void fix_unresolved_deltas(struct hashfile *f)\n \t\tsorted_by_pos[i] = &ref_deltas[i];\n \tQSORT(sorted_by_pos, nr_ref_deltas, delta_pos_compare);\n \n-\tif (has_promisor_remote()) {\n+\tif (repo_has_promisor_remote(the_repository)) {\n \t\t/*\n \t\t * Prefetch the delta bases.\n \t\t */\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 068e6326c1d..bcf10d543f1 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -2080,7 +2080,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)\n \n \tif (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,\n \t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {\n-\t\tif (has_promisor_remote()) {\n+\t\tif (repo_has_promisor_remote(the_repository)) {\n \t\t\tprefetch_to_pack(object_index);\n \t\t\tif (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,\n \t\t\t\t\t\t     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 87f73c8923a..ab4c55b50fc 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -903,7 +903,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\tstrvec_push(&cmd.args, \"--reflog\");\n \t\tstrvec_push(&cmd.args, \"--indexed-objects\");\n \t}\n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\tstrvec_push(&cmd.args, \"--exclude-promisor-objects\");\n \tif (!write_midx) {\n \t\tif (write_bitmaps > 0)\ndiff --git a/cache-tree.c b/cache-tree.c\nindex d71b9befd9a..12206eeaa3c 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -242,7 +242,7 @@ int cache_tree_fully_valid(struct cache_tree *it)\n \n static int must_check_existence(const struct cache_entry *ce)\n {\n-\treturn !(has_promisor_remote() && ce_skip_worktree(ce));\n+\treturn !(repo_has_promisor_remote(the_repository) && ce_skip_worktree(ce));\n }\n \n static int update_one(struct cache_tree *it,\n@@ -472,7 +472,7 @@ int cache_tree_update(struct index_state *istate, int flags)\n \tif (!istate->cache_tree)\n \t\tistate->cache_tree = cache_tree();\n \n-\tif (!(flags & WRITE_TREE_MISSING_OK) && has_promisor_remote())\n+\tif (!(flags & WRITE_TREE_MISSING_OK) && repo_has_promisor_remote(the_repository))\n \t\tprefetch_cache_entries(istate, must_check_existence);\n \n \ttrace_performance_enter();\ndiff --git a/connected.c b/connected.c\nindex 39cb1e1074d..0b7be81237d 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -55,7 +55,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n \t\tstrbuf_release(&idx_file);\n \t}\n \n-\tif (has_promisor_remote()) {\n+\tif (repo_has_promisor_remote(the_repository)) {\n \t\t/*\n \t\t * For partial clones, we don't want to have to do a regular\n \t\t * connectivity check because we have to enumerate and exclude\n@@ -98,7 +98,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n \tstrvec_push(&rev_list.args,\"rev-list\");\n \tstrvec_push(&rev_list.args, \"--objects\");\n \tstrvec_push(&rev_list.args, \"--stdin\");\n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\tstrvec_push(&rev_list.args, \"--exclude-promisor-objects\");\n \tif (!opt->is_deepening_fetch) {\n \t\tstrvec_push(&rev_list.args, \"--not\");\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex a325361f961..d5b644a8687 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -95,6 +95,16 @@\n |\n - approximate_object_count\n + repo_approximate_object_count\n+// promisor-remote.h\n+|\n+- promisor_remote_reinit\n++ repo_promisor_remote_reinit\n+|\n+- promisor_remote_find\n++ repo_promisor_remote_find\n+|\n+- has_promisor_remote\n++ repo_has_promisor_remote\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 9b426e49e66..e17a60198c5 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,17 +5,7 @@\n @@\n @@\n (\n-// promisor-remote.h\n-- promisor_remote_reinit\n-+ repo_promisor_remote_reinit\n-|\n-- promisor_remote_find\n-+ repo_promisor_remote_find\n-|\n-- has_promisor_remote\n-+ repo_has_promisor_remote\n // refs.h\n-|\n - dwim_ref\n + repo_dwim_ref\n // rerere.h\ndiff --git a/diff.c b/diff.c\nindex 81f115d32c9..b0a810fbee3 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -6885,7 +6885,7 @@ void diffcore_std(struct diff_options *options)\n \t * If no prefetching occurs, diffcore_rename() will prefetch if it\n \t * decides that it needs inexact rename detection.\n \t */\n-\tif (options->repo == the_repository && has_promisor_remote() &&\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&\n \t    (options->output_format & output_formats_to_prefetch ||\n \t     options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))\n \t\tdiff_queued_diff_prefetch(options->repo);\ndiff --git a/diffcore-break.c b/diffcore-break.c\nindex 0d4a14964d0..5462420bbbe 100644\n--- a/diffcore-break.c\n+++ b/diffcore-break.c\n@@ -65,7 +65,7 @@ static int should_break(struct repository *r,\n \t    oideq(&src->oid, &dst->oid))\n \t\treturn 0; /* they are the same */\n \n-\tif (r == the_repository && has_promisor_remote()) {\n+\tif (r == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\toptions.missing_object_cb = diff_queued_diff_prefetch;\n \t\toptions.missing_object_data = r;\n \t}\ndiff --git a/diffcore-rename.c b/diffcore-rename.c\nindex 7e9ff96d435..8e2e7a3ad73 100644\n--- a/diffcore-rename.c\n+++ b/diffcore-rename.c\n@@ -986,7 +986,7 @@ static int find_basename_matches(struct diff_options *options,\n \t\t\tstrintmap_set(&dests, base, i);\n \t}\n \n-\tif (options->repo == the_repository && has_promisor_remote()) {\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\tdpf_options.missing_object_cb = basename_prefetch;\n \t\tdpf_options.missing_object_data = &prefetch_options;\n \t}\n@@ -1572,7 +1572,7 @@ void diffcore_rename_extended(struct diff_options *options,\n \n \t/* Finish setting up dpf_options */\n \tprefetch_options.skip_unmodified = skip_unmodified;\n-\tif (options->repo == the_repository && has_promisor_remote()) {\n+\tif (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {\n \t\tdpf_options.missing_object_cb = inexact_prefetch;\n \t\tdpf_options.missing_object_data = &prefetch_options;\n \t}\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex 1d25a5737db..b82ba0a2e5b 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -343,7 +343,7 @@ void partial_clone_register(\n \tchar *filter_name;\n \n \t/* Check if it is already registered */\n-\tif ((promisor_remote = promisor_remote_find(remote))) {\n+\tif ((promisor_remote = repo_promisor_remote_find(the_repository, remote))) {\n \t\tif (promisor_remote->partial_clone_filter)\n \t\t\t/*\n \t\t\t * Remote is already registered and a filter is already\n@@ -371,14 +371,15 @@ void partial_clone_register(\n \tfree(filter_name);\n \n \t/* Make sure the config info are reset */\n-\tpromisor_remote_reinit();\n+\trepo_promisor_remote_reinit(the_repository);\n }\n \n void partial_clone_get_default_filter_spec(\n \tstruct list_objects_filter_options *filter_options,\n \tconst char *remote)\n {\n-\tstruct promisor_remote *promisor = promisor_remote_find(remote);\n+\tstruct promisor_remote *promisor = repo_promisor_remote_find(the_repository,\n+\t\t\t\t\t\t\t\t     remote);\n \tstruct strbuf errbuf = STRBUF_INIT;\n \n \t/*\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 607e2c263f1..dace4073a06 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -4217,7 +4217,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,\n \tstruct string_list_item *e;\n \tstruct oid_array to_fetch = OID_ARRAY_INIT;\n \n-\tif (opt->repo != the_repository || !has_promisor_remote())\n+\tif (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))\n \t\treturn;\n \n \tfor (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {\ndiff --git a/packfile.c b/packfile.c\nindex 2023df1b75b..53fcc0f44c9 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -2275,7 +2275,7 @@ int is_promisor_object(const struct object_id *oid)\n \tstatic int promisor_objects_prepared;\n \n \tif (!promisor_objects_prepared) {\n-\t\tif (has_promisor_remote()) {\n+\t\tif (repo_has_promisor_remote(the_repository)) {\n \t\t\tfor_each_packed_object(add_promisor_object,\n \t\t\t\t\t       &promisor_objects,\n \t\t\t\t\t       FOR_EACH_OBJECT_PROMISOR_ONLY |\ndiff --git a/promisor-remote.h b/promisor-remote.h\nindex df36eb08efc..2cb9eda9ea4 100644\n--- a/promisor-remote.h\n+++ b/promisor-remote.h\n@@ -18,24 +18,9 @@ struct promisor_remote {\n };\n \n void repo_promisor_remote_reinit(struct repository *r);\n-static inline void promisor_remote_reinit(void)\n-{\n-\trepo_promisor_remote_reinit(the_repository);\n-}\n-\n void promisor_remote_clear(struct promisor_remote_config *config);\n-\n struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);\n-static inline struct promisor_remote *promisor_remote_find(const char *remote_name)\n-{\n-\treturn repo_promisor_remote_find(the_repository, remote_name);\n-}\n-\n int repo_has_promisor_remote(struct repository *r);\n-static inline int has_promisor_remote(void)\n-{\n-\treturn repo_has_promisor_remote(the_repository);\n-}\n \n /*\n  * Fetches all requested objects from all promisor remotes, trying them one at\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex a75fb9f05b4..8a284d8a4da 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -459,7 +459,7 @@ static int check_updates(struct unpack_trees_options *o,\n \tif (should_update_submodules())\n \t\tload_gitmodules_file(index, &state);\n \n-\tif (has_promisor_remote())\n+\tif (repo_has_promisor_remote(the_repository))\n \t\t/*\n \t\t * Prefetch the objects that are to be checked out in the loop\n \t\t * below.\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474294","messageId":"patch-v2-13.17-a08d7f8eccf-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 13/17] cocci: apply the \"refs.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:54Z","receivedAt":"2023-03-28T14:00:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"refs.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n archive.c                                       | 5 +++--\n branch.c                                        | 3 ++-\n builtin/checkout.c                              | 6 ++++--\n builtin/fast-export.c                           | 3 ++-\n builtin/log.c                                   | 3 ++-\n builtin/merge.c                                 | 3 ++-\n builtin/reset.c                                 | 3 ++-\n builtin/rev-parse.c                             | 4 +++-\n builtin/show-branch.c                           | 3 ++-\n builtin/stash.c                                 | 3 ++-\n bundle.c                                        | 3 ++-\n commit.c                                        | 3 ++-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n refs.h                                          | 6 ------\n remote.c                                        | 5 +++--\n wt-status.c                                     | 3 ++-\n 17 files changed, 37 insertions(+), 27 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 98de324362a..933e5b39b92 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -458,10 +458,11 @@ static void parse_treeish_arg(const char **argv,\n \t\tconst char *colon = strchrnul(name, ':');\n \t\tint refnamelen = colon - name;\n \n-\t\tif (!dwim_ref(name, refnamelen, &oid, &ref, 0))\n+\t\tif (!repo_dwim_ref(the_repository, name, refnamelen, &oid, &ref, 0))\n \t\t\tdie(_(\"no such ref: %.*s\"), refnamelen, name);\n \t} else {\n-\t\tdwim_ref(name, strlen(name), &oid, &ref, 0);\n+\t\trepo_dwim_ref(the_repository, name, strlen(name), &oid, &ref,\n+\t\t\t      0);\n \t}\n \n \tif (repo_get_oid(the_repository, name, &oid))\ndiff --git a/branch.c b/branch.c\nindex efea29af1ac..179353e7653 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -542,7 +542,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\tdie(_(\"not a valid object name: '%s'\"), start_name);\n \t}\n \n-\tswitch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {\n+\tswitch (repo_dwim_ref(the_repository, start_name, strlen(start_name),\n+\t\t\t      &oid, &real_ref, 0)) {\n \tcase 0:\n \t\t/* Not branching from any existing branch */\n \t\tif (explicit_tracking)\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex ad6d5304b64..fcede4600a5 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -717,7 +717,8 @@ static void setup_branch_path(struct branch_info *branch)\n \t * If this is a ref, resolve it; otherwise, look up the OID for our\n \t * expression.  Failure here is okay.\n \t */\n-\tif (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0))\n+\tif (!repo_dwim_ref(the_repository, branch->name, strlen(branch->name),\n+\t\t\t   &branch->oid, &branch->refname, 0))\n \t\trepo_get_oid_committish(the_repository, branch->name, &branch->oid);\n \n \tstrbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);\n@@ -1438,7 +1439,8 @@ static void die_expecting_a_branch(const struct branch_info *branch_info)\n \tchar *to_free;\n \tint code;\n \n-\tif (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) {\n+\tif (repo_dwim_ref(the_repository, branch_info->name,\n+\t\t\t  strlen(branch_info->name), &oid, &to_free, 0) == 1) {\n \t\tconst char *ref = to_free;\n \n \t\tif (skip_prefix(ref, \"refs/tags/\", &ref))\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 166f51b100a..2f728a44115 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -919,7 +919,8 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)\n \t\tif (e->flags & UNINTERESTING)\n \t\t\tcontinue;\n \n-\t\tif (dwim_ref(e->name, strlen(e->name), &oid, &full_name, 0) != 1)\n+\t\tif (repo_dwim_ref(the_repository, e->name, strlen(e->name),\n+\t\t\t\t  &oid, &full_name, 0) != 1)\n \t\t\tcontinue;\n \n \t\tif (refspecs.nr) {\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 28085547aa8..ba24fa4bfdb 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1218,7 +1218,8 @@ static char *find_branch_name(struct rev_info *rev)\n \t\treturn NULL;\n \tref = rev->cmdline.rev[positive].name;\n \ttip_oid = &rev->cmdline.rev[positive].item->oid;\n-\tif (dwim_ref(ref, strlen(ref), &branch_oid, &full_ref, 0) &&\n+\tif (repo_dwim_ref(the_repository, ref, strlen(ref), &branch_oid,\n+\t\t\t  &full_ref, 0) &&\n \t    skip_prefix(full_ref, \"refs/heads/\", &v) &&\n \t    oideq(tip_oid, &branch_oid))\n \t\tbranch = xstrdup(v);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 559aab1c380..6538a4bae95 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -519,7 +519,8 @@ static void merge_name(const char *remote, struct strbuf *msg)\n \tif (!remote_head)\n \t\tdie(_(\"'%s' does not point to a commit\"), remote);\n \n-\tif (dwim_ref(remote, strlen(remote), &branch_head, &found_ref, 0) > 0) {\n+\tif (repo_dwim_ref(the_repository, remote, strlen(remote), &branch_head,\n+\t\t\t  &found_ref, 0) > 0) {\n \t\tif (starts_with(found_ref, \"refs/heads/\")) {\n \t\t\tstrbuf_addf(msg, \"%s\\t\\tbranch '%s' of .\\n\",\n \t\t\t\t    oid_to_hex(&branch_head), remote);\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex cd4165537c5..c2a390b3a01 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -467,7 +467,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\tchar *ref = NULL;\n \t\t\tint err;\n \n-\t\t\tdwim_ref(rev, strlen(rev), &dummy, &ref, 0);\n+\t\t\trepo_dwim_ref(the_repository, rev, strlen(rev),\n+\t\t\t\t      &dummy, &ref, 0);\n \t\t\tif (ref && !starts_with(ref, \"refs/\"))\n \t\t\t\tFREE_AND_NULL(ref);\n \ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 4969815ca79..5662101a102 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -138,7 +138,9 @@ static void show_rev(int type, const struct object_id *oid, const char *name)\n \t\t\tstruct object_id discard;\n \t\t\tchar *full;\n \n-\t\t\tswitch (dwim_ref(name, strlen(name), &discard, &full, 0)) {\n+\t\t\tswitch (repo_dwim_ref(the_repository, name,\n+\t\t\t\t\t      strlen(name), &discard, &full,\n+\t\t\t\t\t      0)) {\n \t\t\tcase 0:\n \t\t\t\t/*\n \t\t\t\t * Not found -- not a ref.  We could\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 7aea28f5b06..70bc461638c 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -747,7 +747,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tdie(Q_(\"only %d entry can be shown at one time.\",\n \t\t\t       \"only %d entries can be shown at one time.\",\n \t\t\t       MAX_REVS), MAX_REVS);\n-\t\tif (!dwim_ref(*av, strlen(*av), &oid, &ref, 0))\n+\t\tif (!repo_dwim_ref(the_repository, *av, strlen(*av), &oid,\n+\t\t\t\t   &ref, 0))\n \t\t\tdie(_(\"no such ref %s\"), *av);\n \n \t\t/* Has the base been specified? */\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 447c3b678f3..60052ec9d7b 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -212,7 +212,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)\n \tend_of_rev = strchrnul(revision, '@');\n \tstrbuf_add(&symbolic, revision, end_of_rev - revision);\n \n-\tret = dwim_ref(symbolic.buf, symbolic.len, &dummy, &expanded_ref, 0);\n+\tret = repo_dwim_ref(the_repository, symbolic.buf, symbolic.len,\n+\t\t\t    &dummy, &expanded_ref, 0);\n \tstrbuf_release(&symbolic);\n \tswitch (ret) {\n \tcase 0: /* Not found, but valid ref */\ndiff --git a/bundle.c b/bundle.c\nindex bce0c7f99e8..73f0b1b89d6 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -383,7 +383,8 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n \n \t\tif (e->item->flags & UNINTERESTING)\n \t\t\tcontinue;\n-\t\tif (dwim_ref(e->name, strlen(e->name), &oid, &ref, 0) != 1)\n+\t\tif (repo_dwim_ref(the_repository, e->name, strlen(e->name),\n+\t\t\t\t  &oid, &ref, 0) != 1)\n \t\t\tgoto skip_write_ref;\n \t\tif (read_ref_full(e->name, RESOLVE_REF_READING, &oid, &flag))\n \t\t\tflag = 0;\ndiff --git a/commit.c b/commit.c\nindex cfd14f7d975..8e22bebd0e1 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -999,7 +999,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)\n \tstruct commit *ret = NULL;\n \tchar *full_refname;\n \n-\tswitch (dwim_ref(refname, strlen(refname), &oid, &full_refname, 0)) {\n+\tswitch (repo_dwim_ref(the_repository, refname, strlen(refname), &oid,\n+\t\t\t      &full_refname, 0)) {\n \tcase 0:\n \t\tdie(\"No such ref: '%s'\", refname);\n \tcase 1:\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex d5b644a8687..b20a3e70845 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -105,6 +105,10 @@\n |\n - has_promisor_remote\n + repo_has_promisor_remote\n+// refs.h\n+|\n+- dwim_ref\n++ repo_dwim_ref\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex e17a60198c5..8bf30798a04 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// refs.h\n-- dwim_ref\n-+ repo_dwim_ref\n // rerere.h\n-|\n - rerere\n + repo_rerere\n // revision.h\ndiff --git a/refs.h b/refs.h\nindex 935cdd1ece3..2998244b615 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -159,12 +159,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id\n int repo_dwim_ref(struct repository *r, const char *str, int len,\n \t\t  struct object_id *oid, char **ref, int nonfatal_dangling_mark);\n int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);\n-static inline int dwim_ref(const char *str, int len, struct object_id *oid,\n-\t\t\t   char **ref, int nonfatal_dangling_mark)\n-{\n-\treturn repo_dwim_ref(the_repository, str, len, oid, ref,\n-\t\t\t     nonfatal_dangling_mark);\n-}\n int dwim_log(const char *str, int len, struct object_id *oid, char **ref);\n \n /*\ndiff --git a/remote.c b/remote.c\nindex 9219ebb8962..c51180bebb4 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1810,8 +1810,9 @@ static void set_merge(struct remote_state *remote_state, struct branch *ret)\n \t\tif (!remote_find_tracking(remote, ret->merge[i]) ||\n \t\t    strcmp(ret->remote_name, \".\"))\n \t\t\tcontinue;\n-\t\tif (dwim_ref(ret->merge_name[i], strlen(ret->merge_name[i]),\n-\t\t\t     &oid, &ref, 0) == 1)\n+\t\tif (repo_dwim_ref(the_repository, ret->merge_name[i],\n+\t\t\t\t  strlen(ret->merge_name[i]), &oid, &ref,\n+\t\t\t\t  0) == 1)\n \t\t\tret->merge[i]->dst = ref;\n \t\telse\n \t\t\tret->merge[i]->dst = xstrdup(ret->merge_name[i]);\ndiff --git a/wt-status.c b/wt-status.c\nindex 0f0b92eece4..84726d26dc9 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1665,7 +1665,8 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\treturn;\n \t}\n \n-\tif (dwim_ref(cb.buf.buf, cb.buf.len, &oid, &ref, 1) == 1 &&\n+\tif (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,\n+\t\t\t  1) == 1 &&\n \t    /* oid is a commit? match without further lookup */\n \t    (oideq(&cb.noid, &oid) ||\n \t     /* perhaps oid is a tag, try to dereference to a commit */\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474295","messageId":"patch-v2-14.17-3d59dfe4186-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 14/17] cocci: apply the \"rerere.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:55Z","receivedAt":"2023-03-28T14:00:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"rerere.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/stash.c                                 | 2 +-\n contrib/coccinelle/the_repository.cocci         | 4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 4 ----\n rerere.h                                        | 3 ---\n 4 files changed, 5 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 60052ec9d7b..b60c82f7af2 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -602,7 +602,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,\n \t\tret = error(_(\"could not write index\"));\n \n \tif (ret) {\n-\t\trerere(0);\n+\t\trepo_rerere(the_repository, 0);\n \n \t\tif (index)\n \t\t\tfprintf_ln(stderr, _(\"Index was not unstashed.\"));\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex b20a3e70845..1d1ac7d4fc5 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -109,6 +109,10 @@\n |\n - dwim_ref\n + repo_dwim_ref\n+// rerere.h\n+|\n+- rerere\n++ repo_rerere\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\nindex 8bf30798a04..1190a3312bd 100644\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ b/contrib/coccinelle/the_repository.pending.cocci\n@@ -5,11 +5,7 @@\n @@\n @@\n (\n-// rerere.h\n-- rerere\n-+ repo_rerere\n // revision.h\n-|\n - init_revisions\n + repo_init_revisions\n )\ndiff --git a/rerere.h b/rerere.h\nindex c32d79c3bd8..876c316321e 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -24,9 +24,6 @@ struct rerere_id {\n };\n \n int setup_rerere(struct repository *,struct string_list *, int);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define rerere(flags) repo_rerere(the_repository, flags)\n-#endif\n int repo_rerere(struct repository *, int);\n /*\n  * Given the conflict ID and the name of a \"file\" used for replaying\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474296","messageId":"patch-v2-15.17-b7561c87ba5-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 15/17] cocci: apply the \"revision.h\" part of \"the_repository.pending\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:56Z","receivedAt":"2023-03-28T14:00:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Apply the part of \"the_repository.pending.cocci\" pertaining to\n\"revision.h\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-interactive.c                               |  2 +-\n builtin/bisect.c                                |  4 ++--\n builtin/stash.c                                 |  6 +++---\n builtin/submodule--helper.c                     |  2 +-\n contrib/coccinelle/the_repository.cocci         |  4 ++++\n contrib/coccinelle/the_repository.pending.cocci | 14 --------------\n range-diff.c                                    |  2 +-\n revision.h                                      |  3 ---\n 8 files changed, 12 insertions(+), 25 deletions(-)\n delete mode 100644 contrib/coccinelle/the_repository.pending.cocci\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex ae25ec50bce..313cfd39d8e 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -552,7 +552,7 @@ static int get_modified_files(struct repository *r,\n \t\topt.def = is_initial ?\n \t\t\tempty_tree_oid_hex() : oid_to_hex(&head_oid);\n \n-\t\tinit_revisions(&rev, NULL);\n+\t\trepo_init_revisions(the_repository, &rev, NULL);\n \t\tsetup_revisions(0, NULL, &rev, &opt);\n \n \t\trev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 6b01e3c3e8e..c77564053a1 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -570,7 +570,7 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)\n \t * sets up a revision walk.\n \t */\n \treset_revision_walk();\n-\tinit_revisions(revs, NULL);\n+\trepo_init_revisions(the_repository, revs, NULL);\n \tsetup_revisions(0, NULL, revs, NULL);\n \tfor_each_glob_ref_in(add_bisect_ref, bad, \"refs/bisect/\", &cb);\n \tcb.object_flags = UNINTERESTING;\n@@ -1097,7 +1097,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, int argc,\n \t\t\tstruct rev_info revs;\n \t\t\tstruct commit *commit;\n \n-\t\t\tinit_revisions(&revs, NULL);\n+\t\t\trepo_init_revisions(the_repository, &revs, NULL);\n \t\t\tsetup_revisions(2, argv + i - 1, &revs, NULL);\n \n \t\t\tif (prepare_revision_walk(&revs))\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex b60c82f7af2..5e9fe6b4623 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -902,7 +902,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)\n \n \tinit_diff_ui_defaults();\n \tgit_config(git_diff_ui_config, NULL);\n-\tinit_revisions(&rev, prefix);\n+\trepo_init_revisions(the_repository, &rev, prefix);\n \n \targc = parse_options(argc, argv, prefix, options, git_stash_show_usage,\n \t\t\t     PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |\n@@ -1091,7 +1091,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)\n \tif (repo_read_index(the_repository) < 0)\n \t\treturn -1;\n \n-\tinit_revisions(&rev, NULL);\n+\trepo_init_revisions(the_repository, &rev, NULL);\n \tcopy_pathspec(&rev.prune_data, ps);\n \n \trev.diffopt.flags.quick = 1;\n@@ -1278,7 +1278,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps\n \tstruct strbuf diff_output = STRBUF_INIT;\n \tstruct index_state istate = INDEX_STATE_INIT(the_repository);\n \n-\tinit_revisions(&rev, NULL);\n+\trepo_init_revisions(the_repository, &rev, NULL);\n \tcopy_pathspec(&rev.prune_data, ps);\n \n \tset_alternate_index_output(stash_index_path.buf);\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex b21857479de..3833c47aa1f 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1110,7 +1110,7 @@ static int compute_summary_module_list(struct object_id *head_oid,\n \t\tstrvec_pushv(&diff_args, info->argv);\n \n \tgit_config(git_diff_basic_config, NULL);\n-\tinit_revisions(&rev, info->prefix);\n+\trepo_init_revisions(the_repository, &rev, info->prefix);\n \trev.abbrev = 0;\n \tprecompose_argv_prefix(diff_args.nr, diff_args.v, NULL);\n \tsetup_revisions(diff_args.nr, diff_args.v, &rev, &opt);\ndiff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci\nindex 1d1ac7d4fc5..765ad689678 100644\n--- a/contrib/coccinelle/the_repository.cocci\n+++ b/contrib/coccinelle/the_repository.cocci\n@@ -113,6 +113,10 @@\n |\n - rerere\n + repo_rerere\n+// revision.h\n+|\n+- init_revisions\n++ repo_init_revisions\n )\n   (\n + the_repository,\ndiff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci\ndeleted file mode 100644\nindex 1190a3312bd..00000000000\n--- a/contrib/coccinelle/the_repository.pending.cocci\n+++ /dev/null\n@@ -1,14 +0,0 @@\n-// This file is used for the ongoing refactoring of\n-// bringing the index or repository struct in all of\n-// our code base.\n-\n-@@\n-@@\n-(\n-// revision.h\n-- init_revisions\n-+ repo_init_revisions\n-)\n-  (\n-+ the_repository,\n-  ...)\ndiff --git a/range-diff.c b/range-diff.c\nindex 15d0bc35a87..ff5d19f8add 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -588,7 +588,7 @@ int is_range_diff_range(const char *arg)\n \tint i, positive = 0, negative = 0;\n \tstruct rev_info revs;\n \n-\tinit_revisions(&revs, NULL);\n+\trepo_init_revisions(the_repository, &revs, NULL);\n \tif (setup_revisions(3, argv, &revs, NULL) == 1) {\n \t\tfor (i = 0; i < revs.pending.nr; i++)\n \t\t\tif (revs.pending.objects[i].item->flags & UNINTERESTING)\ndiff --git a/revision.h b/revision.h\nindex ab71443696d..742700504a7 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -416,9 +416,6 @@ struct rev_info {\n void repo_init_revisions(struct repository *r,\n \t\t\t struct rev_info *revs,\n \t\t\t const char *prefix);\n-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS\n-#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)\n-#endif\n \n /**\n  * Parse revision information, filling in the `rev_info` structure, and\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474297","messageId":"patch-v2-16.17-f947bb69dee-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 16/17] post-cocci: adjust comments for recent repo_* migration","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:57Z","receivedAt":"2023-03-28T14:00:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits we changed many calls to macros that were\nproviding a \"the_repository\" argument to invoke corresponding repo_*()\nfunction instead. Let's follow-up and adjust references to those in\ncomments, which coccinelle didn't (and inherently can't) catch.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/branch.c   | 2 +-\n builtin/shortlog.c | 2 +-\n cache.h            | 4 ++--\n commit.h           | 4 ++--\n diff.h             | 2 +-\n object-file.c      | 2 +-\n object-store.h     | 4 ++--\n pretty.c           | 2 +-\n refs.c             | 2 +-\n sequencer.c        | 6 +++---\n strbuf.h           | 6 +++---\n 11 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex bbcfb34b3c6..45910039e6b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -156,7 +156,7 @@ static int branch_merged(int kind, const char *name,\n \t/*\n \t * After the safety valve is fully redefined to \"check with\n \t * upstream, if any, otherwise with HEAD\", we should just\n-\t * return the result of the in_merge_bases() above without\n+\t * return the result of the repo_in_merge_bases() above without\n \t * any of the following code, but during the transition period,\n \t * a gentle reminder is in order.\n \t */\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 62f91b8b932..f287a6acd03 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -176,7 +176,7 @@ static void insert_records_from_trailers(struct shortlog *log,\n \t\treturn;\n \n \t/*\n-\t * Using format_commit_message(\"%B\") would be simpler here, but\n+\t * Using repo_format_commit_message(\"%B\") would be simpler here, but\n \t * this saves us copying the message.\n \t */\n \tcommit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,\ndiff --git a/cache.h b/cache.h\nindex 1d05a8e945f..0ede8856562 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -435,7 +435,7 @@ void validate_cache_entries(const struct index_state *istate);\n /*\n  * Bulk prefetch all missing cache entries that are not GITLINKs and that match\n  * the given predicate. This function should only be called if\n- * has_promisor_remote() returns true.\n+ * repo_has_promisor_remote() returns true.\n  */\n typedef int (*must_prefetch_predicate)(const struct cache_entry *);\n void prefetch_cache_entries(const struct index_state *istate,\n@@ -1093,7 +1093,7 @@ void check_repository_format(struct repository_format *fmt);\n  * terminated.\n  *\n  * The non-`_r` version returns a static buffer which remains valid until 4\n- * more calls to find_unique_abbrev are made.\n+ * more calls to repo_find_unique_abbrev are made.\n  *\n  * The `_r` variant writes to a buffer supplied by the caller, which must be at\n  * least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes\ndiff --git a/commit.h b/commit.h\nindex d87d5cd2a09..69b2f376e9d 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -130,7 +130,7 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,\n /*\n  * Get the commit's object contents, either from cache or by reading the object\n  * from disk. The resulting memory should not be modified, and must be given\n- * to unuse_commit_buffer when the caller is done.\n+ * to repo_unuse_commit_buffer when the caller is done.\n  */\n const void *repo_get_commit_buffer(struct repository *r,\n \t\t\t\t   const struct commit *,\n@@ -139,7 +139,7 @@ const void *repo_get_commit_buffer(struct repository *r,\n /*\n  * Tell the commit subsystem that we are done with a particular commit buffer.\n  * The commit and buffer should be the input and return value, respectively,\n- * from an earlier call to get_commit_buffer.  The buffer may or may not be\n+ * from an earlier call to repo_get_commit_buffer.  The buffer may or may not be\n  * freed by this call; callers should not access the memory afterwards.\n  */\n void repo_unuse_commit_buffer(struct repository *r,\ndiff --git a/diff.h b/diff.h\nindex c759bedc269..6a0737b9c34 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -615,7 +615,7 @@ void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);\n #define DIFF_STATUS_FILTER_BROKEN\t'B'\n \n /*\n- * This is different from find_unique_abbrev() in that\n+ * This is different from repo_find_unique_abbrev() in that\n  * it stuffs the result with dots for alignment.\n  */\n const char *diff_aligned_abbrev(const struct object_id *sha1, int);\ndiff --git a/object-file.c b/object-file.c\nindex 5944f51a3e0..bd9741c7f36 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -269,7 +269,7 @@ int hash_algo_by_length(int len)\n \n /*\n  * This is meant to hold a *small* number of objects that you would\n- * want read_object_file() to be able to return, but yet you do not want\n+ * want repo_read_object_file() to be able to return, but yet you do not want\n  * to write them into the object store (e.g. a browse-only\n  * application).\n  */\ndiff --git a/object-store.h b/object-store.h\nindex 62a683af4d6..f9d225783ae 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -216,7 +216,7 @@ struct raw_object_store {\n \t/*\n \t * A fast, rough count of the number of objects in the repository.\n \t * These two fields are not meant for direct access. Use\n-\t * approximate_object_count() instead.\n+\t * repo_approximate_object_count() instead.\n \t */\n \tunsigned long approximate_object_count;\n \tunsigned approximate_object_count_valid : 1;\n@@ -406,7 +406,7 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect);\n \n /*\n  * Enabling the object read lock allows multiple threads to safely call the\n- * following functions in parallel: repo_read_object_file(), read_object_file(),\n+ * following functions in parallel: repo_read_object_file(),\n  * read_object_with_reference(), oid_object_info() and oid_object_info_extended().\n  *\n  * obj_read_lock() and obj_read_unlock() may also be used to protect other\ndiff --git a/pretty.c b/pretty.c\nindex 0ce6ab7e196..494932da20d 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -721,7 +721,7 @@ const char *repo_logmsg_reencode(struct repository *r,\n \t\t * Otherwise, we still want to munge the encoding header in the\n \t\t * result, which will be done by modifying the buffer. If we\n \t\t * are using a fresh copy, we can reuse it. But if we are using\n-\t\t * the cached copy from get_commit_buffer, we need to duplicate it\n+\t\t * the cached copy from repo_get_commit_buffer, we need to duplicate it\n \t\t * to avoid munging the cached copy.\n \t\t */\n \t\tif (msg == get_cached_commit_buffer(r, commit, NULL))\ndiff --git a/refs.c b/refs.c\nindex 53240bcc07b..1e1c76d1eca 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -1823,7 +1823,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,\n \t\t\treturn NULL;\n \n \t\t/*\n-\t\t * dwim_ref() uses REF_ISBROKEN to distinguish between\n+\t\t * repo_dwim_ref() uses REF_ISBROKEN to distinguish between\n \t\t * missing refs and refs that were present but invalid,\n \t\t * to complain about the latter to stderr.\n \t\t *\ndiff --git a/sequencer.c b/sequencer.c\nindex d0ad37700fd..84b07b818f0 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -766,9 +766,9 @@ static int is_index_unchanged(struct repository *r)\n \t/*\n \t * If head_commit is NULL, check_commit, called from\n \t * lookup_commit, would have indicated that head_commit is not\n-\t * a commit object already.  parse_commit() will return failure\n+\t * a commit object already.  repo_parse_commit() will return failure\n \t * without further complaints in such a case.  Otherwise, if\n-\t * the commit is invalid, parse_commit() will complain.  So\n+\t * the commit is invalid, repo_parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n \tif (repo_parse_commit(the_repository, head_commit))\n@@ -5368,7 +5368,7 @@ static const char *label_oid(struct object_id *oid, const char *label,\n \t * For \"uninteresting\" commits, i.e. commits that are not to be\n \t * rebased, and which can therefore not be labeled, we use a unique\n \t * abbreviation of the commit name. This is slightly more complicated\n-\t * than calling find_unique_abbrev() because we also need to make\n+\t * than calling repo_find_unique_abbrev() because we also need to make\n \t * sure that the abbreviation does not conflict with any other\n \t * label.\n \t *\ndiff --git a/strbuf.h b/strbuf.h\nindex f6dbb9681ee..b980f9edc6d 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -631,7 +631,7 @@ void strbuf_add_separated_string_list(struct strbuf *str,\n void strbuf_list_free(struct strbuf **list);\n \n /**\n- * Add the abbreviation, as generated by find_unique_abbrev, of `sha1` to\n+ * Add the abbreviation, as generated by repo_find_unique_abbrev(), of `sha1` to\n  * the strbuf `sb`.\n  */\n struct repository;\n@@ -706,14 +706,14 @@ static inline void strbuf_complete_line(struct strbuf *sb)\n \n /*\n  * Copy \"name\" to \"sb\", expanding any special @-marks as handled by\n- * interpret_branch_name(). The result is a non-qualified branch name\n+ * repo_interpret_branch_name(). The result is a non-qualified branch name\n  * (so \"foo\" or \"origin/master\" instead of \"refs/heads/foo\" or\n  * \"refs/remotes/origin/master\").\n  *\n  * Note that the resulting name may not be a syntactically valid refname.\n  *\n  * If \"allowed\" is non-zero, restrict the set of allowed expansions. See\n- * interpret_branch_name() for details.\n+ * repo_interpret_branch_name() for details.\n  */\n void strbuf_branchname(struct strbuf *sb, const char *name,\n \t\t       unsigned allowed);\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474298","messageId":"patch-v2-17.17-9f4013b4b9d-20230328T110947Z-avarab@gmail.com","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"[PATCH v2 17/17] libs: use \"struct repository *\" argument, not \"the_repository\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-28T13:58:58Z","receivedAt":"2023-03-28T14:00:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As can easily be seen from grepping in our sources, we had these uses\nof \"the_repository\" in various library code in cases where the\nfunction in question was already getting a \"struct repository *\"\nargument. Let's use that argument instead.\n\nOut of these changes only the changes to \"cache-tree.c\",\n\"commit-reach.c\", \"shallow.c\" and \"upload-pack.c\" would have cleanly\napplied before the migration away from the \"repo_*()\" wrapper macros\nin the preceding commits.\n\nThe rest aren't new, as we'd previously implicitly refer to\n\"the_repository\", but it's now more obvious that we were doing the\nwrong thing all along, and should have used the parameter instead.\n\nThe change to change \"get_index_format_default(the_repository)\" in\n\"read-cache.c\" to use the \"r\" variable instead should arguably have\nbeen part of [1], or in the subsequent cleanup in [2]. Let's do it\nhere, as can be seen from the initial code in [3] it's not important\nthat we use \"the_repository\" there, but would prefer to always use the\ncurrent repository.\n\nThis change excludes the \"the_repository\" use in \"upload-pack.c\"'s\nupload_pack_advertise(), as the in-flight [4] makes that change.\n\n1. ee1f0c242ef (read-cache: add index.skipHash config option,\n   2023-01-06)\n2. 6269f8eaad0 (treewide: always have a valid \"index_state.repo\"\n   member, 2023-01-17)\n3. 7211b9e7534 (repo-settings: consolidate some config settings,\n   2019-08-13)\n4. <Y/hbUsGPVNAxTdmS@coredump.intra.peff.net>\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-interactive.c |   2 +-\n branch.c          |   8 ++--\n builtin/replace.c |   2 +-\n cache-tree.c      |   4 +-\n combine-diff.c    |   2 +-\n commit-graph.c    |   2 +-\n commit-reach.c    |   2 +-\n merge-recursive.c |   2 +-\n notes-cache.c     |   2 +-\n notes-utils.c     |   2 +-\n object-name.c     |   8 ++--\n read-cache.c      |   4 +-\n reset.c           |   2 +-\n sequencer.c       | 102 ++++++++++++++++++++++------------------------\n shallow.c         |   2 +-\n tree.c            |   2 +-\n wt-status.c       |  10 ++---\n 17 files changed, 76 insertions(+), 82 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 313cfd39d8e..14ccea150a0 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -552,7 +552,7 @@ static int get_modified_files(struct repository *r,\n \t\topt.def = is_initial ?\n \t\t\tempty_tree_oid_hex() : oid_to_hex(&head_oid);\n \n-\t\trepo_init_revisions(the_repository, &rev, NULL);\n+\t\trepo_init_revisions(r, &rev, NULL);\n \t\tsetup_revisions(0, NULL, &rev, &opt);\n \n \t\trev.diffopt.output_format = DIFF_FORMAT_CALLBACK;\ndiff --git a/branch.c b/branch.c\nindex 179353e7653..6fa61d1251d 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -532,7 +532,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\texplicit_tracking = 1;\n \n \treal_ref = NULL;\n-\tif (repo_get_oid_mb(the_repository, start_name, &oid)) {\n+\tif (repo_get_oid_mb(r, start_name, &oid)) {\n \t\tif (explicit_tracking) {\n \t\t\tint code = die_message(_(upstream_missing), start_name);\n \t\t\tadvise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,\n@@ -542,8 +542,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,\n \t\tdie(_(\"not a valid object name: '%s'\"), start_name);\n \t}\n \n-\tswitch (repo_dwim_ref(the_repository, start_name, strlen(start_name),\n-\t\t\t      &oid, &real_ref, 0)) {\n+\tswitch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,\n+\t\t\t      &real_ref, 0)) {\n \tcase 0:\n \t\t/* Not branching from any existing branch */\n \t\tif (explicit_tracking)\n@@ -774,7 +774,7 @@ void create_branches_recursively(struct repository *r, const char *name,\n \t\t\t    name);\n \t}\n \n-\tcreate_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,\n+\tcreate_branch(r, name, start_commitish, force, 0, reflog, quiet,\n \t\t      BRANCH_TRACK_NEVER, dry_run);\n \tif (dry_run)\n \t\treturn;\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex ef70f2d1005..44ec1709676 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -56,7 +56,7 @@ static int show_reference(struct repository *r, const char *refname,\n \t\t\tstruct object_id object;\n \t\t\tenum object_type obj_type, repl_type;\n \n-\t\t\tif (repo_get_oid(the_repository, refname, &object))\n+\t\t\tif (repo_get_oid(r, refname, &object))\n \t\t\t\treturn error(_(\"failed to resolve '%s' as a valid ref\"), refname);\n \n \t\t\tobj_type = oid_object_info(r, &object, NULL);\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 12206eeaa3c..29ea7bd3646 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -816,14 +816,14 @@ void prime_cache_tree(struct repository *r,\n {\n \tstruct strbuf tree_path = STRBUF_INIT;\n \n-\ttrace2_region_enter(\"cache-tree\", \"prime_cache_tree\", the_repository);\n+\ttrace2_region_enter(\"cache-tree\", \"prime_cache_tree\", r);\n \tcache_tree_free(&istate->cache_tree);\n \tistate->cache_tree = cache_tree();\n \n \tprime_cache_tree_rec(r, istate->cache_tree, tree, &tree_path);\n \tstrbuf_release(&tree_path);\n \tistate->cache_changed |= CACHE_TREE_CHANGED;\n-\ttrace2_region_leave(\"cache-tree\", \"prime_cache_tree\", the_repository);\n+\ttrace2_region_leave(\"cache-tree\", \"prime_cache_tree\", r);\n }\n \n /*\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 6077d4ec498..20953963946 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -333,7 +333,7 @@ static char *grab_blob(struct repository *r,\n \t\t*size = fill_textconv(r, textconv, df, &blob);\n \t\tfree_filespec(df);\n \t} else {\n-\t\tblob = repo_read_object_file(the_repository, oid, &type, size);\n+\t\tblob = repo_read_object_file(r, oid, &type, size);\n \t\tif (type != OBJ_BLOB)\n \t\t\tdie(\"object '%s' is not a blob!\", oid_to_hex(oid));\n \t}\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 6403567dfee..a394cee4f10 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2550,7 +2550,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)\n \n \t\tgraph_commit = lookup_commit(r, &cur_oid);\n \t\todb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));\n-\t\tif (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) {\n+\t\tif (repo_parse_commit_internal(r, odb_commit, 0, 0)) {\n \t\t\tgraph_report(_(\"failed to parse commit %s from object database for commit-graph\"),\n \t\t\t\t     oid_to_hex(&cur_oid));\n \t\t\tcontinue;\ndiff --git a/commit-reach.c b/commit-reach.c\nindex b9eb0952d7b..5957a8e950f 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -450,7 +450,7 @@ int repo_is_descendant_of(struct repository *r,\n \tif (!with_commit)\n \t\treturn 1;\n \n-\tif (generation_numbers_enabled(the_repository)) {\n+\tif (generation_numbers_enabled(r)) {\n \t\tstruct commit_list *from_list = NULL;\n \t\tint result;\n \t\tcommit_list_insert(commit, &from_list);\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 9c80b7aa3a7..e3244721462 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -3798,7 +3798,7 @@ static struct commit *get_ref(struct repository *repo,\n \t\treturn make_virtual_commit(repo, (struct tree*)object, name);\n \tif (object->type != OBJ_COMMIT)\n \t\treturn NULL;\n-\tif (repo_parse_commit(the_repository, (struct commit *)object))\n+\tif (repo_parse_commit(repo, (struct commit *)object))\n \t\treturn NULL;\n \treturn (struct commit *)object;\n }\ndiff --git a/notes-cache.c b/notes-cache.c\nindex e5e9092d367..1a6e214ea79 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -23,7 +23,7 @@ static int notes_cache_match_validity(struct repository *r,\n \t\treturn 0;\n \n \tmemset(&pretty_ctx, 0, sizeof(pretty_ctx));\n-\trepo_format_commit_message(the_repository, commit, \"%s\", &msg,\n+\trepo_format_commit_message(r, commit, \"%s\", &msg,\n \t\t\t\t   &pretty_ctx);\n \tstrbuf_trim(&msg);\n \ndiff --git a/notes-utils.c b/notes-utils.c\nindex 0550cfded86..4be0aaa6de9 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r,\n \t\tstruct object_id parent_oid;\n \t\tif (!read_ref(t->ref, &parent_oid)) {\n \t\t\tstruct commit *parent = lookup_commit(r, &parent_oid);\n-\t\t\tif (repo_parse_commit(the_repository, parent))\n+\t\t\tif (repo_parse_commit(r, parent))\n \t\t\t\tdie(\"Failed to find/parse commit %s\", t->ref);\n \t\t\tcommit_list_insert(parent, &parents);\n \t\t}\ndiff --git a/object-name.c b/object-name.c\nindex c7cef682f20..d63141bd043 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1039,7 +1039,7 @@ static enum get_oid_result get_parent(struct repository *r,\n \tif (ret)\n \t\treturn ret;\n \tcommit = lookup_commit_reference(r, &oid);\n-\tif (repo_parse_commit(the_repository, commit))\n+\tif (repo_parse_commit(r, commit))\n \t\treturn MISSING_OBJECT;\n \tif (!idx) {\n \t\toidcpy(result, &commit->object.oid);\n@@ -1073,7 +1073,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,\n \t\treturn MISSING_OBJECT;\n \n \twhile (generation--) {\n-\t\tif (repo_parse_commit(the_repository, commit) || !commit->parents)\n+\t\tif (repo_parse_commit(r, commit) || !commit->parents)\n \t\t\treturn MISSING_OBJECT;\n \t\tcommit = commit->parents->item;\n \t}\n@@ -1364,10 +1364,10 @@ static int get_oid_oneline(struct repository *r,\n \t\tcommit = pop_most_recent_commit(&list, ONELINE_SEEN);\n \t\tif (!parse_object(r, &commit->object.oid))\n \t\t\tcontinue;\n-\t\tbuf = repo_get_commit_buffer(the_repository, commit, NULL);\n+\t\tbuf = repo_get_commit_buffer(r, commit, NULL);\n \t\tp = strstr(buf, \"\\n\\n\");\n \t\tmatches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));\n-\t\trepo_unuse_commit_buffer(the_repository, commit, buf);\n+\t\trepo_unuse_commit_buffer(r, commit, buf);\n \n \t\tif (matches) {\n \t\t\toidcpy(oid, &commit->object.oid);\ndiff --git a/read-cache.c b/read-cache.c\nindex 4518a40ac06..0a336934a76 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2630,7 +2630,7 @@ int repo_index_has_changes(struct repository *repo,\n \n \tif (tree)\n \t\tcmp = tree->object.oid;\n-\tif (tree || !repo_get_oid_tree(the_repository, \"HEAD\", &cmp)) {\n+\tif (tree || !repo_get_oid_tree(repo, \"HEAD\", &cmp)) {\n \t\tstruct diff_options opt;\n \n \t\trepo_diff_setup(repo, &opt);\n@@ -2949,7 +2949,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,\n \t}\n \n \tif (!istate->version)\n-\t\tistate->version = get_index_format_default(the_repository);\n+\t\tistate->version = get_index_format_default(r);\n \n \t/* demote version 3 to version 2 when the latter suffices */\n \tif (istate->version == 3 || istate->version == 2)\ndiff --git a/reset.c b/reset.c\nindex 8c471e22d99..b1234807188 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -107,7 +107,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)\n \t\tgoto leave_reset_head;\n \t}\n \n-\tif (!repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n+\tif (!repo_get_oid(r, \"HEAD\", &head_oid)) {\n \t\thead = &head_oid;\n \t} else if (!oid || !reset_hard) {\n \t\tret = error(_(\"could not determine HEAD revision\"));\ndiff --git a/sequencer.c b/sequencer.c\nindex 84b07b818f0..c23f3e5fa67 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -692,8 +692,8 @@ static int do_recursive_merge(struct repository *r,\n \to.show_rename_progress = 1;\n \n \thead_tree = parse_tree_indirect(head);\n-\tnext_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r);\n-\tbase_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r);\n+\tnext_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);\n+\tbase_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);\n \n \tfor (i = 0; i < opts->xopts_nr; i++)\n \t\tparse_merge_opt(&o, opts->xopts[i]);\n@@ -771,7 +771,7 @@ static int is_index_unchanged(struct repository *r)\n \t * the commit is invalid, repo_parse_commit() will complain.  So\n \t * there is nothing for us to say here.  Just return failure.\n \t */\n-\tif (repo_parse_commit(the_repository, head_commit))\n+\tif (repo_parse_commit(r, head_commit))\n \t\treturn -1;\n \n \tif (!(cache_tree_oid = get_cache_tree_oid(istate)))\n@@ -1336,15 +1336,15 @@ void print_commit_summary(struct repository *r,\n \tcommit = lookup_commit(r, oid);\n \tif (!commit)\n \t\tdie(_(\"couldn't look up newly created commit\"));\n-\tif (repo_parse_commit(the_repository, commit))\n+\tif (repo_parse_commit(r, commit))\n \t\tdie(_(\"could not parse newly created commit\"));\n \n \tstrbuf_addstr(&format, \"format:%h] %s\");\n \n-\trepo_format_commit_message(the_repository, commit, \"%an <%ae>\",\n-\t\t\t\t   &author_ident, &pctx);\n-\trepo_format_commit_message(the_repository, commit, \"%cn <%ce>\",\n-\t\t\t\t   &committer_ident, &pctx);\n+\trepo_format_commit_message(r, commit, \"%an <%ae>\", &author_ident,\n+\t\t\t\t   &pctx);\n+\trepo_format_commit_message(r, commit, \"%cn <%ce>\", &committer_ident,\n+\t\t\t\t   &pctx);\n \tif (strbuf_cmp(&author_ident, &committer_ident)) {\n \t\tstrbuf_addstr(&format, \"\\n Author: \");\n \t\tstrbuf_addbuf_percentquote(&format, &author_ident);\n@@ -1352,8 +1352,7 @@ void print_commit_summary(struct repository *r,\n \tif (flags & SUMMARY_SHOW_AUTHOR_DATE) {\n \t\tstruct strbuf date = STRBUF_INIT;\n \n-\t\trepo_format_commit_message(the_repository, commit, \"%ad\",\n-\t\t\t\t\t   &date, &pctx);\n+\t\trepo_format_commit_message(r, commit, \"%ad\", &date, &pctx);\n \t\tstrbuf_addstr(&format, \"\\n Date: \");\n \t\tstrbuf_addbuf_percentquote(&format, &date);\n \t\tstrbuf_release(&date);\n@@ -1383,7 +1382,7 @@ void print_commit_summary(struct repository *r,\n \trev.diffopt.detect_rename = DIFF_DETECT_RENAME;\n \tdiff_setup_done(&rev.diffopt);\n \n-\trefs = get_main_ref_store(the_repository);\n+\trefs = get_main_ref_store(r);\n \thead = refs_resolve_ref_unsafe(refs, \"HEAD\", 0, NULL, NULL);\n \tif (!head)\n \t\tdie(_(\"unable to resolve HEAD after creating commit\"));\n@@ -1409,7 +1408,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \tstruct commit *current_head;\n \tstruct object_id oid;\n \n-\tif (repo_get_oid(the_repository, \"HEAD\", &oid)) {\n+\tif (repo_get_oid(r, \"HEAD\", &oid)) {\n \t\tcurrent_head = NULL;\n \t} else {\n \t\tcurrent_head = lookup_commit_reference(r, &oid);\n@@ -1419,7 +1418,7 @@ static int parse_head(struct repository *r, struct commit **head)\n \t\t\twarning(_(\"HEAD %s is not a commit!\"),\n \t\t\t\toid_to_hex(&oid));\n \t\t}\n-\t\tif (repo_parse_commit(the_repository, current_head))\n+\t\tif (repo_parse_commit(r, current_head))\n \t\t\treturn error(_(\"could not parse HEAD commit\"));\n \t}\n \t*head = current_head;\n@@ -1462,9 +1461,8 @@ static int try_to_commit(struct repository *r,\n \tif (flags & AMEND_MSG) {\n \t\tconst char *exclude_gpgsig[] = { \"gpgsig\", \"gpgsig-sha256\", NULL };\n \t\tconst char *out_enc = get_commit_output_encoding();\n-\t\tconst char *message = repo_logmsg_reencode(the_repository,\n-\t\t\t\t\t\t\t   current_head, NULL,\n-\t\t\t\t\t\t\t   out_enc);\n+\t\tconst char *message = repo_logmsg_reencode(r, current_head,\n+\t\t\t\t\t\t\t   NULL, out_enc);\n \n \t\tif (!msg) {\n \t\t\tconst char *orig_message = NULL;\n@@ -1475,7 +1473,7 @@ static int try_to_commit(struct repository *r,\n \t\t\thook_commit = \"HEAD\";\n \t\t}\n \t\tauthor = amend_author = get_author(message);\n-\t\trepo_unuse_commit_buffer(the_repository, current_head,\n+\t\trepo_unuse_commit_buffer(r, current_head,\n \t\t\t\t\t message);\n \t\tif (!author) {\n \t\t\tres = error(_(\"unable to parse commit author\"));\n@@ -2002,18 +2000,18 @@ static int update_squash_messages(struct repository *r,\n \t\tstruct commit *head_commit;\n \t\tconst char *head_message, *body;\n \n-\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n+\t\tif (repo_get_oid(r, \"HEAD\", &head))\n \t\t\treturn error(_(\"need a HEAD to fixup\"));\n \t\tif (!(head_commit = lookup_commit_reference(r, &head)))\n \t\t\treturn error(_(\"could not read HEAD\"));\n-\t\tif (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding)))\n+\t\tif (!(head_message = repo_logmsg_reencode(r, head_commit, NULL,\n+\t\t\t\t\t\t\t  encoding)))\n \t\t\treturn error(_(\"could not read HEAD's commit message\"));\n \n \t\tfind_commit_subject(head_message, &body);\n \t\tif (command == TODO_FIXUP && !flag && write_message(body, strlen(body),\n \t\t\t\t\t\t\trebase_path_fixup_msg(), 0) < 0) {\n-\t\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n-\t\t\t\t\t\t head_message);\n+\t\t\trepo_unuse_commit_buffer(r, head_commit, head_message);\n \t\t\treturn error(_(\"cannot write '%s'\"), rebase_path_fixup_msg());\n \t\t}\n \t\tstrbuf_addf(&buf, \"%c \", comment_line_char);\n@@ -2028,11 +2026,10 @@ static int update_squash_messages(struct repository *r,\n \t\telse\n \t\t\tstrbuf_addstr(&buf, body);\n \n-\t\trepo_unuse_commit_buffer(the_repository, head_commit,\n-\t\t\t\t\t head_message);\n+\t\trepo_unuse_commit_buffer(r, head_commit, head_message);\n \t}\n \n-\tif (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding)))\n+\tif (!(message = repo_logmsg_reencode(r, commit, NULL, encoding)))\n \t\treturn error(_(\"could not read commit message of %s\"),\n \t\t\t     oid_to_hex(&commit->object.oid));\n \tfind_commit_subject(message, &body);\n@@ -2047,7 +2044,7 @@ static int update_squash_messages(struct repository *r,\n \t\tstrbuf_add_commented_lines(&buf, body, strlen(body));\n \t} else\n \t\treturn error(_(\"unknown command: %d\"), command);\n-\trepo_unuse_commit_buffer(the_repository, commit, message);\n+\trepo_unuse_commit_buffer(r, commit, message);\n \n \tif (!res)\n \t\tres = write_message(buf.buf, buf.len, rebase_path_squash_msg(),\n@@ -2160,7 +2157,7 @@ static int do_pick_commit(struct repository *r,\n \t\tif (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))\n \t\t\treturn error(_(\"your index file is unmerged.\"));\n \t} else {\n-\t\tunborn = repo_get_oid(the_repository, \"HEAD\", &head);\n+\t\tunborn = repo_get_oid(r, \"HEAD\", &head);\n \t\t/* Do we want to generate a root commit? */\n \t\tif (is_pick_or_similar(command) && opts->have_squash_onto &&\n \t\t    oideq(&head, &opts->squash_onto)) {\n@@ -2222,7 +2219,7 @@ static int do_pick_commit(struct repository *r,\n \t\tmsg_file = NULL;\n \t\tgoto fast_forward_edit;\n \t}\n-\tif (parent && repo_parse_commit(the_repository, parent) < 0)\n+\tif (parent && repo_parse_commit(r, parent) < 0)\n \t\t/* TRANSLATORS: The first %s will be a \"todo\" command like\n \t\t   \"revert\" or \"pick\", the second %s a SHA1. */\n \t\treturn error(_(\"%s: cannot parse parent commit %s\"),\n@@ -2614,7 +2611,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \tend_of_object_name = (char *) bol + strcspn(bol, \" \\t\\n\");\n \tsaved = *end_of_object_name;\n \t*end_of_object_name = '\\0';\n-\tstatus = repo_get_oid(the_repository, bol, &commit_oid);\n+\tstatus = repo_get_oid(r, bol, &commit_oid);\n \tif (status < 0)\n \t\terror(_(\"could not parse '%s'\"), bol); /* return later */\n \t*end_of_object_name = saved;\n@@ -3534,12 +3531,12 @@ static int make_patch(struct repository *r,\n \tstrbuf_addf(&buf, \"%s/message\", get_dir(opts));\n \tif (!file_exists(buf.buf)) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(r,\n \t\t\t\t\t\t\t\t commit, NULL,\n \t\t\t\t\t\t\t\t encoding);\n \t\tfind_commit_subject(commit_buffer, &subject);\n \t\tres |= write_message(subject, strlen(subject), buf.buf, 1);\n-\t\trepo_unuse_commit_buffer(the_repository, commit,\n+\t\trepo_unuse_commit_buffer(r, commit,\n \t\t\t\t\t commit_buffer);\n \t}\n \tstrbuf_release(&buf);\n@@ -3719,7 +3716,7 @@ static int do_label(struct repository *r, const char *name, int len)\n \tif (!transaction) {\n \t\terror(\"%s\", err.buf);\n \t\tret = -1;\n-\t} else if (repo_get_oid(the_repository, \"HEAD\", &head_oid)) {\n+\t} else if (repo_get_oid(r, \"HEAD\", &head_oid)) {\n \t\terror(_(\"could not read HEAD\"));\n \t\tret = -1;\n \t} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,\n@@ -4007,8 +4004,7 @@ static int do_merge(struct repository *r,\n \n \tif (commit) {\n \t\tconst char *encoding = get_commit_output_encoding();\n-\t\tconst char *message = repo_logmsg_reencode(the_repository,\n-\t\t\t\t\t\t\t   commit, NULL,\n+\t\tconst char *message = repo_logmsg_reencode(r, commit, NULL,\n \t\t\t\t\t\t\t   encoding);\n \t\tconst char *body;\n \t\tint len;\n@@ -4022,7 +4018,7 @@ static int do_merge(struct repository *r,\n \t\tfind_commit_subject(message, &body);\n \t\tlen = strlen(body);\n \t\tret = write_message(body, len, git_path_merge_msg(r), 0);\n-\t\trepo_unuse_commit_buffer(the_repository, commit, message);\n+\t\trepo_unuse_commit_buffer(r, commit, message);\n \t\tif (ret) {\n \t\t\terror_errno(_(\"could not write '%s'\"),\n \t\t\t\t    git_path_merge_msg(r));\n@@ -4122,8 +4118,7 @@ static int do_merge(struct repository *r,\n \t}\n \n \tmerge_commit = to_merge->item;\n-\tbases = repo_get_merge_bases(the_repository, head_commit,\n-\t\t\t\t     merge_commit);\n+\tbases = repo_get_merge_bases(r, head_commit, merge_commit);\n \tif (bases && oideq(&merge_commit->object.oid,\n \t\t\t   &bases->item->object.oid)) {\n \t\tret = 0;\n@@ -4478,7 +4473,7 @@ void create_autostash(struct repository *r, const char *path)\n \t\tif (capture_command(&stash, &buf, GIT_MAX_HEXSZ))\n \t\t\tdie(_(\"Cannot autostash\"));\n \t\tstrbuf_trim_trailing_newline(&buf);\n-\t\tif (repo_get_oid(the_repository, buf.buf, &oid))\n+\t\tif (repo_get_oid(r, buf.buf, &oid))\n \t\t\tdie(_(\"Unexpected stash response: '%s'\"),\n \t\t\t    buf.buf);\n \t\tstrbuf_reset(&buf);\n@@ -4603,9 +4598,9 @@ static int stopped_at_head(struct repository *r)\n \tstruct commit *commit;\n \tstruct commit_message message;\n \n-\tif (repo_get_oid(the_repository, \"HEAD\", &head) ||\n+\tif (repo_get_oid(r, \"HEAD\", &head) ||\n \t    !(commit = lookup_commit(r, &head)) ||\n-\t    repo_parse_commit(the_repository, commit) || get_message(commit, &message))\n+\t    repo_parse_commit(r, commit) || get_message(commit, &message))\n \t\tfprintf(stderr, _(\"Stopped at HEAD\\n\"));\n \telse {\n \t\tfprintf(stderr, _(\"Stopped at %s\\n\"), message.label);\n@@ -4753,7 +4748,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t * otherwise we do not.\n \t\t\t\t */\n \t\t\t\tif (item->command == TODO_REWORD &&\n-\t\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n+\t\t\t\t    !repo_get_oid(r, \"HEAD\", &oid) &&\n \t\t\t\t    (oideq(&item->commit->object.oid, &oid) ||\n \t\t\t\t     (opts->have_squash_onto &&\n \t\t\t\t      oideq(&opts->squash_onto, &oid))))\n@@ -4842,7 +4837,7 @@ static int pick_commits(struct repository *r,\n \t\t\tstruct object_id head, orig;\n \t\t\tint res;\n \n-\t\t\tif (repo_get_oid(the_repository, \"HEAD\", &head)) {\n+\t\t\tif (repo_get_oid(r, \"HEAD\", &head)) {\n \t\t\t\tres = error(_(\"cannot read HEAD\"));\n cleanup_head_ref:\n \t\t\t\tstrbuf_release(&head_ref);\n@@ -4889,8 +4884,8 @@ static int pick_commits(struct repository *r,\n \t\t\tlog_tree_opt.disable_stdin = 1;\n \n \t\t\tif (read_oneliner(&buf, rebase_path_orig_head(), 0) &&\n-\t\t\t    !repo_get_oid(the_repository, buf.buf, &orig) &&\n-\t\t\t    !repo_get_oid(the_repository, \"HEAD\", &head)) {\n+\t\t\t    !repo_get_oid(r, buf.buf, &orig) &&\n+\t\t\t    !repo_get_oid(r, \"HEAD\", &head)) {\n \t\t\t\tdiff_tree_oid(&orig, &head, \"\",\n \t\t\t\t\t      &log_tree_opt.diffopt);\n \t\t\t\tlog_tree_diff_flush(&log_tree_opt);\n@@ -4982,7 +4977,7 @@ static int commit_staged_changes(struct repository *r,\n \t\tstruct strbuf rev = STRBUF_INIT;\n \t\tstruct object_id head, to_amend;\n \n-\t\tif (repo_get_oid(the_repository, \"HEAD\", &head))\n+\t\tif (repo_get_oid(r, \"HEAD\", &head))\n \t\t\treturn error(_(\"cannot amend non-existing commit\"));\n \t\tif (!read_oneliner(&rev, rebase_path_amend(), 0))\n \t\t\treturn error(_(\"invalid file: '%s'\"), rebase_path_amend());\n@@ -5062,14 +5057,13 @@ static int commit_staged_changes(struct repository *r,\n \t\t\t\tconst char *encoding = get_commit_output_encoding();\n \n \t\t\t\tif (parse_head(r, &commit) ||\n-\t\t\t\t    !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) ||\n+\t\t\t\t    !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||\n \t\t\t\t    write_message(p, strlen(p), path, 0)) {\n-\t\t\t\t\trepo_unuse_commit_buffer(the_repository,\n-\t\t\t\t\t\t\t\t commit, p);\n+\t\t\t\t\trepo_unuse_commit_buffer(r, commit, p);\n \t\t\t\t\treturn error(_(\"could not write file: \"\n \t\t\t\t\t\t       \"'%s'\"), path);\n \t\t\t\t}\n-\t\t\t\trepo_unuse_commit_buffer(the_repository,\n+\t\t\t\trepo_unuse_commit_buffer(r,\n \t\t\t\t\t\t\t commit, p);\n \t\t\t}\n \t\t}\n@@ -5209,7 +5203,7 @@ int sequencer_pick_revisions(struct repository *r,\n \t\tif (!strlen(name))\n \t\t\tcontinue;\n \n-\t\tif (!repo_get_oid(the_repository, name, &oid)) {\n+\t\tif (!repo_get_oid(r, name, &oid)) {\n \t\t\tif (!lookup_commit_reference_gently(r, &oid, 1)) {\n \t\t\t\tenum object_type type = oid_object_info(r,\n \t\t\t\t\t\t\t\t\t&oid,\n@@ -5252,7 +5246,7 @@ int sequencer_pick_revisions(struct repository *r,\n \tif (walk_revs_populate_todo(&todo_list, opts) ||\n \t\t\tcreate_seq_dir(r) < 0)\n \t\treturn -1;\n-\tif (repo_get_oid(the_repository, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n+\tif (repo_get_oid(r, \"HEAD\", &oid) && (opts->action == REPLAY_REVERT))\n \t\treturn error(_(\"can't revert as initial commit\"));\n \tif (save_head(oid_to_hex(&oid)))\n \t\treturn -1;\n@@ -5947,7 +5941,7 @@ static int skip_unnecessary_picks(struct repository *r,\n \t\t\tcontinue;\n \t\tif (item->command != TODO_PICK)\n \t\t\tbreak;\n-\t\tif (repo_parse_commit(the_repository, item->commit)) {\n+\t\tif (repo_parse_commit(r, item->commit)) {\n \t\t\treturn error(_(\"could not parse commit '%s'\"),\n \t\t\t\toid_to_hex(&item->commit->object.oid));\n \t\t}\n@@ -6118,7 +6112,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla\n \tstruct object_id oid = onto->object.oid;\n \tint res;\n \n-\trepo_find_unique_abbrev_r(the_repository, shortonto, &oid,\n+\trepo_find_unique_abbrev_r(r, shortonto, &oid,\n \t\t\t\t  DEFAULT_ABBREV);\n \n \tif (buf->len == 0) {\n@@ -6398,8 +6392,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)\n \t\tif (file_exists(git_path_seq_dir()))\n \t\t\t*whence = FROM_CHERRY_PICK_MULTI;\n \t\tif (file_exists(rebase_path()) &&\n-\t\t    !repo_get_oid(the_repository, \"REBASE_HEAD\", &rebase_head) &&\n-\t\t    !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n+\t\t    !repo_get_oid(r, \"REBASE_HEAD\", &rebase_head) &&\n+\t\t    !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &cherry_pick_head) &&\n \t\t    oideq(&rebase_head, &cherry_pick_head))\n \t\t\t*whence = FROM_REBASE_PICK;\n \t\telse\ndiff --git a/shallow.c b/shallow.c\nindex ce21f66e5e1..4f34861423f 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -32,7 +32,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)\n {\n \tstruct commit_graft *graft =\n \t\txmalloc(sizeof(struct commit_graft));\n-\tstruct commit *commit = lookup_commit(the_repository, oid);\n+\tstruct commit *commit = lookup_commit(r, oid);\n \n \toidcpy(&graft->oid, oid);\n \tgraft->nr_parent = -1;\ndiff --git a/tree.c b/tree.c\nindex 955b53f6a57..2b78708766b 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -59,7 +59,7 @@ int read_tree_at(struct repository *r,\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\n \n-\t\t\tif (repo_parse_commit(the_repository, commit))\n+\t\t\tif (repo_parse_commit(r, commit))\n \t\t\t\tdie(\"Invalid commit %s in submodule path %s%s\",\n \t\t\t\t    oid_to_hex(&entry.oid),\n \t\t\t\t    base->buf, entry.path);\ndiff --git a/wt-status.c b/wt-status.c\nindex 84726d26dc9..151b94aa369 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1665,7 +1665,7 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\treturn;\n \t}\n \n-\tif (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref,\n+\tif (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref,\n \t\t\t  1) == 1 &&\n \t    /* oid is a commit? match without further lookup */\n \t    (oideq(&cb.noid, &oid) ||\n@@ -1678,9 +1678,9 @@ static void wt_status_get_detached_from(struct repository *r,\n \t\tstate->detached_from = xstrdup(from);\n \t} else\n \t\tstate->detached_from =\n-\t\t\txstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV));\n+\t\t\txstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV));\n \toidcpy(&state->detached_oid, &cb.noid);\n-\tstate->detached_at = !repo_get_oid(the_repository, \"HEAD\", &oid) &&\n+\tstate->detached_at = !repo_get_oid(r, \"HEAD\", &oid) &&\n \t\t\t     oideq(&oid, &state->detached_oid);\n \n \tfree(ref);\n@@ -1771,13 +1771,13 @@ void wt_status_get_state(struct repository *r,\n \t} else if (wt_status_check_rebase(NULL, state)) {\n \t\t;\t\t/* all set */\n \t} else if (refs_ref_exists(get_main_ref_store(r), \"CHERRY_PICK_HEAD\") &&\n-\t\t   !repo_get_oid(the_repository, \"CHERRY_PICK_HEAD\", &oid)) {\n+\t\t   !repo_get_oid(r, \"CHERRY_PICK_HEAD\", &oid)) {\n \t\tstate->cherry_pick_in_progress = 1;\n \t\toidcpy(&state->cherry_pick_head_oid, &oid);\n \t}\n \twt_status_check_bisect(NULL, state);\n \tif (refs_ref_exists(get_main_ref_store(r), \"REVERT_HEAD\") &&\n-\t    !repo_get_oid(the_repository, \"REVERT_HEAD\", &oid)) {\n+\t    !repo_get_oid(r, \"REVERT_HEAD\", &oid)) {\n \t\tstate->revert_in_progress = 1;\n \t\toidcpy(&state->revert_head_oid, &oid);\n \t}\n-- \n2.40.0.rc1.1034.g5867a1b10c5\n\n"},{"id":"474311","messageId":"xmqqpm8thss8.fsf@gitster.g","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-28T14:09:11Z","receivedAt":"2023-03-28T14:12:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> A v2 of the removal of \"the_repository\" wrapper macros and adjacent\n> cleanups. The v1 subject for this said \"the_index\", sorry!\n>\n> See v1 [1] for a more general overview. The changes since v1 are\n> trivial & best skimmed from the range-diff, just a rebasing,\n> clarification in a commit message, and a typo fix, thanks all!\n>\n> As before this has a trivial conflict with \"seen\", but this time\n> around the conflict is different, but it's trivially solved as before,\n\nOn what commit is this targetted to be applied in the first place?\nIt does not look like it would apply on the same base as the\nprevious one is queued.\n\nThanks.\n"},{"id":"474317","messageId":"xmqqlejhhrm6.fsf@gitster.g","threadId":"59404","inReplyTo":"xmqqpm8thss8.fsf@gitster.g","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-28T14:34:25Z","receivedAt":"2023-03-28T14:34:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> On what commit is this targetted to be applied in the first place?\n> It does not look like it would apply on the same base as the\n> previous one is queued.\n\nOK, I managed to backport them to the same base before replacing.\n"},{"id":"474420","messageId":"xmqq355n9y9m.fsf@gitster.g","threadId":"59404","inReplyTo":"cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-29T19:02:29Z","receivedAt":"2023-03-29T19:02:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n>  1:  c167bde3c0c !  1:  e1e27490d60 cocci: remove dead rule from \"the_repository.pending.cocci\"\n>     @@ Commit message\n>          cocci: remove dead rule from \"the_repository.pending.cocci\"\n>      \n>          The \"parse_commit_gently\" macro went away in [1], so we don't need to\n>     -    carry his for its migration.\n>     +    carry this for its migration.\n>      \n>          1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n>             commits, 2020-06-23)\n>  2:  1b1fc5d41f5 =  2:  5ac9d5b8905 cocci: fix incorrect & verbose \"the_repository\" rules\n>  3:  34c6b8afd6c !  3:  a3fcd19d744 cocci: sort \"the_repository\" rules by header\n>     @@ Commit message\n>          rules. This will make subsequent commits easier to follow, as we'll be\n>          applying these rules on a header-by-header basis.\n>      \n>     +    Once we've fully applied \"the_repository.pending.cocci\" we'll keep\n>     +    this rules around for a while in \"the_repository.cocci\", to help any\n>     +    outstanding topics and out-of-tree code to resolve textual or semantic\n>     +    conflicts with these changes, but eventually we'll remove the\n>     +    \"the_repository.cocci\" as a follow-up.\n>     +\n>     +    So even if some of these functions are subsequently moved and/or split\n>     +    into other or new headers there's no risk of this becoming stale, if\n>     +    and when that happens the we should be removing these rules anyway.\n>     +\n>          Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>      \n>       ## contrib/coccinelle/the_repository.pending.cocci ##\n\nAfter removing the rebase noise from later steps, the above two are\nthe real changes compared to the previous round.\n\nAre people happy with the result?  I think the previous round was\nboth read carefully on the central piece of the series, with some\nspot checks to mechanical parts, and with the above clarification\nthe series is ready to be merged down to 'next'.\n\nIf I am grossly off base in the above assessment, please holler\nsoonish.  Thanks.\n"},{"id":"474423","messageId":"ZCShBL5TRLnQLh0C@nand.local","threadId":"59404","inReplyTo":"patch-v2-02.17-5ac9d5b8905-20230328T110946Z-avarab@gmail.com","subject":"Re: [PATCH v2 02/17] cocci: fix incorrect & verbose \"the_repository\" rules","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-03-29T20:35:16Z","receivedAt":"2023-03-29T20:35:22Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Tue, Mar 28, 2023 at 03:58:43PM +0200, Ævar Arnfjörð Bjarmason wrote:\n>  .../coccinelle/the_repository.pending.cocci   | 160 +++++-------------\n>  1 file changed, 46 insertions(+), 114 deletions(-)\n\nI resonate with Elijah's \"I know nothing about Coccinelle\" statement in\nv1 of this patch more than I am willing to admit ;-).\n\nI am glad that Coccinelle has some better tools for us to more easily\nexpress these macros. The end-result is very nice and has a clear\ninterpretation.\n\nThanks for cleaning these up.\n\nThanks,\nTaylor\n"},{"id":"474424","messageId":"ZCSkjFyoK45Yr2Po@nand.local","threadId":"59404","inReplyTo":"patch-v2-16.17-f947bb69dee-20230328T110947Z-avarab@gmail.com","subject":"Re: [PATCH v2 16/17] post-cocci: adjust comments for recent repo_* migration","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-03-29T20:50:20Z","receivedAt":"2023-03-29T20:50:25Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Tue, Mar 28, 2023 at 03:58:57PM +0200, Ævar Arnfjörð Bjarmason wrote:\n> In preceding commits we changed many calls to macros that were\n> providing a \"the_repository\" argument to invoke corresponding repo_*()\n> function instead. Let's follow-up and adjust references to those in\n> comments, which coccinelle didn't (and inherently can't) catch.\n\nThanks for being extra meticulous here.\n\nDid you write a script to catch any of these? Asking partly to satisfy\nmy own curiosity, but I also think that it might be worth including in\nthis patch if you did do something other than manual inspection.\n\nThanks,\nTaylor\n"},{"id":"474427","messageId":"ZCS2ATJLvffFk8uL@nand.local","threadId":"59404","inReplyTo":"xmqq355n9y9m.fsf@gitster.g","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-03-29T22:04:49Z","receivedAt":"2023-03-29T22:04:56Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Wed, Mar 29, 2023 at 12:02:29PM -0700, Junio C Hamano wrote:\n> Are people happy with the result?  I think the previous round was\n> both read carefully on the central piece of the series, with some\n> spot checks to mechanical parts, and with the above clarification\n> the series is ready to be merged down to 'next'.\n\nI didn't review v1, so take this email with a grain of salt, but I am\nhappy with the current round and would be happy to see it go to 'next'.\n\nThanks,\nTaylor\n"},{"id":"474441","messageId":"CABPp-BEzykyoFLVkftsQ-+AXs4y6hQDm2CRy3+kROq0gcinYnA@mail.gmail.com","threadId":"59404","inReplyTo":"xmqq355n9y9m.fsf@gitster.g","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-30T03:55:00Z","receivedAt":"2023-03-30T03:56:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Mar 29, 2023 at 12:02 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n> >  1:  c167bde3c0c !  1:  e1e27490d60 cocci: remove dead rule from \"the_repository.pending.cocci\"\n> >     @@ Commit message\n> >          cocci: remove dead rule from \"the_repository.pending.cocci\"\n> >\n> >          The \"parse_commit_gently\" macro went away in [1], so we don't need to\n> >     -    carry his for its migration.\n> >     +    carry this for its migration.\n> >\n> >          1. ea3f7e598c8 (revision: use repository from rev_info when parsing\n> >             commits, 2020-06-23)\n> >  2:  1b1fc5d41f5 =  2:  5ac9d5b8905 cocci: fix incorrect & verbose \"the_repository\" rules\n> >  3:  34c6b8afd6c !  3:  a3fcd19d744 cocci: sort \"the_repository\" rules by header\n> >     @@ Commit message\n> >          rules. This will make subsequent commits easier to follow, as we'll be\n> >          applying these rules on a header-by-header basis.\n> >\n> >     +    Once we've fully applied \"the_repository.pending.cocci\" we'll keep\n> >     +    this rules around for a while in \"the_repository.cocci\", to help any\n> >     +    outstanding topics and out-of-tree code to resolve textual or semantic\n> >     +    conflicts with these changes, but eventually we'll remove the\n> >     +    \"the_repository.cocci\" as a follow-up.\n> >     +\n> >     +    So even if some of these functions are subsequently moved and/or split\n> >     +    into other or new headers there's no risk of this becoming stale, if\n> >     +    and when that happens the we should be removing these rules anyway.\n> >     +\n> >          Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> >\n> >       ## contrib/coccinelle/the_repository.pending.cocci ##\n>\n> After removing the rebase noise from later steps, the above two are\n> the real changes compared to the previous round.\n>\n> Are people happy with the result?  I think the previous round was\n> both read carefully on the central piece of the series, with some\n> spot checks to mechanical parts, and with the above clarification\n> the series is ready to be merged down to 'next'.\n>\n> If I am grossly off base in the above assessment, please holler\n> soonish.  Thanks.\n\nThese two changes address the only minor points I had with the series.\nMy other comments were either being happy about the changes, or noting\nsome other things outside the scope of this series that would also be\nnice to cleanup.  So I'm happy with merging down.\n"},{"id":"474471","messageId":"kl6la5zucdt4.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59404","inReplyTo":"xmqq355n9y9m.fsf@gitster.g","subject":"Re: [PATCH v2 00/17] cocci: remove \"the_repository\" wrapper macros","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-03-30T18:08:23Z","receivedAt":"2023-03-30T18:08:32Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>>     +    Once we've fully applied \"the_repository.pending.cocci\" we'll keep\n>>     +    this rules around for a while in \"the_repository.cocci\", to help any\n>>     +    outstanding topics and out-of-tree code to resolve textual or semantic\n>>     +    conflicts with these changes, but eventually we'll remove the\n>>     +    \"the_repository.cocci\" as a follow-up.\n>>     +\n>>     +    So even if some of these functions are subsequently moved and/or split\n>>     +    into other or new headers there's no risk of this becoming stale, if\n>>     +    and when that happens the we should be removing these rules anyway.\n>>     +\n>>          Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>\n> Are people happy with the result?  I think the previous round was\n> both read carefully on the central piece of the series, with some\n> spot checks to mechanical parts, and with the above clarification\n> the series is ready to be merged down to 'next'.\n\nLikewise, I'm also happy to see this merged to 'next'.\n\nMy comments on v1 were sanity-checking how we use coccinelle in this\nseries, not any actual objection :)\n"}]}