{"thread":{"id":"47941","subject":"[PATCH 00/11] Moving global state into the repository object (part 2)","startedAt":"2018-02-28T01:06:19Z","lastAt":"2018-02-28T19:19:43Z","messageCount":23,"participants":["Stefan Beller","Duy Nguyen","Derrick Stolee","Junio C Hamano","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":11},"messages":[{"id":"340504","messageId":"20180228010608.215505-1-sbeller@google.com","threadId":"47941","inReplyTo":null,"subject":"[PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:05:57Z","receivedAt":"2018-02-28T01:06:19Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"This applies on top of origin/sb/object-store and is the continuation of\nthat series, adding the repository as a context argument to functions.\n\nThis series focusses on packfile handling, exposing (re)prepare_packed_git\nand find_pack_entry to a repository argument.\n\nLooking at the diffstat of \"Delete ignore_env member in struct repository\"[1]\nand \"Fix initializing the_hash_algo\"[2], which also build on origin/sb/object-store, \nthis series looks rather orthogonal to those, so I would not a lot of merge\nconflicts.\n\n[1] https://public-inbox.org/git/20180227095846.9238-1-pclouds@gmail.com/\n[2] https://public-inbox.org/git/20180225111840.16421-1-pclouds@gmail.com/\n\nThe third series (after this one) will focus on object replacement,\nsuch that we can migrate sha1_object_info_extended at the end of the\nthird series.\n\nThanks,\nStefan\n\nStefan Beller (11):\n  packfile: allow prepare_packed_git_mru to handle arbitrary\n    repositories\n  packfile: allow rearrange_packed_git to handle arbitrary repositories\n  packfile: allow install_packed_git to handle arbitrary repositories\n  packfile: add repository argument to prepare_packed_git_one\n  packfile: add repository argument to prepare_packed_git\n  packfile: add repository argument to reprepare_packed_git\n  packfile: allow prepare_packed_git_one to handle arbitrary\n    repositories\n  packfile: allow prepare_packed_git to handle arbitrary repositories\n  packfile: allow reprepare_packed_git to handle arbitrary repositories\n  packfile: add repository argument to find_pack_entry\n  packfile: allow find_pack_entry to handle arbitrary repositories\n\n builtin/count-objects.c  |  2 +-\n builtin/fsck.c           |  2 +-\n builtin/gc.c             |  4 +--\n builtin/pack-objects.c   |  2 +-\n builtin/pack-redundant.c |  2 +-\n builtin/receive-pack.c   |  3 +-\n bulk-checkin.c           |  3 +-\n fast-import.c            |  4 +--\n fetch-pack.c             |  3 +-\n http-backend.c           |  2 +-\n http.c                   |  2 +-\n pack-bitmap.c            |  2 +-\n packfile.c               | 72 +++++++++++++++++++---------------------\n packfile.h               | 12 ++++---\n server-info.c            |  2 +-\n sha1_file.c              |  8 ++---\n sha1_name.c              |  4 +--\n 17 files changed, 66 insertions(+), 63 deletions(-)\n\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340505","messageId":"20180228010608.215505-2-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 01/11] packfile: allow prepare_packed_git_mru to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:05:58Z","receivedAt":"2018-02-28T01:06:22Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"This conversion was done without the #define trick used in the earlier\nseries refactoring to have better repository access, because this function\nis easy to review, as all lines are converted and it has only one caller\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex ccfe084642b..b844b653265 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -873,14 +873,14 @@ static void rearrange_packed_git(void)\n \t\tset_next_packed_git, sort_pack);\n }\n \n-static void prepare_packed_git_mru(void)\n+static void prepare_packed_git_mru(struct repository *r)\n {\n \tstruct packed_git *p;\n \n-\tINIT_LIST_HEAD(&the_repository->objects.packed_git_mru);\n+\tINIT_LIST_HEAD(&r->objects.packed_git_mru);\n \n-\tfor (p = the_repository->objects.packed_git; p; p = p->next)\n-\t\tlist_add_tail(&p->mru, &the_repository->objects.packed_git_mru);\n+\tfor (p = r->objects.packed_git; p; p = p->next)\n+\t\tlist_add_tail(&p->mru, &r->objects.packed_git_mru);\n }\n \n void prepare_packed_git(void)\n@@ -894,7 +894,7 @@ void prepare_packed_git(void)\n \tfor (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next)\n \t\tprepare_packed_git_one(alt->path, 0);\n \trearrange_packed_git();\n-\tprepare_packed_git_mru();\n+\tprepare_packed_git_mru(the_repository);\n \tthe_repository->objects.packed_git_initialized = 1;\n }\n \n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340506","messageId":"20180228010608.215505-3-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 02/11] packfile: allow rearrange_packed_git to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:05:59Z","receivedAt":"2018-02-28T01:06:23Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex b844b653265..5ccce419354 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -866,10 +866,10 @@ static int sort_pack(const void *a_, const void *b_)\n \treturn -1;\n }\n \n-static void rearrange_packed_git(void)\n+static void rearrange_packed_git(struct repository *r)\n {\n-\tthe_repository->objects.packed_git = llist_mergesort(\n-\t\tthe_repository->objects.packed_git, get_next_packed_git,\n+\tr->objects.packed_git = llist_mergesort(\n+\t\tr->objects.packed_git, get_next_packed_git,\n \t\tset_next_packed_git, sort_pack);\n }\n \n@@ -893,7 +893,7 @@ void prepare_packed_git(void)\n \tprepare_alt_odb(the_repository);\n \tfor (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next)\n \t\tprepare_packed_git_one(alt->path, 0);\n-\trearrange_packed_git();\n+\trearrange_packed_git(the_repository);\n \tprepare_packed_git_mru(the_repository);\n \tthe_repository->objects.packed_git_initialized = 1;\n }\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340507","messageId":"20180228010608.215505-4-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 03/11] packfile: allow install_packed_git to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:00Z","receivedAt":"2018-02-28T01:06:26Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"This conversion was done without the #define trick used in the earlier\nseries refactoring to have better repository access, because this function\nis easy to review, as it only has one caller and all lines but the first\ntwo are converted.\n\nWe must not convert 'pack_open_fds' to be a repository specific variable,\nas it is used to monitor resource usage of the machine that Git executes\non.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n fast-import.c | 2 +-\n http.c        | 2 +-\n packfile.c    | 8 ++++----\n packfile.h    | 2 +-\n 4 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex 1685fe59a20..67550584da4 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1038,7 +1038,7 @@ static void end_packfile(void)\n \t\tif (!new_p)\n \t\t\tdie(\"core git rejected index %s\", idx_name);\n \t\tall_packs[pack_id] = new_p;\n-\t\tinstall_packed_git(new_p);\n+\t\tinstall_packed_git(the_repository, new_p);\n \t\tfree(idx_name);\n \n \t\t/* Print the boundary */\ndiff --git a/http.c b/http.c\nindex afe2707e86b..f3c2302f84b 100644\n--- a/http.c\n+++ b/http.c\n@@ -2134,7 +2134,7 @@ int finish_http_pack_request(struct http_pack_request *preq)\n \t\treturn -1;\n \t}\n \n-\tinstall_packed_git(p);\n+\tinstall_packed_git(the_repository, p);\n \tfree(tmp_idx);\n \treturn 0;\n }\ndiff --git a/packfile.c b/packfile.c\nindex 5ccce419354..1c24b02cc84 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -680,13 +680,13 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local)\n \treturn p;\n }\n \n-void install_packed_git(struct packed_git *pack)\n+void install_packed_git(struct repository *r, struct packed_git *pack)\n {\n \tif (pack->pack_fd != -1)\n \t\tpack_open_fds++;\n \n-\tpack->next = the_repository->objects.packed_git;\n-\tthe_repository->objects.packed_git = pack;\n+\tpack->next = r->objects.packed_git;\n+\tr->objects.packed_git = pack;\n }\n \n void (*report_garbage)(unsigned seen_bits, const char *path);\n@@ -782,7 +782,7 @@ static void prepare_packed_git_one(char *objdir, int local)\n \t\t\t     * corresponding .pack file that we can map.\n \t\t\t     */\n \t\t\t    (p = add_packed_git(path.buf, path.len, local)) != NULL)\n-\t\t\t\tinstall_packed_git(p);\n+\t\t\t\tinstall_packed_git(the_repository, p);\n \t\t}\n \n \t\tif (!report_garbage)\ndiff --git a/packfile.h b/packfile.h\nindex 6a2c57045ca..cc3bf67ab50 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -36,7 +36,7 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n extern void prepare_packed_git(void);\n extern void reprepare_packed_git(void);\n-extern void install_packed_git(struct packed_git *pack);\n+extern void install_packed_git(struct repository *r, struct packed_git *pack);\n \n /*\n  * Give a rough count of objects in the repository. This sacrifices accuracy\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340508","messageId":"20180228010608.215505-6-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 05/11] packfile: add repository argument to prepare_packed_git","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:02Z","receivedAt":"2018-02-28T01:06:28Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Add a repository argument to allow prepare_packed_git callers to\nbe more specific about which repository to handle. See c28d027a52c\n(sha1_file: add repository argument to link_alt_odb_entry, 2018-02-20)\nfor an explanation of the #define trick.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n builtin/count-objects.c  |  2 +-\n builtin/fsck.c           |  2 +-\n builtin/gc.c             |  2 +-\n builtin/pack-objects.c   |  2 +-\n builtin/pack-redundant.c |  2 +-\n fast-import.c            |  2 +-\n http-backend.c           |  2 +-\n pack-bitmap.c            |  2 +-\n packfile.c               | 10 +++++-----\n packfile.h               |  3 ++-\n server-info.c            |  2 +-\n sha1_name.c              |  4 ++--\n 12 files changed, 18 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 9334648dccf..b262327bf6d 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -123,7 +123,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf pack_buf = STRBUF_INIT;\n \t\tstruct strbuf garbage_buf = STRBUF_INIT;\n \t\tif (!the_repository->objects.packed_git)\n-\t\t\tprepare_packed_git();\n+\t\t\tprepare_packed_git(the_repository);\n \t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\t\tif (!p->pack_local)\n \t\t\t\tcontinue;\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 76c94e9b5af..27f580352c5 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -727,7 +727,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \t\t\tuint32_t total = 0, count = 0;\n \t\t\tstruct progress *progress = NULL;\n \n-\t\t\tprepare_packed_git();\n+\t\t\tprepare_packed_git(the_repository);\n \n \t\t\tif (show_progress) {\n \t\t\t\tfor (p = the_repository->objects.packed_git; p;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 96ff7908677..97f34ae9fe0 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -174,7 +174,7 @@ static int too_many_packs(void)\n \tif (gc_auto_pack_limit <= 0)\n \t\treturn 0;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (cnt = 0, p = the_repository->objects.packed_git; p; p = p->next) {\n \t\tif (!p->pack_local)\n \t\t\tcontinue;\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 7f376c2aefb..84e940a53ba 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -3151,7 +3151,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \tif (progress && all_progress_implied)\n \t\tprogress = 2;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tif (ignore_packed_keep) {\n \t\tstruct packed_git *p;\n \t\tfor (p = the_repository->objects.packed_git; p; p = p->next)\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex 55462bc826a..83d2395dae9 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -631,7 +631,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)\n \t\t\tbreak;\n \t}\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \n \tif (load_all_packs)\n \t\tload_all();\ndiff --git a/fast-import.c b/fast-import.c\nindex 67550584da4..39cd0b7540d 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -3471,7 +3471,7 @@ int cmd_main(int argc, const char **argv)\n \t\trc_free[i].next = &rc_free[i + 1];\n \trc_free[cmd_save - 1].next = NULL;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tstart_packfile();\n \tset_die_routine(die_nicely);\n \tset_checkpoint_signal();\ndiff --git a/http-backend.c b/http-backend.c\nindex 4d93126c15f..4950078c936 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -519,7 +519,7 @@ static void get_info_packs(struct strbuf *hdr, char *arg)\n \tsize_t cnt = 0;\n \n \tselect_getanyfile(hdr);\n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\tif (p->pack_local)\n \t\t\tcnt++;\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex d51172b1d5b..273bdfb631f 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -336,7 +336,7 @@ static int open_pack_bitmap(void)\n \n \tassert(!bitmap_git.map && !bitmap_git.loaded);\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\tif (open_pack_bitmap_1(p) == 0)\n \t\t\tret = 0;\ndiff --git a/packfile.c b/packfile.c\nindex 8bb158fc84e..6e8b98ab405 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -817,7 +817,7 @@ unsigned long approximate_object_count(void)\n \t\tunsigned long count;\n \t\tstruct packed_git *p;\n \n-\t\tprepare_packed_git();\n+\t\tprepare_packed_git(the_repository);\n \t\tcount = 0;\n \t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\t\tif (open_pack_index(p))\n@@ -884,7 +884,7 @@ static void prepare_packed_git_mru(struct repository *r)\n \t\tlist_add_tail(&p->mru, &r->objects.packed_git_mru);\n }\n \n-void prepare_packed_git(void)\n+void prepare_packed_git_the_repository(void)\n {\n \tstruct alternate_object_database *alt;\n \n@@ -903,7 +903,7 @@ void reprepare_packed_git(void)\n {\n \tthe_repository->objects.approximate_object_count_valid = 0;\n \tthe_repository->objects.packed_git_initialized = 0;\n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n }\n \n unsigned long unpack_object_header_buffer(const unsigned char *buf,\n@@ -1844,7 +1844,7 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)\n {\n \tstruct list_head *pos;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tif (!the_repository->objects.packed_git)\n \t\treturn 0;\n \n@@ -1897,7 +1897,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)\n \tint r = 0;\n \tint pack_errors = 0;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\tif ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)\n \t\t\tcontinue;\ndiff --git a/packfile.h b/packfile.h\nindex cc3bf67ab50..39eb590b2ae 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -34,7 +34,8 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_\n #define PACKDIR_FILE_GARBAGE 4\n extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n-extern void prepare_packed_git(void);\n+#define prepare_packed_git(r) prepare_packed_git_##r()\n+extern void prepare_packed_git_the_repository(void);\n extern void reprepare_packed_git(void);\n extern void install_packed_git(struct repository *r, struct packed_git *pack);\n \ndiff --git a/server-info.c b/server-info.c\nindex 96885c45f64..6cd1506e5e3 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -201,7 +201,7 @@ static void init_pack_info(const char *infofile, int force)\n \tobjdir = get_object_directory();\n \tobjdirlen = strlen(objdir);\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n \t\t/* we ignore things on alternate path since they are\n \t\t * not available to the pullers in general.\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 3e490ee8f62..d3769713ea0 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -196,7 +196,7 @@ static void find_short_packed_object(struct disambiguate_state *ds)\n {\n \tstruct packed_git *p;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p && !ds->ambiguous;\n \t     p = p->next)\n \t\tunique_in_pack(p, ds);\n@@ -567,7 +567,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)\n {\n \tstruct packed_git *p;\n \n-\tprepare_packed_git();\n+\tprepare_packed_git(the_repository);\n \tfor (p = the_repository->objects.packed_git; p; p = p->next)\n \t\tfind_abbrev_len_for_pack(p, mad);\n }\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340509","messageId":"20180228010608.215505-8-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 07/11] packfile: allow prepare_packed_git_one to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:04Z","receivedAt":"2018-02-28T01:06:30Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex 6ea50230aab..c45516acd41 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -735,8 +735,7 @@ static void report_pack_garbage(struct string_list *list)\n \treport_helper(list, seen_bits, first, list->nr);\n }\n \n-#define prepare_packed_git_one(r, o, l) prepare_packed_git_one_##r(o, l)\n-static void prepare_packed_git_one_the_repository(char *objdir, int local)\n+static void prepare_packed_git_one(struct repository *r, char *objdir, int local)\n {\n \tstruct strbuf path = STRBUF_INIT;\n \tsize_t dirnamelen;\n@@ -769,7 +768,7 @@ static void prepare_packed_git_one_the_repository(char *objdir, int local)\n \t\tbase_len = path.len;\n \t\tif (strip_suffix_mem(path.buf, &base_len, \".idx\")) {\n \t\t\t/* Don't reopen a pack we already have. */\n-\t\t\tfor (p = the_repository->objects.packed_git; p;\n+\t\t\tfor (p = r->objects.packed_git; p;\n \t\t\t     p = p->next) {\n \t\t\t\tsize_t len;\n \t\t\t\tif (strip_suffix(p->pack_name, \".pack\", &len) &&\n@@ -783,7 +782,7 @@ static void prepare_packed_git_one_the_repository(char *objdir, int local)\n \t\t\t     * corresponding .pack file that we can map.\n \t\t\t     */\n \t\t\t    (p = add_packed_git(path.buf, path.len, local)) != NULL)\n-\t\t\t\tinstall_packed_git(the_repository, p);\n+\t\t\t\tinstall_packed_git(r, p);\n \t\t}\n \n \t\tif (!report_garbage)\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340510","messageId":"20180228010608.215505-9-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 08/11] packfile: allow prepare_packed_git to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:05Z","receivedAt":"2018-02-28T01:06:33Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 18 +++++++++---------\n packfile.h |  3 +--\n 2 files changed, 10 insertions(+), 11 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex c45516acd41..9a3efc01555 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -883,19 +883,19 @@ static void prepare_packed_git_mru(struct repository *r)\n \t\tlist_add_tail(&p->mru, &r->objects.packed_git_mru);\n }\n \n-void prepare_packed_git_the_repository(void)\n+void prepare_packed_git(struct repository *r)\n {\n \tstruct alternate_object_database *alt;\n \n-\tif (the_repository->objects.packed_git_initialized)\n+\tif (r->objects.packed_git_initialized)\n \t\treturn;\n-\tprepare_packed_git_one(the_repository, get_object_directory(), 1);\n-\tprepare_alt_odb(the_repository);\n-\tfor (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next)\n-\t\tprepare_packed_git_one(the_repository, alt->path, 0);\n-\trearrange_packed_git(the_repository);\n-\tprepare_packed_git_mru(the_repository);\n-\tthe_repository->objects.packed_git_initialized = 1;\n+\tprepare_packed_git_one(r, get_object_directory(), 1);\n+\tprepare_alt_odb(r);\n+\tfor (alt = r->objects.alt_odb_list; alt; alt = alt->next)\n+\t\tprepare_packed_git_one(r, alt->path, 0);\n+\trearrange_packed_git(r);\n+\tprepare_packed_git_mru(r);\n+\tr->objects.packed_git_initialized = 1;\n }\n \n void reprepare_packed_git_the_repository(void)\ndiff --git a/packfile.h b/packfile.h\nindex 9afbf73657e..9142866c8ae 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -34,8 +34,7 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_\n #define PACKDIR_FILE_GARBAGE 4\n extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n-#define prepare_packed_git(r) prepare_packed_git_##r()\n-extern void prepare_packed_git_the_repository(void);\n+extern void prepare_packed_git(struct repository *r);\n #define reprepare_packed_git(r) reprepare_packed_git_##r()\n extern void reprepare_packed_git_the_repository(void);\n extern void install_packed_git(struct repository *r, struct packed_git *pack);\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340511","messageId":"20180228010608.215505-7-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 06/11] packfile: add repository argument to reprepare_packed_git","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:03Z","receivedAt":"2018-02-28T01:06:36Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"See previous patch for explanation.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n builtin/gc.c           | 2 +-\n builtin/receive-pack.c | 3 ++-\n bulk-checkin.c         | 3 ++-\n fetch-pack.c           | 3 ++-\n packfile.c             | 2 +-\n packfile.h             | 3 ++-\n sha1_file.c            | 2 +-\n 7 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 97f34ae9fe0..c16020ef42a 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -478,7 +478,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \t\treturn error(FAILED_RUN, rerere.argv[0]);\n \n \treport_garbage = report_pack_garbage;\n-\treprepare_packed_git();\n+\treprepare_packed_git(the_repository);\n \tif (pack_garbage.nr > 0)\n \t\tclean_pack_garbage();\n \ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 954fc72c7cb..8b03a6e03dc 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"repository.h\"\n #include \"config.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\n@@ -1778,7 +1779,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)\n \t\tstatus = finish_command(&child);\n \t\tif (status)\n \t\t\treturn \"index-pack abnormal exit\";\n-\t\treprepare_packed_git();\n+\t\treprepare_packed_git(the_repository);\n \t}\n \treturn NULL;\n }\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 3310fd210a1..eadc2d51720 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n+#include \"repository.h\"\n #include \"csum-file.h\"\n #include \"pack.h\"\n #include \"strbuf.h\"\n@@ -57,7 +58,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)\n \n \tstrbuf_release(&packname);\n \t/* Make objects we just wrote available to ourselves */\n-\treprepare_packed_git();\n+\treprepare_packed_git(the_repository);\n }\n \n static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 8253d746e0c..eac5928a27b 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"repository.h\"\n #include \"config.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\n@@ -1192,7 +1193,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,\n \tprepare_shallow_info(&si, shallow);\n \tref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,\n \t\t\t\t&si, pack_lockfile);\n-\treprepare_packed_git();\n+\treprepare_packed_git(the_repository);\n \tupdate_shallow(args, sought, nr_sought, &si);\n \tclear_shallow_info(&si);\n \treturn ref_cpy;\ndiff --git a/packfile.c b/packfile.c\nindex 6e8b98ab405..6ea50230aab 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -899,7 +899,7 @@ void prepare_packed_git_the_repository(void)\n \tthe_repository->objects.packed_git_initialized = 1;\n }\n \n-void reprepare_packed_git(void)\n+void reprepare_packed_git_the_repository(void)\n {\n \tthe_repository->objects.approximate_object_count_valid = 0;\n \tthe_repository->objects.packed_git_initialized = 0;\ndiff --git a/packfile.h b/packfile.h\nindex 39eb590b2ae..9afbf73657e 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -36,7 +36,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n #define prepare_packed_git(r) prepare_packed_git_##r()\n extern void prepare_packed_git_the_repository(void);\n-extern void reprepare_packed_git(void);\n+#define reprepare_packed_git(r) reprepare_packed_git_##r()\n+extern void reprepare_packed_git_the_repository(void);\n extern void install_packed_git(struct repository *r, struct packed_git *pack);\n \n /*\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 36282acb1a8..0b9fefaaf02 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1281,7 +1281,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\treturn 0;\n \n \t\t/* Not a loose object; someone else may have just packed it. */\n-\t\treprepare_packed_git();\n+\t\treprepare_packed_git(the_repository);\n \t\tif (find_pack_entry(real, &e))\n \t\t\tbreak;\n \n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340512","messageId":"20180228010608.215505-12-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 11/11] packfile: allow find_pack_entry to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:08Z","receivedAt":"2018-02-28T01:06:39Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 10 +++++-----\n packfile.h |  3 +--\n 2 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex e16f8252233..399c59e640f 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1835,18 +1835,18 @@ static int fill_pack_entry(const unsigned char *sha1,\n \treturn 1;\n }\n \n-int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e)\n+int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e)\n {\n \tstruct list_head *pos;\n \n-\tprepare_packed_git(the_repository);\n-\tif (!the_repository->objects.packed_git)\n+\tprepare_packed_git(r);\n+\tif (!r->objects.packed_git)\n \t\treturn 0;\n \n-\tlist_for_each(pos, &the_repository->objects.packed_git_mru) {\n+\tlist_for_each(pos, &r->objects.packed_git_mru) {\n \t\tstruct packed_git *p = list_entry(pos, struct packed_git, mru);\n \t\tif (fill_pack_entry(sha1, e, p)) {\n-\t\t\tlist_move(&p->mru, &the_repository->objects.packed_git_mru);\n+\t\t\tlist_move(&p->mru, &r->objects.packed_git_mru);\n \t\t\treturn 1;\n \t\t}\n \t}\ndiff --git a/packfile.h b/packfile.h\nindex feeabd6f031..6f7b9e91d66 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -124,8 +124,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);\n  * Iff a pack file in the given repository contains the object named by sha1,\n  * return true and store its location to e.\n  */\n-#define find_pack_entry(r, s, e) find_pack_entry_##r(s, e)\n-extern int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e);\n+extern int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e);\n \n extern int has_sha1_pack(const unsigned char *sha1);\n \n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340513","messageId":"20180228010608.215505-5-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 04/11] packfile: add repository argument to prepare_packed_git_one","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:01Z","receivedAt":"2018-02-28T01:06:45Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex 1c24b02cc84..8bb158fc84e 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -735,7 +735,8 @@ static void report_pack_garbage(struct string_list *list)\n \treport_helper(list, seen_bits, first, list->nr);\n }\n \n-static void prepare_packed_git_one(char *objdir, int local)\n+#define prepare_packed_git_one(r, o, l) prepare_packed_git_one_##r(o, l)\n+static void prepare_packed_git_one_the_repository(char *objdir, int local)\n {\n \tstruct strbuf path = STRBUF_INIT;\n \tsize_t dirnamelen;\n@@ -889,10 +890,10 @@ void prepare_packed_git(void)\n \n \tif (the_repository->objects.packed_git_initialized)\n \t\treturn;\n-\tprepare_packed_git_one(get_object_directory(), 1);\n+\tprepare_packed_git_one(the_repository, get_object_directory(), 1);\n \tprepare_alt_odb(the_repository);\n \tfor (alt = the_repository->objects.alt_odb_list; alt; alt = alt->next)\n-\t\tprepare_packed_git_one(alt->path, 0);\n+\t\tprepare_packed_git_one(the_repository, alt->path, 0);\n \trearrange_packed_git(the_repository);\n \tprepare_packed_git_mru(the_repository);\n \tthe_repository->objects.packed_git_initialized = 1;\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340514","messageId":"20180228010608.215505-10-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 09/11] packfile: allow reprepare_packed_git to handle arbitrary repositories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:06Z","receivedAt":"2018-02-28T01:06:47Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c | 8 ++++----\n packfile.h | 3 +--\n 2 files changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex 9a3efc01555..b12fc0789e0 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -898,11 +898,11 @@ void prepare_packed_git(struct repository *r)\n \tr->objects.packed_git_initialized = 1;\n }\n \n-void reprepare_packed_git_the_repository(void)\n+void reprepare_packed_git(struct repository *r)\n {\n-\tthe_repository->objects.approximate_object_count_valid = 0;\n-\tthe_repository->objects.packed_git_initialized = 0;\n-\tprepare_packed_git(the_repository);\n+\tr->objects.approximate_object_count_valid = 0;\n+\tr->objects.packed_git_initialized = 0;\n+\tprepare_packed_git(r);\n }\n \n unsigned long unpack_object_header_buffer(const unsigned char *buf,\ndiff --git a/packfile.h b/packfile.h\nindex 9142866c8ae..99f4741bd95 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -35,8 +35,7 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_\n extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n extern void prepare_packed_git(struct repository *r);\n-#define reprepare_packed_git(r) reprepare_packed_git_##r()\n-extern void reprepare_packed_git_the_repository(void);\n+extern void reprepare_packed_git(struct repository *r);\n extern void install_packed_git(struct repository *r, struct packed_git *pack);\n \n /*\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340515","messageId":"20180228010608.215505-11-sbeller@google.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"[PATCH 10/11] packfile: add repository argument to find_pack_entry","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T01:06:07Z","receivedAt":"2018-02-28T01:07:00Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"While at it move the documentation to the header and mention which pack\nfiles are searched.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n packfile.c  | 8 ++------\n packfile.h  | 7 ++++++-\n sha1_file.c | 6 +++---\n 3 files changed, 11 insertions(+), 10 deletions(-)\n\ndiff --git a/packfile.c b/packfile.c\nindex b12fc0789e0..e16f8252233 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1835,11 +1835,7 @@ static int fill_pack_entry(const unsigned char *sha1,\n \treturn 1;\n }\n \n-/*\n- * Iff a pack file contains the object named by sha1, return true and\n- * store its location to e.\n- */\n-int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)\n+int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e)\n {\n \tstruct list_head *pos;\n \n@@ -1860,7 +1856,7 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)\n int has_sha1_pack(const unsigned char *sha1)\n {\n \tstruct pack_entry e;\n-\treturn find_pack_entry(sha1, &e);\n+\treturn find_pack_entry(the_repository, sha1, &e);\n }\n \n int has_pack_index(const unsigned char *sha1)\ndiff --git a/packfile.h b/packfile.h\nindex 99f4741bd95..feeabd6f031 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -120,7 +120,12 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje\n extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);\n extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);\n \n-extern int find_pack_entry(const unsigned char *sha1, struct pack_entry *e);\n+/*\n+ * Iff a pack file in the given repository contains the object named by sha1,\n+ * return true and store its location to e.\n+ */\n+#define find_pack_entry(r, s, e) find_pack_entry_##r(s, e)\n+extern int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e);\n \n extern int has_sha1_pack(const unsigned char *sha1);\n \ndiff --git a/sha1_file.c b/sha1_file.c\nindex 0b9fefaaf02..d498b3e90b9 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1273,7 +1273,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t}\n \n \twhile (1) {\n-\t\tif (find_pack_entry(real, &e))\n+\t\tif (find_pack_entry(the_repository, real, &e))\n \t\t\tbreak;\n \n \t\t/* Most likely it's a loose object. */\n@@ -1282,7 +1282,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \n \t\t/* Not a loose object; someone else may have just packed it. */\n \t\treprepare_packed_git(the_repository);\n-\t\tif (find_pack_entry(real, &e))\n+\t\tif (find_pack_entry(the_repository, real, &e))\n \t\t\tbreak;\n \n \t\t/* Check if it is a missing object */\n@@ -1662,7 +1662,7 @@ static int freshen_loose_object(const unsigned char *sha1)\n static int freshen_packed_object(const unsigned char *sha1)\n {\n \tstruct pack_entry e;\n-\tif (!find_pack_entry(sha1, &e))\n+\tif (!find_pack_entry(the_repository, sha1, &e))\n \t\treturn 0;\n \tif (e.p->freshened)\n \t\treturn 1;\n-- \n2.16.2.395.g2e18187dfd-goog\n\n"},{"id":"340528","messageId":"20180228021530.GA20625@duynguyen.dek-tpc.internal","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-02-28T02:15:30Z","receivedAt":"2018-02-28T02:15:51Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Feb 27, 2018 at 05:05:57PM -0800, Stefan Beller wrote:\n> This applies on top of origin/sb/object-store and is the continuation of\n> that series, adding the repository as a context argument to functions.\n> \n> This series focusses on packfile handling, exposing (re)prepare_packed_git\n> and find_pack_entry to a repository argument.\n\nIt looks good.\n\nLooking at the full-series diff though, it makes me wonder if we\nshould keep prepare_packed_git() private (i.e. how we initialize the\nobject store, packfile included, is a private matter). How about\nsomething like this on top?\n\n-- 8< --\nSubject: [PATCH] packfile: keep raw_object_store.packed_git{,_mru} fields private\n\nThese fields are initialized lazily via prepare_packed_git(). All\naccess to these must call that function first but unless you know the\nimplementation details, you may not see the connection.\n\nKeep that connection internal. These fields should only be accessed\nvia get_packed_git() and get_packed_git_mru() outside packfile.c.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/count-objects.c  |  4 +---\n builtin/fsck.c           |  6 ++----\n builtin/gc.c             |  3 +--\n builtin/pack-objects.c   | 21 +++++++++++----------\n builtin/pack-redundant.c |  6 ++----\n fast-import.c            |  7 ++-----\n http-backend.c           |  5 ++---\n object-store.h           |  4 ++--\n pack-bitmap.c            |  3 +--\n packfile.c               | 15 ++++++++++++++-\n packfile.h               |  6 +++++-\n server-info.c            |  5 ++---\n sha1_name.c              |  6 ++----\n 13 files changed, 47 insertions(+), 44 deletions(-)\n\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex d480301763..088309945b 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -121,9 +121,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf loose_buf = STRBUF_INIT;\n \t\tstruct strbuf pack_buf = STRBUF_INIT;\n \t\tstruct strbuf garbage_buf = STRBUF_INIT;\n-\t\tif (!the_repository->objects.packed_git)\n-\t\t\tprepare_packed_git(the_repository);\n-\t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\t\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\t\tif (!p->pack_local)\n \t\t\t\tcontinue;\n \t\t\tif (open_pack_index(p))\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 0a043a43c2..6d86f2581a 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -732,10 +732,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \t\t\tuint32_t total = 0, count = 0;\n \t\t\tstruct progress *progress = NULL;\n \n-\t\t\tprepare_packed_git(the_repository);\n-\n \t\t\tif (show_progress) {\n-\t\t\t\tfor (p = the_repository->objects.packed_git; p;\n+\t\t\t\tfor (p = get_packed_git(the_repository); p;\n \t\t\t\t     p = p->next) {\n \t\t\t\t\tif (open_pack_index(p))\n \t\t\t\t\t\tcontinue;\n@@ -744,7 +742,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \n \t\t\t\tprogress = start_progress(_(\"Checking objects\"), total);\n \t\t\t}\n-\t\t\tfor (p = the_repository->objects.packed_git; p;\n+\t\t\tfor (p = get_packed_git(the_repository); p;\n \t\t\t     p = p->next) {\n \t\t\t\t/* verify gives error messages itself */\n \t\t\t\tif (verify_pack(p, fsck_obj_buffer,\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 80d19c54d5..be63bec09c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -173,8 +173,7 @@ static int too_many_packs(void)\n \tif (gc_auto_pack_limit <= 0)\n \t\treturn 0;\n \n-\tprepare_packed_git(the_repository);\n-\tfor (cnt = 0, p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (!p->pack_local)\n \t\t\tcontinue;\n \t\tif (p->pack_keep)\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 5e2590f882..a305f50100 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1026,7 +1026,7 @@ static int want_object_in_pack(const struct object_id *oid,\n \t\tif (want != -1)\n \t\t\treturn want;\n \t}\n-\tlist_for_each(pos, &the_repository->objects.packed_git_mru) {\n+\tlist_for_each(pos, get_packed_git_mru(the_repository)) {\n \t\tstruct packed_git *p = list_entry(pos, struct packed_git, mru);\n \t\toff_t offset;\n \n@@ -1045,7 +1045,7 @@ static int want_object_in_pack(const struct object_id *oid,\n \t\t\twant = want_found_object(exclude, p);\n \t\t\tif (!exclude && want > 0)\n \t\t\t\tlist_move(&p->mru,\n-\t\t\t\t\t  &the_repository->objects.packed_git_mru);\n+\t\t\t\t\t  get_packed_git_mru(the_repository));\n \t\t\tif (want != -1)\n \t\t\t\treturn want;\n \t\t}\n@@ -2674,7 +2674,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)\n \n \tmemset(&in_pack, 0, sizeof(in_pack));\n \n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\tstruct object_id oid;\n \t\tstruct object *o;\n \n@@ -2737,8 +2737,10 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)\n \tstatic struct packed_git *last_found = (void *)1;\n \tstruct packed_git *p;\n \n-\tp = (last_found != (void *)1) ? last_found :\n-\t\t\t\t\tthe_repository->objects.packed_git;\n+\tif (last_found != (void *)1)\n+\t\tp = last_found;\n+\telse\n+\t\tp = get_packed_git(the_repository);\n \n \twhile (p) {\n \t\tif ((!p->pack_local || p->pack_keep) &&\n@@ -2747,7 +2749,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)\n \t\t\treturn 1;\n \t\t}\n \t\tif (p == last_found)\n-\t\t\tp = the_repository->objects.packed_git;\n+\t\t\tp = get_packed_git(the_repository);\n \t\telse\n \t\t\tp = p->next;\n \t\tif (p == last_found)\n@@ -2783,7 +2785,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)\n \tuint32_t i;\n \tstruct object_id oid;\n \n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (!p->pack_local || p->pack_keep)\n \t\t\tcontinue;\n \n@@ -3151,10 +3153,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \tif (progress && all_progress_implied)\n \t\tprogress = 2;\n \n-\tprepare_packed_git(the_repository);\n \tif (ignore_packed_keep) {\n \t\tstruct packed_git *p;\n-\t\tfor (p = the_repository->objects.packed_git; p; p = p->next)\n+\t\tfor (p = get_packed_git(the_repository); p; p = p->next)\n \t\t\tif (p->pack_local && p->pack_keep)\n \t\t\t\tbreak;\n \t\tif (!p) /* no keep-able packs found */\n@@ -3167,7 +3168,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \t\t * also covers non-local objects\n \t\t */\n \t\tstruct packed_git *p;\n-\t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\t\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\t\tif (!p->pack_local) {\n \t\t\t\thave_non_local_packs = 1;\n \t\t\t\tbreak;\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex 3b02f94248..02b5f0becc 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -572,7 +572,7 @@ static struct pack_list * add_pack(struct packed_git *p)\n \n static struct pack_list * add_pack_file(const char *filename)\n {\n-\tstruct packed_git *p = the_repository->objects.packed_git;\n+\tstruct packed_git *p = get_packed_git(the_repository);\n \n \tif (strlen(filename) < 40)\n \t\tdie(\"Bad pack filename: %s\", filename);\n@@ -587,7 +587,7 @@ static struct pack_list * add_pack_file(const char *filename)\n \n static void load_all(void)\n {\n-\tstruct packed_git *p = the_repository->objects.packed_git;\n+\tstruct packed_git *p = get_packed_git(the_repository);\n \n \twhile (p) {\n \t\tadd_pack(p);\n@@ -630,8 +630,6 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)\n \t\t\tbreak;\n \t}\n \n-\tprepare_packed_git(the_repository);\n-\n \tif (load_all_packs)\n \t\tload_all();\n \telse\ndiff --git a/fast-import.c b/fast-import.c\nindex f2e255ed7e..041217eedf 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1111,8 +1111,7 @@ static int store_object(\n \tif (e->idx.offset) {\n \t\tduplicate_count_by_type[type]++;\n \t\treturn 1;\n-\t} else if (find_sha1_pack(oid.hash,\n-\t\t\t\t  the_repository->objects.packed_git)) {\n+\t} else if (find_sha1_pack(oid.hash, get_packed_git(the_repository))) {\n \t\te->type = type;\n \t\te->pack_id = MAX_PACK_ID;\n \t\te->idx.offset = 1; /* just not zero! */\n@@ -1309,8 +1308,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)\n \t\tduplicate_count_by_type[OBJ_BLOB]++;\n \t\ttruncate_pack(&checkpoint);\n \n-\t} else if (find_sha1_pack(oid.hash,\n-\t\t\t\t  the_repository->objects.packed_git)) {\n+\t} else if (find_sha1_pack(oid.hash, get_packed_git(the_repository))) {\n \t\te->type = OBJ_BLOB;\n \t\te->pack_id = MAX_PACK_ID;\n \t\te->idx.offset = 1; /* just not zero! */\n@@ -3474,7 +3472,6 @@ int cmd_main(int argc, const char **argv)\n \t\trc_free[i].next = &rc_free[i + 1];\n \trc_free[cmd_save - 1].next = NULL;\n \n-\tprepare_packed_git(the_repository);\n \tstart_packfile();\n \tset_die_routine(die_nicely);\n \tset_checkpoint_signal();\ndiff --git a/http-backend.c b/http-backend.c\nindex defa6ba350..22d2e1668e 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -518,14 +518,13 @@ static void get_info_packs(struct strbuf *hdr, char *arg)\n \tsize_t cnt = 0;\n \n \tselect_getanyfile(hdr);\n-\tprepare_packed_git(the_repository);\n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (p->pack_local)\n \t\t\tcnt++;\n \t}\n \n \tstrbuf_grow(&buf, cnt * 53 + 2);\n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (p->pack_local)\n \t\t\tstrbuf_addf(&buf, \"P %s\\n\", p->pack_name + objdirlen + 6);\n \t}\ndiff --git a/object-store.h b/object-store.h\nindex afe2f93459..636375753f 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -87,9 +87,9 @@ struct raw_object_store {\n \t */\n \tchar *objectdir;\n \n-\tstruct packed_git *packed_git;\n+\tstruct packed_git *packed_git; /* private */\n \t/* A most-recently-used ordered version of the packed_git list. */\n-\tstruct list_head packed_git_mru;\n+\tstruct list_head packed_git_mru; /* private */\n \n \tstruct alternate_object_database *alt_odb_list;\n \tstruct alternate_object_database **alt_odb_tail;\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex bcc04bc45e..2a007b5539 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -335,8 +335,7 @@ static int open_pack_bitmap(void)\n \n \tassert(!bitmap_git.map && !bitmap_git.loaded);\n \n-\tprepare_packed_git(the_repository);\n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (open_pack_bitmap_1(p) == 0)\n \t\t\tret = 0;\n \t}\ndiff --git a/packfile.c b/packfile.c\nindex d9065ccd32..ed26ab1b3b 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -802,6 +802,7 @@ static void prepare_packed_git_one(struct repository *r, char *objdir, int local\n \tstrbuf_release(&path);\n }\n \n+static void prepare_packed_git(struct repository *r);\n /*\n  * Give a fast, rough count of the number of objects in the repository. This\n  * ignores loose objects completely. If you have a lot of them, then either\n@@ -882,7 +883,7 @@ static void prepare_packed_git_mru(struct repository *r)\n \t\tlist_add_tail(&p->mru, &r->objects.packed_git_mru);\n }\n \n-void prepare_packed_git(struct repository *r)\n+static void prepare_packed_git(struct repository *r)\n {\n \tstruct alternate_object_database *alt;\n \n@@ -897,6 +898,18 @@ void prepare_packed_git(struct repository *r)\n \tr->objects.packed_git_initialized = 1;\n }\n \n+struct packed_git *get_packed_git(struct repository *r)\n+{\n+\tprepare_packed_git(r);\n+\treturn r->objects.packed_git;\n+}\n+\n+struct list_head *get_packed_git_mru(struct repository *r)\n+{\n+\tprepare_packed_git(r);\n+\treturn &r->objects.packed_git_mru;\n+}\n+\n void reprepare_packed_git(struct repository *r)\n {\n \tr->objects.approximate_object_count_valid = 0;\ndiff --git a/packfile.h b/packfile.h\nindex 6f7b9e91d6..1903984e22 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -3,6 +3,9 @@\n \n #include \"oidset.h\"\n \n+struct list_head;\n+struct packed_git;\n+\n /*\n  * Generate the filename to be used for a pack file with checksum \"sha1\" and\n  * extension \"ext\". The result is written into the strbuf \"buf\", overwriting\n@@ -34,7 +37,8 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_\n #define PACKDIR_FILE_GARBAGE 4\n extern void (*report_garbage)(unsigned seen_bits, const char *path);\n \n-extern void prepare_packed_git(struct repository *r);\n+extern struct packed_git *get_packed_git(struct repository *r);\n+extern struct list_head *get_packed_git_mru(struct repository *r);\n extern void reprepare_packed_git(struct repository *r);\n extern void install_packed_git(struct repository *r, struct packed_git *pack);\n \ndiff --git a/server-info.c b/server-info.c\nindex f5e4d1cc89..af737acd24 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -200,8 +200,7 @@ static void init_pack_info(const char *infofile, int force)\n \tobjdir = get_object_directory();\n \tobjdirlen = strlen(objdir);\n \n-\tprepare_packed_git(the_repository);\n-\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n \t\t/* we ignore things on alternate path since they are\n \t\t * not available to the pullers in general.\n \t\t */\n@@ -211,7 +210,7 @@ static void init_pack_info(const char *infofile, int force)\n \t}\n \tnum_pack = i;\n \tinfo = xcalloc(num_pack, sizeof(struct pack_info *));\n-\tfor (i = 0, p = the_repository->objects.packed_git; p; p = p->next) {\n+\tfor (i = 0, p = get_packed_git(the_repository); p; p = p->next) {\n \t\tif (!p->pack_local)\n \t\t\tcontinue;\n \t\tinfo[i] = xcalloc(1, sizeof(struct pack_info));\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 773322ac81..f25a0970ca 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -195,8 +195,7 @@ static void find_short_packed_object(struct disambiguate_state *ds)\n {\n \tstruct packed_git *p;\n \n-\tprepare_packed_git(the_repository);\n-\tfor (p = the_repository->objects.packed_git; p && !ds->ambiguous;\n+\tfor (p = get_packed_git(the_repository); p && !ds->ambiguous;\n \t     p = p->next)\n \t\tunique_in_pack(p, ds);\n }\n@@ -566,8 +565,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)\n {\n \tstruct packed_git *p;\n \n-\tprepare_packed_git(the_repository);\n-\tfor (p = the_repository->objects.packed_git; p; p = p->next)\n+\tfor (p = get_packed_git(the_repository); p; p = p->next)\n \t\tfind_abbrev_len_for_pack(p, mad);\n }\n \n-- \n2.16.1.399.g632f88eed1\n\n\n-- 8< --\n"},{"id":"340564","messageId":"a662ba5a-9bd9-9182-9bf9-1177b8238d4d@gmail.com","threadId":"47941","inReplyTo":"20180228010608.215505-4-sbeller@google.com","subject":"Re: [PATCH 03/11] packfile: allow install_packed_git to handle arbitrary repositories","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2018-02-28T14:38:25Z","receivedAt":"2018-02-28T14:38:34Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 2/27/2018 8:06 PM, Stefan Beller wrote:\n>   \n> -void install_packed_git(struct packed_git *pack)\n> +void install_packed_git(struct repository *r, struct packed_git *pack)\n\nThis is a good thing to do. I'm just making note that this will collide \nwith the new instances of install_packed_git() that I added in the \nserialized git commit graph series, specifically when adding the \n--stdin-packs argument [1].\n\nThanks,\n-Stolee\n\n[1] \nhttps://public-inbox.org/git/CAGZ79kYM0fHiYQ2+k5__A2hY1PeCyigYf3n9ZBJSKH8yJZOF0A@mail.gmail.com/T/#u\n"},{"id":"340566","messageId":"db9d8194-aeb0-92c2-aea0-1ec9fbbfd8ae@gmail.com","threadId":"47941","inReplyTo":"20180228021530.GA20625@duynguyen.dek-tpc.internal","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2018-02-28T14:47:47Z","receivedAt":"2018-02-28T14:47:57Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"\n\nOn 2/27/2018 9:15 PM, Duy Nguyen wrote:\n> On Tue, Feb 27, 2018 at 05:05:57PM -0800, Stefan Beller wrote:\n>> This applies on top of origin/sb/object-store and is the continuation of\n>> that series, adding the repository as a context argument to functions.\n>>\n>> This series focusses on packfile handling, exposing (re)prepare_packed_git\n>> and find_pack_entry to a repository argument.\n> It looks good.\n\nI agree.\n\n> Looking at the full-series diff though, it makes me wonder if we\n> should keep prepare_packed_git() private (i.e. how we initialize the\n> object store, packfile included, is a private matter). How about\n> something like this on top?\n\nI think the get_packed_git() approach is cleaner than navigating \ndirectly to the_repository->objects.packed_git that you expect to be \ninitialized by an earlier method call.\n\nThanks,\n-Stolee\n\n> -- 8< --\n> Subject: [PATCH] packfile: keep raw_object_store.packed_git{,_mru} fields private\n>\n> These fields are initialized lazily via prepare_packed_git(). All\n> access to these must call that function first but unless you know the\n> implementation details, you may not see the connection.\n>\n> Keep that connection internal. These fields should only be accessed\n> via get_packed_git() and get_packed_git_mru() outside packfile.c.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>   builtin/count-objects.c  |  4 +---\n>   builtin/fsck.c           |  6 ++----\n>   builtin/gc.c             |  3 +--\n>   builtin/pack-objects.c   | 21 +++++++++++----------\n>   builtin/pack-redundant.c |  6 ++----\n>   fast-import.c            |  7 ++-----\n>   http-backend.c           |  5 ++---\n>   object-store.h           |  4 ++--\n>   pack-bitmap.c            |  3 +--\n>   packfile.c               | 15 ++++++++++++++-\n>   packfile.h               |  6 +++++-\n>   server-info.c            |  5 ++---\n>   sha1_name.c              |  6 ++----\n>   13 files changed, 47 insertions(+), 44 deletions(-)\n>\n> diff --git a/builtin/count-objects.c b/builtin/count-objects.c\n> index d480301763..088309945b 100644\n> --- a/builtin/count-objects.c\n> +++ b/builtin/count-objects.c\n> @@ -121,9 +121,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)\n>   \t\tstruct strbuf loose_buf = STRBUF_INIT;\n>   \t\tstruct strbuf pack_buf = STRBUF_INIT;\n>   \t\tstruct strbuf garbage_buf = STRBUF_INIT;\n> -\t\tif (!the_repository->objects.packed_git)\n> -\t\t\tprepare_packed_git(the_repository);\n> -\t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\t\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\t\tif (!p->pack_local)\n>   \t\t\t\tcontinue;\n>   \t\t\tif (open_pack_index(p))\n> diff --git a/builtin/fsck.c b/builtin/fsck.c\n> index 0a043a43c2..6d86f2581a 100644\n> --- a/builtin/fsck.c\n> +++ b/builtin/fsck.c\n> @@ -732,10 +732,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n>   \t\t\tuint32_t total = 0, count = 0;\n>   \t\t\tstruct progress *progress = NULL;\n>   \n> -\t\t\tprepare_packed_git(the_repository);\n> -\n>   \t\t\tif (show_progress) {\n> -\t\t\t\tfor (p = the_repository->objects.packed_git; p;\n> +\t\t\t\tfor (p = get_packed_git(the_repository); p;\n>   \t\t\t\t     p = p->next) {\n>   \t\t\t\t\tif (open_pack_index(p))\n>   \t\t\t\t\t\tcontinue;\n> @@ -744,7 +742,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n>   \n>   \t\t\t\tprogress = start_progress(_(\"Checking objects\"), total);\n>   \t\t\t}\n> -\t\t\tfor (p = the_repository->objects.packed_git; p;\n> +\t\t\tfor (p = get_packed_git(the_repository); p;\n>   \t\t\t     p = p->next) {\n>   \t\t\t\t/* verify gives error messages itself */\n>   \t\t\t\tif (verify_pack(p, fsck_obj_buffer,\n> diff --git a/builtin/gc.c b/builtin/gc.c\n> index 80d19c54d5..be63bec09c 100644\n> --- a/builtin/gc.c\n> +++ b/builtin/gc.c\n> @@ -173,8 +173,7 @@ static int too_many_packs(void)\n>   \tif (gc_auto_pack_limit <= 0)\n>   \t\treturn 0;\n>   \n> -\tprepare_packed_git(the_repository);\n> -\tfor (cnt = 0, p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (!p->pack_local)\n>   \t\t\tcontinue;\n>   \t\tif (p->pack_keep)\n> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\n> index 5e2590f882..a305f50100 100644\n> --- a/builtin/pack-objects.c\n> +++ b/builtin/pack-objects.c\n> @@ -1026,7 +1026,7 @@ static int want_object_in_pack(const struct object_id *oid,\n>   \t\tif (want != -1)\n>   \t\t\treturn want;\n>   \t}\n> -\tlist_for_each(pos, &the_repository->objects.packed_git_mru) {\n> +\tlist_for_each(pos, get_packed_git_mru(the_repository)) {\n>   \t\tstruct packed_git *p = list_entry(pos, struct packed_git, mru);\n>   \t\toff_t offset;\n>   \n> @@ -1045,7 +1045,7 @@ static int want_object_in_pack(const struct object_id *oid,\n>   \t\t\twant = want_found_object(exclude, p);\n>   \t\t\tif (!exclude && want > 0)\n>   \t\t\t\tlist_move(&p->mru,\n> -\t\t\t\t\t  &the_repository->objects.packed_git_mru);\n> +\t\t\t\t\t  get_packed_git_mru(the_repository));\n>   \t\t\tif (want != -1)\n>   \t\t\t\treturn want;\n>   \t\t}\n> @@ -2674,7 +2674,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)\n>   \n>   \tmemset(&in_pack, 0, sizeof(in_pack));\n>   \n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tstruct object_id oid;\n>   \t\tstruct object *o;\n>   \n> @@ -2737,8 +2737,10 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)\n>   \tstatic struct packed_git *last_found = (void *)1;\n>   \tstruct packed_git *p;\n>   \n> -\tp = (last_found != (void *)1) ? last_found :\n> -\t\t\t\t\tthe_repository->objects.packed_git;\n> +\tif (last_found != (void *)1)\n> +\t\tp = last_found;\n> +\telse\n> +\t\tp = get_packed_git(the_repository);\n>   \n>   \twhile (p) {\n>   \t\tif ((!p->pack_local || p->pack_keep) &&\n> @@ -2747,7 +2749,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)\n>   \t\t\treturn 1;\n>   \t\t}\n>   \t\tif (p == last_found)\n> -\t\t\tp = the_repository->objects.packed_git;\n> +\t\t\tp = get_packed_git(the_repository);\n>   \t\telse\n>   \t\t\tp = p->next;\n>   \t\tif (p == last_found)\n> @@ -2783,7 +2785,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)\n>   \tuint32_t i;\n>   \tstruct object_id oid;\n>   \n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (!p->pack_local || p->pack_keep)\n>   \t\t\tcontinue;\n>   \n> @@ -3151,10 +3153,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n>   \tif (progress && all_progress_implied)\n>   \t\tprogress = 2;\n>   \n> -\tprepare_packed_git(the_repository);\n>   \tif (ignore_packed_keep) {\n>   \t\tstruct packed_git *p;\n> -\t\tfor (p = the_repository->objects.packed_git; p; p = p->next)\n> +\t\tfor (p = get_packed_git(the_repository); p; p = p->next)\n>   \t\t\tif (p->pack_local && p->pack_keep)\n>   \t\t\t\tbreak;\n>   \t\tif (!p) /* no keep-able packs found */\n> @@ -3167,7 +3168,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n>   \t\t * also covers non-local objects\n>   \t\t */\n>   \t\tstruct packed_git *p;\n> -\t\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\t\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\t\tif (!p->pack_local) {\n>   \t\t\t\thave_non_local_packs = 1;\n>   \t\t\t\tbreak;\n> diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\n> index 3b02f94248..02b5f0becc 100644\n> --- a/builtin/pack-redundant.c\n> +++ b/builtin/pack-redundant.c\n> @@ -572,7 +572,7 @@ static struct pack_list * add_pack(struct packed_git *p)\n>   \n>   static struct pack_list * add_pack_file(const char *filename)\n>   {\n> -\tstruct packed_git *p = the_repository->objects.packed_git;\n> +\tstruct packed_git *p = get_packed_git(the_repository);\n>   \n>   \tif (strlen(filename) < 40)\n>   \t\tdie(\"Bad pack filename: %s\", filename);\n> @@ -587,7 +587,7 @@ static struct pack_list * add_pack_file(const char *filename)\n>   \n>   static void load_all(void)\n>   {\n> -\tstruct packed_git *p = the_repository->objects.packed_git;\n> +\tstruct packed_git *p = get_packed_git(the_repository);\n>   \n>   \twhile (p) {\n>   \t\tadd_pack(p);\n> @@ -630,8 +630,6 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)\n>   \t\t\tbreak;\n>   \t}\n>   \n> -\tprepare_packed_git(the_repository);\n> -\n>   \tif (load_all_packs)\n>   \t\tload_all();\n>   \telse\n> diff --git a/fast-import.c b/fast-import.c\n> index f2e255ed7e..041217eedf 100644\n> --- a/fast-import.c\n> +++ b/fast-import.c\n> @@ -1111,8 +1111,7 @@ static int store_object(\n>   \tif (e->idx.offset) {\n>   \t\tduplicate_count_by_type[type]++;\n>   \t\treturn 1;\n> -\t} else if (find_sha1_pack(oid.hash,\n> -\t\t\t\t  the_repository->objects.packed_git)) {\n> +\t} else if (find_sha1_pack(oid.hash, get_packed_git(the_repository))) {\n>   \t\te->type = type;\n>   \t\te->pack_id = MAX_PACK_ID;\n>   \t\te->idx.offset = 1; /* just not zero! */\n> @@ -1309,8 +1308,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)\n>   \t\tduplicate_count_by_type[OBJ_BLOB]++;\n>   \t\ttruncate_pack(&checkpoint);\n>   \n> -\t} else if (find_sha1_pack(oid.hash,\n> -\t\t\t\t  the_repository->objects.packed_git)) {\n> +\t} else if (find_sha1_pack(oid.hash, get_packed_git(the_repository))) {\n>   \t\te->type = OBJ_BLOB;\n>   \t\te->pack_id = MAX_PACK_ID;\n>   \t\te->idx.offset = 1; /* just not zero! */\n> @@ -3474,7 +3472,6 @@ int cmd_main(int argc, const char **argv)\n>   \t\trc_free[i].next = &rc_free[i + 1];\n>   \trc_free[cmd_save - 1].next = NULL;\n>   \n> -\tprepare_packed_git(the_repository);\n>   \tstart_packfile();\n>   \tset_die_routine(die_nicely);\n>   \tset_checkpoint_signal();\n> diff --git a/http-backend.c b/http-backend.c\n> index defa6ba350..22d2e1668e 100644\n> --- a/http-backend.c\n> +++ b/http-backend.c\n> @@ -518,14 +518,13 @@ static void get_info_packs(struct strbuf *hdr, char *arg)\n>   \tsize_t cnt = 0;\n>   \n>   \tselect_getanyfile(hdr);\n> -\tprepare_packed_git(the_repository);\n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (p->pack_local)\n>   \t\t\tcnt++;\n>   \t}\n>   \n>   \tstrbuf_grow(&buf, cnt * 53 + 2);\n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (p->pack_local)\n>   \t\t\tstrbuf_addf(&buf, \"P %s\\n\", p->pack_name + objdirlen + 6);\n>   \t}\n> diff --git a/object-store.h b/object-store.h\n> index afe2f93459..636375753f 100644\n> --- a/object-store.h\n> +++ b/object-store.h\n> @@ -87,9 +87,9 @@ struct raw_object_store {\n>   \t */\n>   \tchar *objectdir;\n>   \n> -\tstruct packed_git *packed_git;\n> +\tstruct packed_git *packed_git; /* private */\n>   \t/* A most-recently-used ordered version of the packed_git list. */\n> -\tstruct list_head packed_git_mru;\n> +\tstruct list_head packed_git_mru; /* private */\n>   \n>   \tstruct alternate_object_database *alt_odb_list;\n>   \tstruct alternate_object_database **alt_odb_tail;\n> diff --git a/pack-bitmap.c b/pack-bitmap.c\n> index bcc04bc45e..2a007b5539 100644\n> --- a/pack-bitmap.c\n> +++ b/pack-bitmap.c\n> @@ -335,8 +335,7 @@ static int open_pack_bitmap(void)\n>   \n>   \tassert(!bitmap_git.map && !bitmap_git.loaded);\n>   \n> -\tprepare_packed_git(the_repository);\n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (open_pack_bitmap_1(p) == 0)\n>   \t\t\tret = 0;\n>   \t}\n> diff --git a/packfile.c b/packfile.c\n> index d9065ccd32..ed26ab1b3b 100644\n> --- a/packfile.c\n> +++ b/packfile.c\n> @@ -802,6 +802,7 @@ static void prepare_packed_git_one(struct repository *r, char *objdir, int local\n>   \tstrbuf_release(&path);\n>   }\n>   \n> +static void prepare_packed_git(struct repository *r);\n>   /*\n>    * Give a fast, rough count of the number of objects in the repository. This\n>    * ignores loose objects completely. If you have a lot of them, then either\n> @@ -882,7 +883,7 @@ static void prepare_packed_git_mru(struct repository *r)\n>   \t\tlist_add_tail(&p->mru, &r->objects.packed_git_mru);\n>   }\n>   \n> -void prepare_packed_git(struct repository *r)\n> +static void prepare_packed_git(struct repository *r)\n>   {\n>   \tstruct alternate_object_database *alt;\n>   \n> @@ -897,6 +898,18 @@ void prepare_packed_git(struct repository *r)\n>   \tr->objects.packed_git_initialized = 1;\n>   }\n>   \n> +struct packed_git *get_packed_git(struct repository *r)\n> +{\n> +\tprepare_packed_git(r);\n> +\treturn r->objects.packed_git;\n> +}\n> +\n> +struct list_head *get_packed_git_mru(struct repository *r)\n> +{\n> +\tprepare_packed_git(r);\n> +\treturn &r->objects.packed_git_mru;\n> +}\n> +\n>   void reprepare_packed_git(struct repository *r)\n>   {\n>   \tr->objects.approximate_object_count_valid = 0;\n> diff --git a/packfile.h b/packfile.h\n> index 6f7b9e91d6..1903984e22 100644\n> --- a/packfile.h\n> +++ b/packfile.h\n> @@ -3,6 +3,9 @@\n>   \n>   #include \"oidset.h\"\n>   \n> +struct list_head;\n> +struct packed_git;\n> +\n>   /*\n>    * Generate the filename to be used for a pack file with checksum \"sha1\" and\n>    * extension \"ext\". The result is written into the strbuf \"buf\", overwriting\n> @@ -34,7 +37,8 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_\n>   #define PACKDIR_FILE_GARBAGE 4\n>   extern void (*report_garbage)(unsigned seen_bits, const char *path);\n>   \n> -extern void prepare_packed_git(struct repository *r);\n> +extern struct packed_git *get_packed_git(struct repository *r);\n> +extern struct list_head *get_packed_git_mru(struct repository *r);\n>   extern void reprepare_packed_git(struct repository *r);\n>   extern void install_packed_git(struct repository *r, struct packed_git *pack);\n>   \n> diff --git a/server-info.c b/server-info.c\n> index f5e4d1cc89..af737acd24 100644\n> --- a/server-info.c\n> +++ b/server-info.c\n> @@ -200,8 +200,7 @@ static void init_pack_info(const char *infofile, int force)\n>   \tobjdir = get_object_directory();\n>   \tobjdirlen = strlen(objdir);\n>   \n> -\tprepare_packed_git(the_repository);\n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\t/* we ignore things on alternate path since they are\n>   \t\t * not available to the pullers in general.\n>   \t\t */\n> @@ -211,7 +210,7 @@ static void init_pack_info(const char *infofile, int force)\n>   \t}\n>   \tnum_pack = i;\n>   \tinfo = xcalloc(num_pack, sizeof(struct pack_info *));\n> -\tfor (i = 0, p = the_repository->objects.packed_git; p; p = p->next) {\n> +\tfor (i = 0, p = get_packed_git(the_repository); p; p = p->next) {\n>   \t\tif (!p->pack_local)\n>   \t\t\tcontinue;\n>   \t\tinfo[i] = xcalloc(1, sizeof(struct pack_info));\n> diff --git a/sha1_name.c b/sha1_name.c\n> index 773322ac81..f25a0970ca 100644\n> --- a/sha1_name.c\n> +++ b/sha1_name.c\n> @@ -195,8 +195,7 @@ static void find_short_packed_object(struct disambiguate_state *ds)\n>   {\n>   \tstruct packed_git *p;\n>   \n> -\tprepare_packed_git(the_repository);\n> -\tfor (p = the_repository->objects.packed_git; p && !ds->ambiguous;\n> +\tfor (p = get_packed_git(the_repository); p && !ds->ambiguous;\n>   \t     p = p->next)\n>   \t\tunique_in_pack(p, ds);\n>   }\n> @@ -566,8 +565,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)\n>   {\n>   \tstruct packed_git *p;\n>   \n> -\tprepare_packed_git(the_repository);\n> -\tfor (p = the_repository->objects.packed_git; p; p = p->next)\n> +\tfor (p = get_packed_git(the_repository); p; p = p->next)\n>   \t\tfind_abbrev_len_for_pack(p, mad);\n>   }\n>   \n\n"},{"id":"340583","messageId":"xmqq371lm1zd.fsf@gitster-ct.c.googlers.com","threadId":"47941","inReplyTo":"20180228010608.215505-1-sbeller@google.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-28T17:57:10Z","receivedAt":"2018-02-28T17:57:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> This applies on top of origin/sb/object-store and is the continuation of\n> that series, adding the repository as a context argument to functions.\n\nWait a minute.  Is that topic ever shown to work well together with\nother topics in flight and are now ready to be built upon?  I had an\nimpression that it is just starting to get serious reviews.  \n\nSorry, but I am behind ;-)\n"},{"id":"340584","messageId":"xmqqy3jdknar.fsf@gitster-ct.c.googlers.com","threadId":"47941","inReplyTo":"20180228021530.GA20625@duynguyen.dek-tpc.internal","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-28T17:59:40Z","receivedAt":"2018-02-28T17:59:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> Looking at the full-series diff though, it makes me wonder if we\n> should keep prepare_packed_git() private (i.e. how we initialize the\n> object store, packfile included, is a private matter). How about\n> something like this on top?\n\nYup, that looks cleaner.\n"},{"id":"340594","messageId":"CAGZ79kaDVrn6Qw_xsdyBST6XfJMXs43qDWx8jY2J9VsXwDKm5Q@mail.gmail.com","threadId":"47941","inReplyTo":"xmqq371lm1zd.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T18:56:07Z","receivedAt":"2018-02-28T18:56:14Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Feb 28, 2018 at 9:57 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>> This applies on top of origin/sb/object-store and is the continuation of\n>> that series, adding the repository as a context argument to functions.\n>\n> Wait a minute.  Is that topic ever shown to work well together with\n> other topics in flight and are now ready to be built upon?  I had an\n> impression that it is just starting to get serious reviews.\n\nAnd I had the impression the serious reviews were done and fine;\nthe only issue would be demonstrating its working fine with other\nseries, where I was also worrying about conflicts with\nbrians series. And to address that, I'd just send series in small sizes.\n\n> Sorry, but I am behind ;-)\n\nIs there anything that a contributor can help with that eases\nrefactoring series in flight?\n\nPersonally I find these refactorings not as rewarding as new\nfeatures or fixing bugs, and additionally the risk of conflict\nrises, whereby the maintainer is likely to push back to the contributor\nto \"please rebase\", and rebasing with just textual conflicts is also\nnot rewarding.\n\nIs there anything process wise that we can do to make refactoring\neasier for contributors?\n\nSorry for the miscommunication, though,\n\nThanks,\nStefan\n"},{"id":"340596","messageId":"CAGZ79kaurxM+Daa43ZQ_LCn6HbiaXex_NtO73g2ip70RUpjM7A@mail.gmail.com","threadId":"47941","inReplyTo":"xmqqy3jdknar.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T18:59:05Z","receivedAt":"2018-02-28T18:59:12Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Feb 28, 2018 at 9:59 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> Looking at the full-series diff though, it makes me wonder if we\n>> should keep prepare_packed_git() private (i.e. how we initialize the\n>> object store, packfile included, is a private matter). How about\n>> something like this on top?\n>\n> Yup, that looks cleaner.\n\nI agree that it looks cleaner. So we plan on just putting\nit on top of that series?\n\nThanks for the help on refactoring,\nStefan\n"},{"id":"340597","messageId":"xmqq7eqxkkds.fsf@gitster-ct.c.googlers.com","threadId":"47941","inReplyTo":"xmqq371lm1zd.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-28T19:02:39Z","receivedAt":"2018-02-28T19:02:46Z","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> Stefan Beller <sbeller@google.com> writes:\n>\n>> This applies on top of origin/sb/object-store and is the continuation of\n>> that series, adding the repository as a context argument to functions.\n>\n> Wait a minute.  Is that topic ever shown to work well together with\n> other topics in flight and are now ready to be built upon?  I had an\n> impression that it is just starting to get serious reviews.  \n>\n> Sorry, but I am behind ;-)\n\nOK, so I finally picked up the last round, which wasn't even in my\nprivate build.  I had the previous round but hadn't convinced myself\nthat my conflict resolution with other topics in flight that were\nstill mushy was correct, so it was out of 'pu', but at least it was\nin my tree, so that is where my impression came from.\n\nI saw that the way a list-head in a repository is initialized has\nbeen revamped in v4, which looked sensible.  Will merge it to 'pu'\nso that I can pick up the ignore-env removal from Duy.\n\n"},{"id":"340605","messageId":"CAGZ79kZJC+puprsqHuGqsgHNse4=10unnGBwHgKu9dW8a_fiJg@mail.gmail.com","threadId":"47941","inReplyTo":"xmqq7eqxkkds.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-02-28T19:09:27Z","receivedAt":"2018-02-28T19:09:33Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Feb 28, 2018 at 11:02 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> OK, so I finally picked up the last round, which wasn't even in my\n> private build.  I had the previous round but hadn't convinced myself\n> that my conflict resolution with other topics in flight that were\n> still mushy was correct, so it was out of 'pu', but at least it was\n> in my tree, so that is where my impression came from.\n>\n> I saw that the way a list-head in a repository is initialized has\n> been revamped in v4, which looked sensible.  Will merge it to 'pu'\n> so that I can pick up the ignore-env removal from Duy.\n\nThanks,\nStefan\n"},{"id":"340607","messageId":"xmqq371lkk1t.fsf@gitster-ct.c.googlers.com","threadId":"47941","inReplyTo":"CAGZ79kaurxM+Daa43ZQ_LCn6HbiaXex_NtO73g2ip70RUpjM7A@mail.gmail.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-28T19:09:50Z","receivedAt":"2018-02-28T19:09:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> On Wed, Feb 28, 2018 at 9:59 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Duy Nguyen <pclouds@gmail.com> writes:\n>>\n>>> Looking at the full-series diff though, it makes me wonder if we\n>>> should keep prepare_packed_git() private (i.e. how we initialize the\n>>> object store, packfile included, is a private matter). How about\n>>> something like this on top?\n>>\n>> Yup, that looks cleaner.\n>\n> I agree that it looks cleaner. So we plan on just putting\n> it on top of that series?\n\nWe tend to avoid \"oops, that was wrong and here is a band aid on\ntop\" for things that are still mushy, so it would be preferrable to\nget it fixed inline, especially if there are more changes to the\nother parts of the series coming.\n"},{"id":"340608","messageId":"20180228191931.GF251290@aiede.svl.corp.google.com","threadId":"47941","inReplyTo":"CAGZ79kaDVrn6Qw_xsdyBST6XfJMXs43qDWx8jY2J9VsXwDKm5Q@mail.gmail.com","subject":"Re: [PATCH 00/11] Moving global state into the repository object (part 2)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-02-28T19:19:31Z","receivedAt":"2018-02-28T19:19:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nStefan Beller wrote:\n> On Wed, Feb 28, 2018 at 9:57 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n>> Wait a minute.  Is that topic ever shown to work well together with\n>> other topics in flight and are now ready to be built upon?  I had an\n>> impression that it is just starting to get serious reviews.\n>\n> And I had the impression the serious reviews were done and fine;\n> the only issue would be demonstrating its working fine with other\n> series, where I was also worrying about conflicts with\n> brians series. And to address that, I'd just send series in small sizes.\n\nSome of the patches looked cooked to me and others still do not look\ncooked yet.  I marked the former with Reviewed-by.  In general, a few\nthings can help to make the process easier for me:\n\n 1. Giving a quick reply to a review to say how the comments were\n    resolved, sometimes even with a resend of that one patch to\n    illustrate.  That way the conversation can continue and the\n    individual patch can get to a reviewed state faster, without\n    having to chase between different rerolls of the entire series.\n\n    This also has an effect of making the review process more\n    collaborative: perhaps after seeing how you address their\n    comments, a reviewer may have another idea that they suggest via a\n    patch to squash in, etc.\n\n 2. In a reroll, summarizing the result of previous reviews by\n    including acks as appropriate and Reviewed-by if a reviewer\n    granted it.  This helps with reviewing the reroll since it tells\n    people where to focus their attention.\n\n[...]\n> Is there anything that a contributor can help with that eases\n> refactoring series in flight?\n\nFor helping reviewers, see above.\n\nFor helping Junio, what I've seen people occasionally do is to locally\nrun a \"trial merge\" against next and pu and see what semantic or\nlexical conflicts arise.  In the cover letter you can describe these\nand give Junio advice to make applying the patch easier for him.\n\n[...]\n> Sorry for the miscommunication, though,\n\nFWIW, even though part 1 doesn't look done to me yet, it looks *close*\nto done, and I was happy to see the sneak peek at part 2.\n\nThanks,\nJonathan\n"}]}