{"thread":{"id":"59603","subject":"[PATCH 00/23] Header cleanups (more splitting of cache.h and simplifying a few other deps)","startedAt":"2023-04-16T03:03:38Z","lastAt":"2023-05-02T16:00:00Z","messageCount":81,"participants":["Elijah Newren via GitGitGadget","Derrick Stolee","Elijah Newren","Junio C Hamano","Glen Choo","Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":1,"patchTotal":23},"messages":[{"id":"475452","messageId":"pull.1517.git.1681614205.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":null,"subject":"[PATCH 00/23] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:02Z","receivedAt":"2023-04-16T03:03:38Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Maintainer notes: (1) This series is based on en/header-split-cache-h (now\nin next). (2) Although I've tweaked the series to minimize conflicts, there\nis a semantic conflict with sl/sparse-write-tree in next; to resolve, add an\ninclude of repository.h in builtin/write-tree.c.\n\nThis series continues to focus on splitting declarations from cache.h to\nseparate headers. This series also untangles some dependencies between\nhash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\nup a few other headers. At the end of this series the number of cache.h\nincludes drops from 189 down to 149.\n\nThe series may appear to be long at first glance, but is filled with mostly\nrepetitive and simple changes similar to those from earlier series. An\noverview:\n\n * Patch 1: files depending on strbuf.h should be explicit about it\n * Patches 2-13: move stuff out of cache.h into other more logical headers\n * Patch 14-16: move functions between hash<->repository and\n   read-cache<->tree to simplify dependencies\n * Patch 17: remove includes of cache.h permitted by the previous 16 patches\n * Patches 18-22: clean up now-unnecessary includes in other headers\n * Patch 23: start enforcing git-compat-util.h is first include for reftable\n   files as well.\n\nAnd thanks once again to Dscho for gitgitgadget. Getting multiple platform\ntesting + all the special tests (sparse, cocci, hdr-check, etc.) really\nhelps clean out all the issues that would otherwise hit a series like this.\n\nElijah Newren (23):\n  treewide: be explicit about dependence on strbuf.h\n  symlinks.h: move declarations for symlinks.c functions from cache.h\n  protocol.h: move definition of DEFAULT_GIT_PORT from cache.h\n  packfile.h: move pack_window and pack_entry from cache.h\n  server-info.h: move declarations for server-info.c functions from\n    cache.h\n  copy.h: move declarations for copy.c functions from cache.h\n  base85.h: move declarations for base85.c functions from cache.h\n  pkt-line.h: move declarations for pkt-line.c functions from cache.h\n  match-trees.h: move declarations for match-trees.c functions from\n    cache.h\n  ws.h: move declarations for ws.c functions from cache.h\n  versioncmp.h: move declarations for versioncmp.c functions from\n    cache.h\n  dir.h: move DTYPE defines from cache.h\n  tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h\n  hash.h, repository.h: reverse the order of these dependencies\n  cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c\n  cache,tree: move basic name compare functions from read-cache to tree\n  treewide: remove cache.h inclusion due to previous changes\n  cache.h: remove unnecessary headers\n  fsmonitor: reduce includes of cache.h\n  commit.h: reduce unnecessary includes\n  object-store.h: reduce unnecessary includes\n  diff.h: reduce unnecessary includes\n  reftable: ensure git-compat-util.h is the first (indirect) include\n\n add-interactive.c                            |   1 +\n alloc.c                                      |   1 +\n apply.c                                      |   3 +\n archive-zip.c                                |   2 +-\n archive.c                                    |   2 +\n attr.c                                       |   1 +\n base85.c                                     |   3 +-\n base85.h                                     |   7 +\n bloom.c                                      |   1 +\n branch.c                                     |   1 +\n builtin/apply.c                              |   1 +\n builtin/archive.c                            |   1 +\n builtin/bisect.c                             |   1 +\n builtin/bundle.c                             |   2 +\n builtin/check-attr.c                         |   1 +\n builtin/check-ignore.c                       |   1 +\n builtin/checkout-index.c                     |   1 +\n builtin/checkout.c                           |   1 +\n builtin/clean.c                              |   1 +\n builtin/clone.c                              |   2 +\n builtin/config.c                             |   1 +\n builtin/credential-cache.c                   |   1 +\n builtin/credential-store.c                   |   1 +\n builtin/diff-tree.c                          |   1 +\n builtin/diff.c                               |   1 +\n builtin/difftool.c                           |   1 +\n builtin/fetch.c                              |   1 +\n builtin/for-each-repo.c                      |   2 +\n builtin/gc.c                                 |   1 +\n builtin/help.c                               |   1 +\n builtin/init-db.c                            |   2 +\n builtin/log.c                                |   1 +\n builtin/ls-remote.c                          |   1 +\n builtin/merge-index.c                        |   1 +\n builtin/merge-recursive.c                    |   1 +\n builtin/merge-tree.c                         |   1 +\n builtin/mv.c                                 |   1 +\n builtin/push.c                               |   2 +\n builtin/read-tree.c                          |   1 +\n builtin/receive-pack.c                       |   1 +\n builtin/repack.c                             |   1 +\n builtin/rerere.c                             |   1 +\n builtin/rm.c                                 |   1 +\n builtin/show-branch.c                        |   1 +\n builtin/show-index.c                         |   1 +\n builtin/update-index.c                       |   2 +\n builtin/update-ref.c                         |   1 +\n builtin/update-server-info.c                 |   1 +\n builtin/upload-archive.c                     |   1 +\n builtin/worktree.c                           |   2 +\n bundle-uri.c                                 |   3 +-\n cache.h                                      | 143 +------------------\n checkout.c                                   |   1 +\n chunk-format.c                               |   1 +\n color.c                                      |   3 +-\n combine-diff.c                               |   3 +-\n commit-graph.c                               |   1 +\n commit.c                                     |   1 +\n commit.h                                     |  11 +-\n common-main.c                                |   4 +-\n compat/fsmonitor/fsm-health-darwin.c         |   2 +-\n compat/fsmonitor/fsm-ipc-darwin.c            |   4 +-\n compat/fsmonitor/fsm-ipc-win32.c             |   1 +\n compat/fsmonitor/fsm-listen-darwin.c         |   3 +-\n compat/mingw.c                               |   1 +\n compat/precompose_utf8.c                     |   1 +\n compat/win32/trace2_win32_process_info.c     |   1 +\n config.c                                     |   3 +-\n convert.c                                    |   1 +\n copy.c                                       |   4 +-\n copy.h                                       |  10 ++\n credential.c                                 |   3 +-\n csum-file.c                                  |   1 +\n daemon.c                                     |   4 +-\n date.c                                       |   3 +-\n diagnose.c                                   |   2 +-\n diff-lib.c                                   |   1 +\n diff.c                                       |   2 +\n diff.h                                       |   1 -\n dir.c                                        |   2 +\n dir.h                                        |  15 ++\n editor.c                                     |   1 +\n entry.c                                      |   1 +\n environment.c                                |   3 +-\n exec-cmd.c                                   |   1 +\n fetch-pack.c                                 |   1 +\n fsck.c                                       |   1 +\n fsmonitor--daemon.h                          |   1 -\n fsmonitor-ipc.c                              |   1 +\n gpg-interface.c                              |   2 +\n grep.c                                       |   1 +\n hash-lookup.c                                |   1 +\n hash.h                                       |  97 -------------\n hex.c                                        |   1 +\n hook.c                                       |   1 +\n http-push.c                                  |   2 +\n khash.h                                      |   1 +\n line-log.c                                   |   1 +\n ll-merge.c                                   |   3 +-\n log-tree.c                                   |   1 +\n match-trees.c                                |   3 +-\n match-trees.h                                |  10 ++\n merge-ort-wrappers.c                         |   2 +\n merge-ort.c                                  |   1 +\n merge-recursive.c                            |   2 +\n merge.c                                      |   1 +\n midx.c                                       |   2 +-\n negotiator/default.c                         |   1 +\n negotiator/skipping.c                        |   1 +\n notes-cache.c                                |   1 +\n notes-utils.c                                |   1 +\n object-file.c                                |   3 +-\n object-file.h                                |   2 +\n object-name.c                                |   2 +\n object-store.h                               |   8 +-\n object.h                                     |   1 +\n oid-array.h                                  |   1 +\n oidmap.c                                     |   1 +\n oidtree.c                                    |   1 +\n pack-bitmap-write.c                          |   2 +\n packfile.c                                   |   2 +-\n packfile.h                                   |  16 ++-\n parallel-checkout.c                          |   2 +\n parse-options-cb.c                           |   1 +\n parse-options.c                              |   1 +\n pathspec.c                                   |   2 +\n pkt-line.c                                   |   3 +-\n pkt-line.h                                   |   2 +\n preload-index.c                              |   1 +\n progress.c                                   |   1 +\n protocol.h                                   |  21 +++\n range-diff.c                                 |   2 +-\n read-cache.c                                 |  81 ++---------\n rebase-interactive.c                         |   1 +\n ref-filter.c                                 |   4 +-\n reflog.c                                     |   2 +\n refs/debug.c                                 |   1 +\n refs/files-backend.c                         |   2 +\n refs/packed-backend.c                        |   1 +\n refs/ref-cache.c                             |   1 +\n refs/ref-cache.h                             |   1 +\n refspec.c                                    |   2 +\n reftable/error.c                             |   1 +\n reftable/publicbasics.c                      |   2 +-\n reftable/tree.c                              |   2 +-\n reftable/tree_test.c                         |   1 +\n repository.h                                 |  96 +++++++++++++\n rerere.c                                     |   1 +\n resolve-undo.c                               |   1 +\n revision.h                                   |   1 +\n run-command.c                                |   1 +\n send-pack.c                                  |   1 +\n sequencer.c                                  |   1 +\n server-info.c                                |   3 +-\n server-info.h                                |   7 +\n split-index.c                                |   2 +\n strbuf.c                                     |   1 +\n submodule-config.c                           |   1 +\n symlinks.c                                   |   3 +-\n symlinks.h                                   |  28 ++++\n t/helper/test-bloom.c                        |   1 +\n t/helper/test-cache-tree.c                   |   1 +\n t/helper/test-dump-cache-tree.c              |   1 +\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-example-decorate.c             |   1 +\n t/helper/test-fsmonitor-client.c             |   1 +\n t/helper/test-lazy-init-name-hash.c          |   1 +\n t/helper/test-match-trees.c                  |   3 +-\n t/helper/test-mergesort.c                    |   2 +-\n t/helper/test-oid-array.c                    |   2 +-\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   2 +-\n t/helper/test-parse-options.c                |   2 +-\n t/helper/test-path-utils.c                   |   1 +\n t/helper/test-read-cache.c                   |   1 +\n t/helper/test-read-midx.c                    |   2 +-\n t/helper/test-reftable.c                     |   1 +\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-string-list.c                  |   2 +-\n t/helper/test-submodule-config.c             |   1 +\n t/helper/test-submodule-nested-repo-config.c |   1 +\n t/helper/test-submodule.c                    |   1 +\n t/helper/test-trace2.c                       |   1 +\n t/helper/test-write-cache.c                  |   1 +\n trace2.c                                     |   1 +\n trace2/tr2_tgt_event.c                       |   1 +\n trace2/tr2_tgt_normal.c                      |   1 +\n trace2/tr2_tgt_perf.c                        |   1 +\n tree-diff.c                                  |  16 ++-\n tree-walk.c                                  |   2 +-\n tree-walk.h                                  |   1 +\n tree.c                                       |  72 +++++++++-\n tree.h                                       |  11 +-\n unpack-trees.c                               |   1 +\n versioncmp.c                                 |   3 +-\n versioncmp.h                                 |   6 +\n wrapper.c                                    |   5 +-\n ws.c                                         |   6 +-\n ws.h                                         |  33 +++++\n wt-status.c                                  |   1 +\n 201 files changed, 598 insertions(+), 371 deletions(-)\n create mode 100644 base85.h\n create mode 100644 copy.h\n create mode 100644 match-trees.h\n create mode 100644 server-info.h\n create mode 100644 symlinks.h\n create mode 100644 versioncmp.h\n create mode 100644 ws.h\n\n\nbase-commit: 4711556905f381c01f1fbae205f67cfa673ab44a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1517%2Fnewren%2Fheader-cleanup-4-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1517/newren/header-cleanup-4-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1517\n-- \ngitgitgadget\n"},{"id":"475453","messageId":"dbd08e60b58abac393c0be3f87b6838a05941f8b.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 06/23] copy.h: move declarations for copy.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:08Z","receivedAt":"2023-04-16T03:03:44Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/bisect.c     |  1 +\n builtin/clone.c      |  1 +\n builtin/difftool.c   |  1 +\n builtin/init-db.c    |  1 +\n builtin/worktree.c   |  1 +\n bundle-uri.c         |  1 +\n cache.h              |  6 ------\n convert.c            |  1 +\n copy.c               |  1 +\n copy.h               | 10 ++++++++++\n pkt-line.c           |  1 +\n refs/files-backend.c |  1 +\n rerere.c             |  1 +\n sequencer.c          |  1 +\n 14 files changed, 22 insertions(+), 6 deletions(-)\n create mode 100644 copy.h\n\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 4b2143d4557..4812450c393 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 4ed0a1d5aad..017ebc3faa8 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -13,6 +13,7 @@\n #include \"abspath.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 3ffb0524be7..409507983f2 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"environment.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 6183f3fb3ff..cda6ee75eb5 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -6,6 +6,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 0621f6f708e..0b411e9deee 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n #include \"environment.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 1ff1cf51dad..6d44662ee1f 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"bundle-uri.h\"\n #include \"bundle.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\ndiff --git a/cache.h b/cache.h\nindex 2eb4546473f..2b661764794 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,12 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-#define COPY_READ_ERROR (-2)\n-#define COPY_WRITE_ERROR (-3)\n-int copy_fd(int ifd, int ofd);\n-int copy_file(const char *dst, const char *src, int mode);\n-int copy_file_with_time(const char *dst, const char *src, int mode);\n-\n /* base85 */\n int decode_85(char *dst, const char *line, int linelen);\n void encode_85(char *buf, const unsigned char *data, int bytes);\ndiff --git a/convert.c b/convert.c\nindex 5a2ea5308d6..7cf7bd0c883 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -2,6 +2,7 @@\n #include \"advice.h\"\n #include \"config.h\"\n #include \"convert.h\"\n+#include \"copy.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/copy.c b/copy.c\nindex c3250f08221..db6b615c188 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\ndiff --git a/copy.h b/copy.h\nnew file mode 100644\nindex 00000000000..2af77cba864\n--- /dev/null\n+++ b/copy.h\n@@ -0,0 +1,10 @@\n+#ifndef COPY_H\n+#define COPY_H\n+\n+#define COPY_READ_ERROR (-2)\n+#define COPY_WRITE_ERROR (-3)\n+int copy_fd(int ifd, int ofd);\n+int copy_file(const char *dst, const char *src, int mode);\n+int copy_file_with_time(const char *dst, const char *src, int mode);\n+\n+#endif /* COPY_H */\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 3561d853584..8b5fa788517 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"pkt-line.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d0581ee41ac..1128a9af292 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1,5 +1,6 @@\n #include \"../cache.h\"\n #include \"../config.h\"\n+#include \"../copy.h\"\n #include \"../environment.h\"\n #include \"../gettext.h\"\n #include \"../hex.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 7abc94bf444..e968d413d65 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex fcca3b81447..c16df514434 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3,6 +3,7 @@\n #include \"advice.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n-- \ngitgitgadget\n\n"},{"id":"475454","messageId":"003548de707f57cb9908b6dfbdf42954f668ee43.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 03/23] protocol.h: move definition of DEFAULT_GIT_PORT from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:05Z","receivedAt":"2023-04-16T03:03:44Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h    | 21 ---------------------\n daemon.c   |  1 +\n protocol.h | 21 +++++++++++++++++++++\n 3 files changed, 22 insertions(+), 21 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex e225964b3ea..ffec289dc5d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -39,27 +39,6 @@\n #define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n \n \n-/*\n- * Intensive research over the course of many years has shown that\n- * port 9418 is totally unused by anything else. Or\n- *\n- *\tYour search - \"port 9418\" - did not match any documents.\n- *\n- * as www.google.com puts it.\n- *\n- * This port has been properly assigned for git use by IANA:\n- * git (Assigned-9418) [I06-050728-0001].\n- *\n- *\tgit  9418/tcp   git pack transfer service\n- *\tgit  9418/udp   git pack transfer service\n- *\n- * with Linus Torvalds <torvalds@osdl.org> as the point of\n- * contact. September 2005.\n- *\n- * See http://www.iana.org/assignments/port-numbers\n- */\n-#define DEFAULT_GIT_PORT 9418\n-\n /*\n  * Basic data structures for the directory cache\n  */\ndiff --git a/daemon.c b/daemon.c\nindex db8a31a6ea2..75c3c064574 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -4,6 +4,7 @@\n #include \"config.h\"\n #include \"environment.h\"\n #include \"pkt-line.h\"\n+#include \"protocol.h\"\n #include \"run-command.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\ndiff --git a/protocol.h b/protocol.h\nindex cef1a4a01c7..de66bf80f84 100644\n--- a/protocol.h\n+++ b/protocol.h\n@@ -1,6 +1,27 @@\n #ifndef PROTOCOL_H\n #define PROTOCOL_H\n \n+/*\n+ * Intensive research over the course of many years has shown that\n+ * port 9418 is totally unused by anything else. Or\n+ *\n+ *\tYour search - \"port 9418\" - did not match any documents.\n+ *\n+ * as www.google.com puts it.\n+ *\n+ * This port has been properly assigned for git use by IANA:\n+ * git (Assigned-9418) [I06-050728-0001].\n+ *\n+ *\tgit  9418/tcp   git pack transfer service\n+ *\tgit  9418/udp   git pack transfer service\n+ *\n+ * with Linus Torvalds <torvalds@osdl.org> as the point of\n+ * contact. September 2005.\n+ *\n+ * See http://www.iana.org/assignments/port-numbers\n+ */\n+#define DEFAULT_GIT_PORT 9418\n+\n enum protocol_version {\n \tprotocol_unknown_version = -1,\n \tprotocol_v0 = 0,\n-- \ngitgitgadget\n\n"},{"id":"475455","messageId":"9f9a3561295de9f9af33b574d7e1d5d752ed76cf.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 02/23] symlinks.h: move declarations for symlinks.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:04Z","receivedAt":"2023-04-16T03:03:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c                |  1 +\n builtin/checkout.c     |  1 +\n builtin/update-index.c |  1 +\n cache.h                | 22 ----------------------\n compat/mingw.c         |  1 +\n diff-lib.c             |  1 +\n dir.c                  |  1 +\n entry.c                |  1 +\n merge-recursive.c      |  1 +\n parallel-checkout.c    |  1 +\n pathspec.c             |  1 +\n preload-index.c        |  1 +\n read-cache.c           |  1 +\n run-command.c          |  1 +\n symlinks.c             |  3 ++-\n symlinks.h             | 28 ++++++++++++++++++++++++++++\n unpack-trees.c         |  1 +\n 17 files changed, 44 insertions(+), 23 deletions(-)\n create mode 100644 symlinks.h\n\ndiff --git a/apply.c b/apply.c\nindex 2868cef5ddd..efe2dcb0e62 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -30,6 +30,7 @@\n #include \"apply.h\"\n #include \"entry.h\"\n #include \"setup.h\"\n+#include \"symlinks.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 6f5d82ed3d3..715eeb5048f 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -28,6 +28,7 @@\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 33b00cef151..58bbc80db77 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -23,6 +23,7 @@\n #include \"dir.h\"\n #include \"setup.h\"\n #include \"split-index.h\"\n+#include \"symlinks.h\"\n #include \"fsmonitor.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/cache.h b/cache.h\nindex 2f21704da9e..e225964b3ea 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -614,28 +614,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-struct cache_def {\n-\tstruct strbuf path;\n-\tint flags;\n-\tint track_flags;\n-\tint prefix_len_stat_func;\n-};\n-#define CACHE_DEF_INIT { \\\n-\t.path = STRBUF_INIT, \\\n-}\n-static inline void cache_def_clear(struct cache_def *cache)\n-{\n-\tstrbuf_release(&cache->path);\n-}\n-\n-int has_symlink_leading_path(const char *name, int len);\n-int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);\n-int check_leading_path(const char *name, int len, int warn_on_lstat_err);\n-int has_dirs_only_path(const char *name, int len, int prefix_len);\n-void invalidate_lstat_cache(void);\n-void schedule_dir_for_removal(const char *name, int len);\n-void remove_scheduled_dirs(void);\n-\n struct pack_window {\n \tstruct pack_window *next;\n \tunsigned char *base;\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex abbc3faf32f..d06cdc6254f 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -13,6 +13,7 @@\n #include \"../config.h\"\n #include \"../environment.h\"\n #include \"../trace2.h\"\n+#include \"../symlinks.h\"\n #include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/diff-lib.c b/diff-lib.c\nindex d292405a262..60e979dc1bd 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -14,6 +14,7 @@\n #include \"unpack-trees.h\"\n #include \"refs.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"trace.h\"\n #include \"dir.h\"\n #include \"fsmonitor.h\"\ndiff --git a/dir.c b/dir.c\nindex aa840995c40..ed262fa6e43 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -25,6 +25,7 @@\n #include \"fsmonitor.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\n \ndiff --git a/entry.c b/entry.c\nindex d89e61fa641..91a540bd29f 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -7,6 +7,7 @@\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"progress.h\"\n #include \"fsmonitor.h\"\n #include \"entry.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 9875bdb11cb..d4d2ab05b2e 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -30,6 +30,7 @@\n #include \"string-list.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"tag.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 50fd7fe31ef..7f0569cc930 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -10,6 +10,7 @@\n #include \"run-command.h\"\n #include \"sigchain.h\"\n #include \"streaming.h\"\n+#include \"symlinks.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 6972d515f0c..ec335a214e2 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -8,6 +8,7 @@\n #include \"attr.h\"\n #include \"setup.h\"\n #include \"strvec.h\"\n+#include \"symlinks.h\"\n #include \"quote.h\"\n \n /*\ndiff --git a/preload-index.c b/preload-index.c\nindex 4abf9c983b2..7a26b08c213 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -11,6 +11,7 @@\n #include \"progress.h\"\n #include \"thread-utils.h\"\n #include \"repository.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/read-cache.c b/read-cache.c\nindex f225bf44cd0..206c003e558 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -30,6 +30,7 @@\n #include \"trace2.h\"\n #include \"varint.h\"\n #include \"split-index.h\"\n+#include \"symlinks.h\"\n #include \"utf8.h\"\n #include \"fsmonitor.h\"\n #include \"thread-utils.h\"\ndiff --git a/run-command.c b/run-command.c\nindex e64bb08a5bf..d4247d5fcc6 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n+#include \"symlinks.h\"\n #include \"thread-utils.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/symlinks.c b/symlinks.c\nindex 27ecc93693b..b29e340c2da 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"setup.h\"\n+#include \"symlinks.h\"\n \n static int threaded_check_leading_path(struct cache_def *cache, const char *name,\n \t\t\t\t       int len, int warn_on_lstat_err);\ndiff --git a/symlinks.h b/symlinks.h\nnew file mode 100644\nindex 00000000000..7ae3d5b8569\n--- /dev/null\n+++ b/symlinks.h\n@@ -0,0 +1,28 @@\n+#ifndef SYMLINKS_H\n+#define SYMLINKS_H\n+\n+#include \"strbuf.h\"\n+\n+struct cache_def {\n+\tstruct strbuf path;\n+\tint flags;\n+\tint track_flags;\n+\tint prefix_len_stat_func;\n+};\n+#define CACHE_DEF_INIT { \\\n+\t.path = STRBUF_INIT, \\\n+}\n+static inline void cache_def_clear(struct cache_def *cache)\n+{\n+\tstrbuf_release(&cache->path);\n+}\n+\n+int has_symlink_leading_path(const char *name, int len);\n+int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);\n+int check_leading_path(const char *name, int len, int warn_on_lstat_err);\n+int has_dirs_only_path(const char *name, int len, int prefix_len);\n+void invalidate_lstat_cache(void);\n+void schedule_dir_for_removal(const char *name, int len);\n+void remove_scheduled_dirs(void);\n+\n+#endif /* SYMLINKS_H */\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex c6de2ca5a7e..e8a5295e737 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -18,6 +18,7 @@\n #include \"sparse-index.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"fsmonitor.h\"\n #include \"object-store.h\"\n-- \ngitgitgadget\n\n"},{"id":"475456","messageId":"6d6b80993749b9cec9ba6249d970da421de24e1d.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 01/23] treewide: be explicit about dependence on strbuf.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:03Z","receivedAt":"2023-04-16T03:03:49Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n color.c                       | 1 +\n common-main.c                 | 1 +\n credential.c                  | 1 +\n date.c                        | 1 +\n ll-merge.c                    | 1 +\n split-index.c                 | 1 +\n t/helper/test-mergesort.c     | 1 +\n t/helper/test-oid-array.c     | 1 +\n t/helper/test-oidtree.c       | 1 +\n t/helper/test-parse-options.c | 1 +\n t/helper/test-string-list.c   | 1 +\n wrapper.c                     | 1 +\n ws.c                          | 1 +\n 13 files changed, 13 insertions(+)\n\ndiff --git a/color.c b/color.c\nindex 6031998d3ea..f8a25ca807b 100644\n--- a/color.c\n+++ b/color.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pager.h\"\n+#include \"strbuf.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\n int color_stdout_is_tty = -1;\ndiff --git a/common-main.c b/common-main.c\nindex f3193173535..601a875e2fb 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"attr.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/credential.c b/credential.c\nindex e6417bf8804..42194efc9e0 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -8,6 +8,7 @@\n #include \"url.h\"\n #include \"prompt.h\"\n #include \"sigchain.h\"\n+#include \"strbuf.h\"\n #include \"urlmatch.h\"\n #include \"git-compat-util.h\"\n \ndiff --git a/date.c b/date.c\nindex e944c8905af..bc030da012f 100644\n--- a/date.c\n+++ b/date.c\n@@ -8,6 +8,7 @@\n #include \"date.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\n+#include \"strbuf.h\"\n \n /*\n  * This is like mktime, but without normalization of tm_wday and tm_yday.\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 28bc94c45d6..85517e668e3 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -12,6 +12,7 @@\n #include \"run-command.h\"\n #include \"ll-merge.h\"\n #include \"quote.h\"\n+#include \"strbuf.h\"\n #include \"wrapper.h\"\n \n struct ll_merge_driver;\ndiff --git a/split-index.c b/split-index.c\nindex 5602b74994b..3fc4e91485a 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"mem-pool.h\"\n #include \"split-index.h\"\n+#include \"strbuf.h\"\n #include \"ewah/ewok.h\"\n \n struct split_index *init_split_index(struct index_state *istate)\ndiff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c\nindex 737e0c52358..3aabae6c1c4 100644\n--- a/t/helper/test-mergesort.c\n+++ b/t/helper/test-mergesort.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"mem-pool.h\"\n #include \"mergesort.h\"\n+#include \"strbuf.h\"\n \n static uint32_t minstd_rand(uint32_t *state)\n {\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex fd6f73ea03b..ea3bf278984 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"oid-array.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n \n static int print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex edcb7e9f448..796c9811e0f 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"oidtree.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n \n static enum cb_next print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c\nindex 506835521a4..20a81a1eb21 100644\n--- a/t/helper/test-parse-options.c\n+++ b/t/helper/test-parse-options.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"parse-options.h\"\n+#include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"trace2.h\"\n \ndiff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c\nindex 2123dda85bf..959f27c74c6 100644\n--- a/t/helper/test-string-list.c\n+++ b/t/helper/test-string-list.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"strbuf.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/wrapper.c b/wrapper.c\nindex c130d7518bf..e80f83498d8 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"strbuf.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\n \ndiff --git a/ws.c b/ws.c\nindex da3d0e28cbb..036ccb8ee9d 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"attr.h\"\n+#include \"strbuf.h\"\n \n static struct whitespace_rule {\n \tconst char *rule_name;\n-- \ngitgitgadget\n\n"},{"id":"475457","messageId":"cf28ce0ee209c8441a175aca49929e5c860a0dee.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 04/23] packfile.h: move pack_window and pack_entry from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:06Z","receivedAt":"2023-04-16T03:03:50Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                   | 14 --------------\n packfile.h                | 16 ++++++++++++++--\n t/helper/test-read-midx.c |  1 +\n 3 files changed, 15 insertions(+), 16 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex ffec289dc5d..ffb9028f015 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,20 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-struct pack_window {\n-\tstruct pack_window *next;\n-\tunsigned char *base;\n-\toff_t offset;\n-\tsize_t len;\n-\tunsigned int last_used;\n-\tunsigned int inuse_cnt;\n-};\n-\n-struct pack_entry {\n-\toff_t offset;\n-\tstruct packed_git *p;\n-};\n-\n /* Dumb servers support */\n int update_server_info(int);\n \ndiff --git a/packfile.h b/packfile.h\nindex 665603b696a..c3692308b8d 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -6,10 +6,22 @@\n \n /* in object-store.h */\n struct packed_git;\n-struct pack_entry;\n-struct pack_window;\n struct object_info;\n \n+struct pack_window {\n+\tstruct pack_window *next;\n+\tunsigned char *base;\n+\toff_t offset;\n+\tsize_t len;\n+\tunsigned int last_used;\n+\tunsigned int inuse_cnt;\n+};\n+\n+struct pack_entry {\n+\toff_t offset;\n+\tstruct packed_git *p;\n+};\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\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex 05c4f2b2625..b32abff7f11 100644\n--- a/t/helper/test-read-midx.c\n+++ b/t/helper/test-read-midx.c\n@@ -5,6 +5,7 @@\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"pack-bitmap.h\"\n+#include \"packfile.h\"\n #include \"setup.h\"\n \n static int read_midx_file(const char *object_dir, int show_objects)\n-- \ngitgitgadget\n\n"},{"id":"475458","messageId":"e22c8f242f3fd5fa93920169f15cd78b6cc13703.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 05/23] server-info.h: move declarations for server-info.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:07Z","receivedAt":"2023-04-16T03:03:54Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/receive-pack.c       | 1 +\n builtin/repack.c             | 1 +\n builtin/update-server-info.c | 1 +\n cache.h                      | 3 ---\n server-info.c                | 3 ++-\n server-info.h                | 7 +++++++\n 6 files changed, 12 insertions(+), 4 deletions(-)\n create mode 100644 server-info.h\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 7d921170f1c..dae99e4554d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -33,6 +33,7 @@\n #include \"object-store.h\"\n #include \"protocol.h\"\n #include \"commit-reach.h\"\n+#include \"server-info.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex df4d8e0f0ba..bed2c2aaafb 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -7,6 +7,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n+#include \"server-info.h\"\n #include \"sigchain.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex e7bff27ae40..19dce3c0655 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -3,6 +3,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"server-info.h\"\n \n static const char * const update_server_info_usage[] = {\n \t\"git update-server-info [-f | --force]\",\ndiff --git a/cache.h b/cache.h\nindex ffb9028f015..2eb4546473f 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* Dumb servers support */\n-int update_server_info(int);\n-\n #define COPY_READ_ERROR (-2)\n #define COPY_WRITE_ERROR (-3)\n int copy_fd(int ifd, int ofd);\ndiff --git a/server-info.c b/server-info.c\nindex 68098ddd1ad..55aa04f00ab 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n #include \"environment.h\"\n@@ -11,6 +11,7 @@\n #include \"packfile.h\"\n #include \"object-file.h\"\n #include \"object-store.h\"\n+#include \"server-info.h\"\n #include \"strbuf.h\"\n #include \"wrapper.h\"\n \ndiff --git a/server-info.h b/server-info.h\nnew file mode 100644\nindex 00000000000..13bbde2c55f\n--- /dev/null\n+++ b/server-info.h\n@@ -0,0 +1,7 @@\n+#ifndef SERVER_INFO_H\n+#define SERVER_INFO_H\n+\n+/* Dumb servers support */\n+int update_server_info(int);\n+\n+#endif /* SERVER_INFO_H */\n-- \ngitgitgadget\n\n"},{"id":"475459","messageId":"9d9672ebf52fd1d7925ad58d82695dd21113244d.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 07/23] base85.h: move declarations for base85.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:09Z","receivedAt":"2023-04-16T03:04:00Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c  | 1 +\n base85.c | 3 ++-\n base85.h | 7 +++++++\n cache.h  | 4 ----\n diff.c   | 1 +\n 5 files changed, 11 insertions(+), 5 deletions(-)\n create mode 100644 base85.h\n\ndiff --git a/apply.c b/apply.c\nindex efe2dcb0e62..a65a354eef5 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"base85.h\"\n #include \"config.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/base85.c b/base85.c\nindex 5ca601ee14f..bbacdca31b3 100644\n--- a/base85.c\n+++ b/base85.c\n@@ -1,4 +1,5 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"base85.h\"\n \n #undef DEBUG_85\n \ndiff --git a/base85.h b/base85.h\nnew file mode 100644\nindex 00000000000..c835086e093\n--- /dev/null\n+++ b/base85.h\n@@ -0,0 +1,7 @@\n+#ifndef BASE85_H\n+#define BASE85_H\n+\n+int decode_85(char *dst, const char *line, int linelen);\n+void encode_85(char *buf, const unsigned char *data, int bytes);\n+\n+#endif /* BASE85_H */\ndiff --git a/cache.h b/cache.h\nindex 2b661764794..b89f4c59802 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,10 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* base85 */\n-int decode_85(char *dst, const char *line, int linelen);\n-void encode_85(char *buf, const unsigned char *data, int bytes);\n-\n /* pkt-line.c */\n void packet_trace_identity(const char *prog);\n \ndiff --git a/diff.c b/diff.c\nindex fa86d023196..e697f78a645 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"base85.h\"\n #include \"config.h\"\n #include \"convert.h\"\n #include \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"475460","messageId":"e8efc37ecb289b0f8085fac69ad7a408ed3e7461.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 08/23] pkt-line.h: move declarations for pkt-line.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:10Z","receivedAt":"2023-04-16T03:04:02Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/bundle.c    | 1 +\n builtin/clone.c     | 1 +\n builtin/fetch.c     | 1 +\n builtin/ls-remote.c | 1 +\n builtin/push.c      | 1 +\n cache.h             | 3 ---\n pkt-line.h          | 2 ++\n 7 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex e68fc83d943..584d905d965 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -4,6 +4,7 @@\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n+#include \"pkt-line.h\"\n #include \"cache.h\"\n #include \"bundle.h\"\n \ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 017ebc3faa8..fa300f483e9 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -39,6 +39,7 @@\n #include \"setup.h\"\n #include \"connected.h\"\n #include \"packfile.h\"\n+#include \"pkt-line.h\"\n #include \"list-objects-filter-options.h\"\n #include \"hook.h\"\n #include \"bundle.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 61e8ac113b1..4fee2a62376 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -29,6 +29,7 @@\n #include \"utf8.h\"\n #include \"packfile.h\"\n #include \"pager.h\"\n+#include \"pkt-line.h\"\n #include \"list-objects-filter-options.h\"\n #include \"commit-reach.h\"\n #include \"branch.h\"\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex 11d9424804a..7972febf726 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n+#include \"pkt-line.h\"\n #include \"ref-filter.h\"\n #include \"remote.h\"\n #include \"refs.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 6001e4ae0a4..7d2b0505aac 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -14,6 +14,7 @@\n #include \"remote.h\"\n #include \"transport.h\"\n #include \"parse-options.h\"\n+#include \"pkt-line.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"send-pack.h\"\ndiff --git a/cache.h b/cache.h\nindex b89f4c59802..fde782a96f0 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* pkt-line.c */\n-void packet_trace_identity(const char *prog);\n-\n /* add */\n /*\n  * return 0 if success, 1 - if addition of a file failed and\ndiff --git a/pkt-line.h b/pkt-line.h\nindex 8e9846f3151..7c23a4bfaf7 100644\n--- a/pkt-line.h\n+++ b/pkt-line.h\n@@ -246,4 +246,6 @@ void packet_writer_error(struct packet_writer *writer, const char *fmt, ...);\n void packet_writer_delim(struct packet_writer *writer);\n void packet_writer_flush(struct packet_writer *writer);\n \n+void packet_trace_identity(const char *prog);\n+\n #endif\n-- \ngitgitgadget\n\n"},{"id":"475461","messageId":"11c6cd13e2b15687034b041ac5abc5c9d3906454.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 09/23] match-trees.h: move declarations for match-trees.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:11Z","receivedAt":"2023-04-16T03:04:04Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                     |  4 ----\n match-trees.c               |  1 +\n match-trees.h               | 10 ++++++++++\n merge-ort.c                 |  1 +\n merge-recursive.c           |  1 +\n t/helper/test-match-trees.c |  1 +\n 6 files changed, 14 insertions(+), 4 deletions(-)\n create mode 100644 match-trees.h\n\ndiff --git a/cache.h b/cache.h\nindex fde782a96f0..0570f9ad07d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -603,10 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int\n /* diff.c */\n extern int diff_auto_refresh_index;\n \n-/* match-trees.c */\n-void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);\n-void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);\n-\n /*\n  * whitespace rules.\n  * used by both diff and apply\ndiff --git a/match-trees.c b/match-trees.c\nindex 5877fc64a8f..9b78d99507b 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"match-trees.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"object-store.h\"\ndiff --git a/match-trees.h b/match-trees.h\nnew file mode 100644\nindex 00000000000..e3877acd583\n--- /dev/null\n+++ b/match-trees.h\n@@ -0,0 +1,10 @@\n+#ifndef MATCH_TREES_H\n+#define MATCH_TREES_H\n+\n+struct object_id;\n+struct repository;\n+\n+void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);\n+void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);\n+\n+#endif /* MATCH_TREES_H */\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 2c6a9ed9a41..65837db77f0 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -31,6 +31,7 @@\n #include \"hex.h\"\n #include \"entry.h\"\n #include \"ll-merge.h\"\n+#include \"match-trees.h\"\n #include \"mem-pool.h\"\n #include \"object-name.h\"\n #include \"object-store.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex d4d2ab05b2e..8e87b6386d9 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -22,6 +22,7 @@\n #include \"hex.h\"\n #include \"ll-merge.h\"\n #include \"lockfile.h\"\n+#include \"match-trees.h\"\n #include \"object-file.h\"\n #include \"object-name.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 3808e1ac38b..a498fece7a3 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"match-trees.h\"\n #include \"object-name.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n-- \ngitgitgadget\n\n"},{"id":"475462","messageId":"07e5da241dc2cb6cf6cc6de1051a2ee490bf26c2.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 11/23] versioncmp.h: move declarations for versioncmp.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:13Z","receivedAt":"2023-04-16T03:04:08Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      | 2 --\n ref-filter.c | 1 +\n versioncmp.c | 3 ++-\n versioncmp.h | 6 ++++++\n 4 files changed, 9 insertions(+), 3 deletions(-)\n create mode 100644 versioncmp.h\n\ndiff --git a/cache.h b/cache.h\nindex dde275c9301..6955745cccd 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -648,6 +648,4 @@ int stat_validity_check(struct stat_validity *sv, const char *path);\n  */\n void stat_validity_update(struct stat_validity *sv, int fd);\n \n-int versioncmp(const char *s1, const char *s2);\n-\n #endif /* CACHE_H */\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 57a5884aec7..5387f79be6d 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -19,6 +19,7 @@\n #include \"revision.h\"\n #include \"utf8.h\"\n #include \"version.h\"\n+#include \"versioncmp.h\"\n #include \"trailer.h\"\n #include \"wt-status.h\"\n #include \"commit-slab.h\"\ndiff --git a/versioncmp.c b/versioncmp.c\nindex 069ee94a4d7..9b21ec142dd 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"string-list.h\"\n+#include \"versioncmp.h\"\n \n /*\n  * versioncmp(): copied from string/strverscmp.c in glibc commit\ndiff --git a/versioncmp.h b/versioncmp.h\nnew file mode 100644\nindex 00000000000..879b510e82a\n--- /dev/null\n+++ b/versioncmp.h\n@@ -0,0 +1,6 @@\n+#ifndef VERSIONCMP_H\n+#define VERSIONCMP_H\n+\n+int versioncmp(const char *s1, const char *s2);\n+\n+#endif /* VERSIONCMP_H */\n-- \ngitgitgadget\n\n"},{"id":"475463","messageId":"e600309df1fd700a9b60b31415007f9eed5b7b48.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 10/23] ws.h: move declarations for ws.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:12Z","receivedAt":"2023-04-16T03:04:11Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c       |  1 +\n cache.h       | 26 --------------------------\n config.c      |  1 +\n diff.c        |  1 +\n environment.c |  1 -\n ws.c          |  5 ++++-\n ws.h          | 33 +++++++++++++++++++++++++++++++++\n 7 files changed, 40 insertions(+), 28 deletions(-)\n create mode 100644 ws.h\n\ndiff --git a/apply.c b/apply.c\nindex a65a354eef5..2de8bb203d7 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -32,6 +32,7 @@\n #include \"entry.h\"\n #include \"setup.h\"\n #include \"symlinks.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/cache.h b/cache.h\nindex 0570f9ad07d..dde275c9301 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -603,32 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int\n /* diff.c */\n extern int diff_auto_refresh_index;\n \n-/*\n- * whitespace rules.\n- * used by both diff and apply\n- * last two digits are tab width\n- */\n-#define WS_BLANK_AT_EOL         0100\n-#define WS_SPACE_BEFORE_TAB     0200\n-#define WS_INDENT_WITH_NON_TAB  0400\n-#define WS_CR_AT_EOL           01000\n-#define WS_BLANK_AT_EOF        02000\n-#define WS_TAB_IN_INDENT       04000\n-#define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n-#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)\n-#define WS_TAB_WIDTH_MASK        077\n-/* All WS_* -- when extended, adapt diff.c emit_symbol */\n-#define WS_RULE_MASK           07777\n-extern unsigned whitespace_rule_cfg;\n-unsigned whitespace_rule(struct index_state *, const char *);\n-unsigned parse_whitespace_rule(const char *);\n-unsigned ws_check(const char *line, int len, unsigned ws_rule);\n-void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);\n-char *whitespace_error_string(unsigned ws);\n-void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);\n-int ws_blank_line(const char *line, int len);\n-#define ws_tab_width(rule)     ((rule) & WS_TAB_WIDTH_MASK)\n-\n /* ls-files */\n void overlay_tree_on_index(struct index_state *istate,\n \t\t\t   const char *tree_name, const char *prefix);\ndiff --git a/config.c b/config.c\nindex 9beba19b41c..97063a0743e 100644\n--- a/config.c\n+++ b/config.c\n@@ -35,6 +35,7 @@\n #include \"setup.h\"\n #include \"trace2.h\"\n #include \"worktree.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/diff.c b/diff.c\nindex e697f78a645..73d2ac03673 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -41,6 +41,7 @@\n #include \"object-name.h\"\n #include \"setup.h\"\n #include \"strmap.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n \n #ifdef NO_FAST_WORKING_DIRECTORY\ndiff --git a/environment.c b/environment.c\nindex 8a96997539a..541f0b19acf 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -67,7 +67,6 @@ int read_replace_refs = 1;\n enum eol core_eol = EOL_UNSET;\n int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n char *check_roundtrip_encoding = \"SHIFT-JIS\";\n-unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;\n enum rebase_setup_type autorebase = AUTOREBASE_NEVER;\n enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;\ndiff --git a/ws.c b/ws.c\nindex 036ccb8ee9d..d356d4ec9ee 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -3,9 +3,12 @@\n  *\n  * Copyright (c) 2007 Junio C Hamano\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"attr.h\"\n #include \"strbuf.h\"\n+#include \"ws.h\"\n+\n+unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n \n static struct whitespace_rule {\n \tconst char *rule_name;\ndiff --git a/ws.h b/ws.h\nnew file mode 100644\nindex 00000000000..5ba676c5595\n--- /dev/null\n+++ b/ws.h\n@@ -0,0 +1,33 @@\n+#ifndef WS_H\n+#define WS_H\n+\n+struct index_state;\n+struct strbuf;\n+\n+/*\n+ * whitespace rules.\n+ * used by both diff and apply\n+ * last two digits are tab width\n+ */\n+#define WS_BLANK_AT_EOL         0100\n+#define WS_SPACE_BEFORE_TAB     0200\n+#define WS_INDENT_WITH_NON_TAB  0400\n+#define WS_CR_AT_EOL           01000\n+#define WS_BLANK_AT_EOF        02000\n+#define WS_TAB_IN_INDENT       04000\n+#define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n+#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)\n+#define WS_TAB_WIDTH_MASK        077\n+/* All WS_* -- when extended, adapt diff.c emit_symbol */\n+#define WS_RULE_MASK           07777\n+extern unsigned whitespace_rule_cfg;\n+unsigned whitespace_rule(struct index_state *, const char *);\n+unsigned parse_whitespace_rule(const char *);\n+unsigned ws_check(const char *line, int len, unsigned ws_rule);\n+void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);\n+char *whitespace_error_string(unsigned ws);\n+void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);\n+int ws_blank_line(const char *line, int len);\n+#define ws_tab_width(rule)     ((rule) & WS_TAB_WIDTH_MASK)\n+\n+#endif /* WS_H */\n-- \ngitgitgadget\n\n"},{"id":"475464","messageId":"4c951a53737efec1f4da866a80955b4c34f5e5f4.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 12/23] dir.h: move DTYPE defines from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:14Z","receivedAt":"2023-04-16T03:04:14Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h | 14 --------------\n dir.h   | 15 +++++++++++++++\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 6955745cccd..ad741e70bc2 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -10,20 +10,6 @@\n #include \"object.h\"\n #include \"statinfo.h\"\n \n-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n-#define DTYPE(de)\t((de)->d_type)\n-#else\n-#undef DT_UNKNOWN\n-#undef DT_DIR\n-#undef DT_REG\n-#undef DT_LNK\n-#define DT_UNKNOWN\t0\n-#define DT_DIR\t\t1\n-#define DT_REG\t\t2\n-#define DT_LNK\t\t3\n-#define DTYPE(de)\tDT_UNKNOWN\n-#endif\n-\n /*\n  * Some mode bits are also used internally for computations.\n  *\ndiff --git a/dir.h b/dir.h\nindex 3d6c87387e9..79b85a01ee4 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -640,4 +640,19 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n \n \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n }\n+\n+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#undef DT_UNKNOWN\n+#undef DT_DIR\n+#undef DT_REG\n+#undef DT_LNK\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DT_LNK\t\t3\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n #endif\n-- \ngitgitgadget\n\n"},{"id":"475465","messageId":"e1983d51c05cf85f4ee094a26663b94b99f20c02.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 15/23] cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:17Z","receivedAt":"2023-04-16T03:04:17Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSince cmp_cache_name_compare() was comparing cache_entry structs, it\nwas associated with the cache rather than with trees.  Move the\nfunction.  As a side effect, we can make cache_name_stage_compare()\nstatic as well.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      |  2 +-\n read-cache.c | 13 ++++++++++++-\n tree.c       | 10 ----------\n tree.h       |  1 -\n 4 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 7a46f300d9b..502e4c0b11a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -562,7 +562,7 @@ int base_name_compare(const char *name1, size_t len1, int mode1,\n int df_name_compare(const char *name1, size_t len1, int mode1,\n \t\t    const char *name2, size_t len2, int mode2);\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n+int cmp_cache_name_compare(const void *a_, const void *b_);\n \n /* add */\n /*\ndiff --git a/read-cache.c b/read-cache.c\nindex 206c003e558..8f00da4bf7a 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -567,7 +567,8 @@ int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n \treturn 0;\n }\n \n-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)\n+static int cache_name_stage_compare(const char *name1, int len1, int stage1,\n+\t\t\t\t    const char *name2, int len2, int stage2)\n {\n \tint cmp;\n \n@@ -582,6 +583,16 @@ int cache_name_stage_compare(const char *name1, int len1, int stage1, const char\n \treturn 0;\n }\n \n+int cmp_cache_name_compare(const void *a_, const void *b_)\n+{\n+\tconst struct cache_entry *ce1, *ce2;\n+\n+\tce1 = *((const struct cache_entry **)a_);\n+\tce2 = *((const struct cache_entry **)b_);\n+\treturn cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),\n+\t\t\t\t  ce2->name, ce2->ce_namelen, ce_stage(ce2));\n+}\n+\n static int index_name_stage_pos(struct index_state *istate,\n \t\t\t\tconst char *name, int namelen,\n \t\t\t\tint stage,\ndiff --git a/tree.c b/tree.c\nindex e9d51ce2e00..896b7f4776b 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -94,16 +94,6 @@ int read_tree(struct repository *r,\n \treturn ret;\n }\n \n-int cmp_cache_name_compare(const void *a_, const void *b_)\n-{\n-\tconst struct cache_entry *ce1, *ce2;\n-\n-\tce1 = *((const struct cache_entry **)a_);\n-\tce2 = *((const struct cache_entry **)b_);\n-\treturn cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),\n-\t\t\t\t  ce2->name, ce2->ce_namelen, ce_stage(ce2));\n-}\n-\n struct tree *lookup_tree(struct repository *r, const struct object_id *oid)\n {\n \tstruct object *obj = lookup_object(r, oid);\ndiff --git a/tree.h b/tree.h\nindex 0499ad01aa7..8e3c6d441cc 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -29,7 +29,6 @@ void free_tree_buffer(struct tree *tree);\n /* Parses and returns the tree in the given ent, chasing tags and commits. */\n struct tree *parse_tree_indirect(const struct object_id *oid);\n \n-int cmp_cache_name_compare(const void *a_, const void *b_);\n \n #define READ_TREE_RECURSIVE 1\n typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);\n-- \ngitgitgadget\n\n"},{"id":"475466","messageId":"c72cc0dab90efe7daba56a3d20f6e16f1054ea86.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 16/23] cache,tree: move basic name compare functions from read-cache to tree","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:18Z","receivedAt":"2023-04-16T03:04:20Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nNone of base_name_compare(), df_name_compare(), or name_compare()\ndepended upon a cache_entry or index_state in any way.  By moving these\nfunctions to tree.h, half a dozen other files can stop depending upon\ncache.h (though that change will be made in a later commit).\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      |  5 ----\n read-cache.c | 68 ----------------------------------------------------\n tree.c       | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n tree.h       |  9 +++++++\n 4 files changed, 77 insertions(+), 73 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 502e4c0b11a..591c67b0595 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -557,11 +557,6 @@ extern int verify_ce_order;\n #define DATA_CHANGED    0x0020\n #define TYPE_CHANGED    0x0040\n \n-int base_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t      const char *name2, size_t len2, int mode2);\n-int df_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t    const char *name2, size_t len2, int mode2);\n-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cmp_cache_name_compare(const void *a_, const void *b_);\n \n /* add */\ndiff --git a/read-cache.c b/read-cache.c\nindex 8f00da4bf7a..b3e2917ddc9 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -499,74 +499,6 @@ int ie_modified(struct index_state *istate,\n \treturn 0;\n }\n \n-int base_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t      const char *name2, size_t len2, int mode2)\n-{\n-\tunsigned char c1, c2;\n-\tsize_t len = len1 < len2 ? len1 : len2;\n-\tint cmp;\n-\n-\tcmp = memcmp(name1, name2, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\tc1 = name1[len];\n-\tc2 = name2[len];\n-\tif (!c1 && S_ISDIR(mode1))\n-\t\tc1 = '/';\n-\tif (!c2 && S_ISDIR(mode2))\n-\t\tc2 = '/';\n-\treturn (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;\n-}\n-\n-/*\n- * df_name_compare() is identical to base_name_compare(), except it\n- * compares conflicting directory/file entries as equal. Note that\n- * while a directory name compares as equal to a regular file, they\n- * then individually compare _differently_ to a filename that has\n- * a dot after the basename (because '\\0' < '.' < '/').\n- *\n- * This is used by routines that want to traverse the git namespace\n- * but then handle conflicting entries together when possible.\n- */\n-int df_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t    const char *name2, size_t len2, int mode2)\n-{\n-\tunsigned char c1, c2;\n-\tsize_t len = len1 < len2 ? len1 : len2;\n-\tint cmp;\n-\n-\tcmp = memcmp(name1, name2, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\t/* Directories and files compare equal (same length, same name) */\n-\tif (len1 == len2)\n-\t\treturn 0;\n-\tc1 = name1[len];\n-\tif (!c1 && S_ISDIR(mode1))\n-\t\tc1 = '/';\n-\tc2 = name2[len];\n-\tif (!c2 && S_ISDIR(mode2))\n-\t\tc2 = '/';\n-\tif (c1 == '/' && !c2)\n-\t\treturn 0;\n-\tif (c2 == '/' && !c1)\n-\t\treturn 0;\n-\treturn c1 - c2;\n-}\n-\n-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n-{\n-\tsize_t min_len = (len1 < len2) ? len1 : len2;\n-\tint cmp = memcmp(name1, name2, min_len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\tif (len1 < len2)\n-\t\treturn -1;\n-\tif (len1 > len2)\n-\t\treturn 1;\n-\treturn 0;\n-}\n-\n static int cache_name_stage_compare(const char *name1, int len1, int stage1,\n \t\t\t\t    const char *name2, int len2, int stage2)\n {\ndiff --git a/tree.c b/tree.c\nindex 896b7f4776b..f242a7ab691 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -94,6 +94,74 @@ int read_tree(struct repository *r,\n \treturn ret;\n }\n \n+int base_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t      const char *name2, size_t len2, int mode2)\n+{\n+\tunsigned char c1, c2;\n+\tsize_t len = len1 < len2 ? len1 : len2;\n+\tint cmp;\n+\n+\tcmp = memcmp(name1, name2, len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\tc1 = name1[len];\n+\tc2 = name2[len];\n+\tif (!c1 && S_ISDIR(mode1))\n+\t\tc1 = '/';\n+\tif (!c2 && S_ISDIR(mode2))\n+\t\tc2 = '/';\n+\treturn (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;\n+}\n+\n+/*\n+ * df_name_compare() is identical to base_name_compare(), except it\n+ * compares conflicting directory/file entries as equal. Note that\n+ * while a directory name compares as equal to a regular file, they\n+ * then individually compare _differently_ to a filename that has\n+ * a dot after the basename (because '\\0' < '.' < '/').\n+ *\n+ * This is used by routines that want to traverse the git namespace\n+ * but then handle conflicting entries together when possible.\n+ */\n+int df_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t    const char *name2, size_t len2, int mode2)\n+{\n+\tunsigned char c1, c2;\n+\tsize_t len = len1 < len2 ? len1 : len2;\n+\tint cmp;\n+\n+\tcmp = memcmp(name1, name2, len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\t/* Directories and files compare equal (same length, same name) */\n+\tif (len1 == len2)\n+\t\treturn 0;\n+\tc1 = name1[len];\n+\tif (!c1 && S_ISDIR(mode1))\n+\t\tc1 = '/';\n+\tc2 = name2[len];\n+\tif (!c2 && S_ISDIR(mode2))\n+\t\tc2 = '/';\n+\tif (c1 == '/' && !c2)\n+\t\treturn 0;\n+\tif (c2 == '/' && !c1)\n+\t\treturn 0;\n+\treturn c1 - c2;\n+}\n+\n+int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n+{\n+\tsize_t min_len = (len1 < len2) ? len1 : len2;\n+\tint cmp = memcmp(name1, name2, min_len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\tif (len1 < len2)\n+\t\treturn -1;\n+\tif (len1 > len2)\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n struct tree *lookup_tree(struct repository *r, const struct object_id *oid)\n {\n \tstruct object *obj = lookup_object(r, oid);\ndiff --git a/tree.h b/tree.h\nindex 8e3c6d441cc..1b5ecbda6b3 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -29,6 +29,15 @@ void free_tree_buffer(struct tree *tree);\n /* Parses and returns the tree in the given ent, chasing tags and commits. */\n struct tree *parse_tree_indirect(const struct object_id *oid);\n \n+/*\n+ * Functions for comparing pathnames\n+ */\n+int base_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t      const char *name2, size_t len2, int mode2);\n+int df_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t    const char *name2, size_t len2, int mode2);\n+int name_compare(const char *name1, size_t len1,\n+\t\t const char *name2, size_t len2);\n \n #define READ_TREE_RECURSIVE 1\n typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);\n-- \ngitgitgadget\n\n"},{"id":"475467","messageId":"34c9034e8edb997cfd38a69dd71bfa41070f4397.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 18/23] cache.h: remove unnecessary headers","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:20Z","receivedAt":"2023-04-16T03:04:22Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                              | 2 --\n compat/fsmonitor/fsm-ipc-darwin.c    | 1 +\n compat/fsmonitor/fsm-listen-darwin.c | 1 +\n 3 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 591c67b0595..bdedb87e83b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -4,8 +4,6 @@\n #include \"git-compat-util.h\"\n #include \"strbuf.h\"\n #include \"hashmap.h\"\n-#include \"gettext.h\"\n-#include \"string-list.h\"\n #include \"pathspec.h\"\n #include \"object.h\"\n #include \"statinfo.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex e62f093cc19..bc68dca0cae 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 5eb6402ab82..18c0e3913dc 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -29,6 +29,7 @@\n #include \"fsmonitor--daemon.h\"\n #include \"fsmonitor-path-utils.h\"\n #include \"gettext.h\"\n+#include \"string-list.h\"\n \n struct fsm_listen_data\n {\n-- \ngitgitgadget\n\n"},{"id":"475468","messageId":"dec377e17f5821772b2126d61800e3b6d6c912bf.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 13/23] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:15Z","receivedAt":"2023-04-16T03:04:27Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nS_DIFFTREE_IFXMIN_NEQ is *only* used in tree-diff.c, so there is no\npoint exposing it in cache.h.  Move it to tree-diff.c.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h     | 15 ---------------\n tree-diff.c | 13 +++++++++++++\n 2 files changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex ad741e70bc2..7a46f300d9b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -10,21 +10,6 @@\n #include \"object.h\"\n #include \"statinfo.h\"\n \n-/*\n- * Some mode bits are also used internally for computations.\n- *\n- * They *must* not overlap with any valid modes, and they *must* not be emitted\n- * to outside world - i.e. appear on disk or network. In other words, it's just\n- * temporary fields, which we internally use, but they have to stay in-house.\n- *\n- * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n- *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n- */\n-\n-/* used internally in tree-diff */\n-#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n-\n-\n /*\n  * Basic data structures for the directory cache\n  */\ndiff --git a/tree-diff.c b/tree-diff.c\nindex 69031d7cbae..a76e6dae619 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -6,6 +6,19 @@\n #include \"diffcore.h\"\n #include \"tree.h\"\n \n+/*\n+ * Some mode bits are also used internally for computations.\n+ *\n+ * They *must* not overlap with any valid modes, and they *must* not be emitted\n+ * to outside world - i.e. appear on disk or network. In other words, it's just\n+ * temporary fields, which we internally use, but they have to stay in-house.\n+ *\n+ * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n+ *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n+ */\n+\n+#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n+\n /*\n  * internal mode marker, saying a tree entry != entry of tp[imin]\n  * (see ll_diff_tree_paths for what it means there)\n-- \ngitgitgadget\n\n"},{"id":"475469","messageId":"8e747e889fbe680e83cd9880cc4b0ff1430eb93b.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 19/23] fsmonitor: reduce includes of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:21Z","receivedAt":"2023-04-16T03:04:31Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/fsmonitor/fsm-health-darwin.c | 2 +-\n compat/fsmonitor/fsm-ipc-darwin.c    | 2 +-\n compat/fsmonitor/fsm-listen-darwin.c | 2 +-\n fsmonitor--daemon.h                  | 1 -\n 4 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/fsmonitor/fsm-health-darwin.c b/compat/fsmonitor/fsm-health-darwin.c\nindex b9f709e8548..4c291f8a066 100644\n--- a/compat/fsmonitor/fsm-health-darwin.c\n+++ b/compat/fsmonitor/fsm-health-darwin.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"fsmonitor.h\"\n #include \"fsm-health.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex bc68dca0cae..793073aaa72 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 18c0e3913dc..23e24b4b374 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -23,7 +23,7 @@\n #endif\n #endif\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"fsmonitor.h\"\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\ndiff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h\nindex e24838f9a86..70d776c54f6 100644\n--- a/fsmonitor--daemon.h\n+++ b/fsmonitor--daemon.h\n@@ -3,7 +3,6 @@\n \n #ifdef HAVE_FSMONITOR_DAEMON_BACKEND\n \n-#include \"cache.h\"\n #include \"dir.h\"\n #include \"run-command.h\"\n #include \"simple-ipc.h\"\n-- \ngitgitgadget\n\n"},{"id":"475470","messageId":"1edd8fd72a7e0580caaddf9a5e23502bdbc6ab8d.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 17/23] treewide: remove cache.h inclusion due to previous changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:19Z","receivedAt":"2023-04-16T03:04:33Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n archive-zip.c                 | 2 +-\n bundle-uri.c                  | 2 +-\n color.c                       | 2 +-\n combine-diff.c                | 2 +-\n common-main.c                 | 2 +-\n config.c                      | 2 +-\n copy.c                        | 2 +-\n credential.c                  | 2 +-\n daemon.c                      | 2 +-\n date.c                        | 2 +-\n diagnose.c                    | 2 +-\n environment.c                 | 2 +-\n ll-merge.c                    | 2 +-\n match-trees.c                 | 2 +-\n midx.c                        | 2 +-\n object-file.c                 | 2 +-\n packfile.c                    | 2 +-\n pkt-line.c                    | 2 +-\n range-diff.c                  | 2 +-\n ref-filter.c                  | 2 +-\n t/helper/test-match-trees.c   | 1 -\n t/helper/test-mergesort.c     | 1 -\n t/helper/test-oid-array.c     | 1 -\n t/helper/test-oidtree.c       | 1 -\n t/helper/test-parse-options.c | 1 -\n t/helper/test-read-midx.c     | 1 -\n t/helper/test-string-list.c   | 1 -\n tree-diff.c                   | 2 +-\n tree-walk.c                   | 2 +-\n tree.c                        | 2 +-\n wrapper.c                     | 3 ++-\n 31 files changed, 25 insertions(+), 31 deletions(-)\n\ndiff --git a/archive-zip.c b/archive-zip.c\nindex ef538a90df4..d0d065a312e 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -1,7 +1,7 @@\n /*\n  * Copyright (c) 2006 Rene Scharfe\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"archive.h\"\n #include \"gettext.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 6d44662ee1f..ec1552bbca2 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"bundle-uri.h\"\n #include \"bundle.h\"\n #include \"copy.h\"\ndiff --git a/color.c b/color.c\nindex f8a25ca807b..83abb11eda0 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"color.h\"\n #include \"editor.h\"\ndiff --git a/combine-diff.c b/combine-diff.c\nindex f7e9fb57473..f8d61965776 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\n #include \"convert.h\"\ndiff --git a/common-main.c b/common-main.c\nindex 8ab50fa37a4..033778b3c56 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"attr.h\"\ndiff --git a/config.c b/config.c\nindex 97063a0743e..2a9ed27efe5 100644\n--- a/config.c\n+++ b/config.c\n@@ -5,7 +5,7 @@\n  * Copyright (C) Johannes Schindelin, 2005\n  *\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"advice.h\"\n #include \"alloc.h\"\ndiff --git a/copy.c b/copy.c\nindex 923d8a6dc61..882c79cffb0 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"copy.h\"\n #include \"path.h\"\n #include \"wrapper.h\"\ndiff --git a/credential.c b/credential.c\nindex 42194efc9e0..a600d0c1ac1 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"credential.h\"\ndiff --git a/daemon.c b/daemon.c\nindex f89f99d7ef4..7139cc201d7 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/date.c b/date.c\nindex bc030da012f..a6ca6b318bd 100644\n--- a/date.c\n+++ b/date.c\n@@ -4,7 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"date.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\ndiff --git a/diagnose.c b/diagnose.c\nindex f9a2496c7ff..58f49f76c7a 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diagnose.h\"\n #include \"compat/disk.h\"\n #include \"archive.h\"\ndiff --git a/environment.c b/environment.c\nindex 541f0b19acf..28d18eaca8e 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -7,7 +7,7 @@\n  * even if you might want to know where the git directory etc\n  * are.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"branch.h\"\n #include \"convert.h\"\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 85517e668e3..1993530688e 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -4,7 +4,7 @@\n  * Copyright (c) 2007 Junio C Hamano\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"convert.h\"\n #include \"attr.h\"\ndiff --git a/match-trees.c b/match-trees.c\nindex 9b78d99507b..6bc8eb76477 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"tree.h\"\ndiff --git a/midx.c b/midx.c\nindex 2d0da573281..c7679c3c4f5 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 8163ddbaddd..8e0df7360ae 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -6,7 +6,7 @@\n  * This handles basic git object files - packing, unpacking,\n  * creation etc.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/packfile.c b/packfile.c\nindex 9ae2278c22e..1ee9f65242c 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 8b5fa788517..62b4208b66e 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"copy.h\"\n #include \"pkt-line.h\"\n #include \"gettext.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex a1e0cffb9f6..6a704e6f471 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"range-diff.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 5387f79be6d..594e66ad361 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 3c62e33ccdf..a0afc1b4bc8 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"object-name.h\"\ndiff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c\nindex 3aabae6c1c4..42ccc870516 100644\n--- a/t/helper/test-mergesort.c\n+++ b/t/helper/test-mergesort.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"mem-pool.h\"\n #include \"mergesort.h\"\n #include \"strbuf.h\"\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex ea3bf278984..241e5da3157 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"oid-array.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex 796c9811e0f..dc509fb8065 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"oidtree.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c\nindex 20a81a1eb21..3003987ec17 100644\n--- a/t/helper/test-parse-options.c\n+++ b/t/helper/test-parse-options.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex b32abff7f11..211addaa005 100644\n--- a/t/helper/test-read-midx.c\n+++ b/t/helper/test-read-midx.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"midx.h\"\n #include \"repository.h\"\ndiff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c\nindex 959f27c74c6..042c6ff0059 100644\n--- a/t/helper/test-string-list.c\n+++ b/t/helper/test-string-list.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n \ndiff --git a/tree-diff.c b/tree-diff.c\nindex a76e6dae619..9ea2dd7a6c3 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -1,7 +1,7 @@\n /*\n  * Helper functions for tree diff generation\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"tree.h\"\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 2993c48c2f3..d3c48e06df0 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"tree-walk.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\ndiff --git a/tree.c b/tree.c\nindex f242a7ab691..0dd2029a8a2 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"cache-tree.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 5ab0460de5c..67f5f5dbe19 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -1,10 +1,11 @@\n /*\n  * Various trivial helper wrappers around standard functions\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"object.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\n-- \ngitgitgadget\n\n"},{"id":"475472","messageId":"1c6989ae456c86850761b079384f1505735e317a.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:16Z","receivedAt":"2023-04-16T03:04:36Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nPreviously, hash.h depended upon and included repository.h, due to\nthe definition and use of the_hash_algo (defined as\nthe_repository->hash_algo).  Move this #define, and the associated\ninline functions that depend upon it, from hash.h to repository.h.\nDue to that movement, reverse the dependencies so repository.h includes\nhash.h.\n\nThis allows hash.h and object.h to be fairly small, minimal headers.  It\nalso exposes a lot of hidden dependencies on both path.h (which was\nbrought in by repository.h) and repository.h (which was previously\nimplicitly brought in by object.h).\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n alloc.c                                      |  1 +\n branch.c                                     |  1 +\n builtin/apply.c                              |  1 +\n builtin/archive.c                            |  1 +\n builtin/bundle.c                             |  1 +\n builtin/check-attr.c                         |  1 +\n builtin/check-ignore.c                       |  1 +\n builtin/checkout-index.c                     |  1 +\n builtin/clean.c                              |  1 +\n builtin/config.c                             |  1 +\n builtin/credential-cache.c                   |  1 +\n builtin/credential-store.c                   |  1 +\n builtin/for-each-repo.c                      |  2 +\n builtin/help.c                               |  1 +\n builtin/init-db.c                            |  1 +\n builtin/merge-index.c                        |  1 +\n builtin/merge-recursive.c                    |  1 +\n builtin/mv.c                                 |  1 +\n builtin/push.c                               |  1 +\n builtin/read-tree.c                          |  1 +\n builtin/rerere.c                             |  1 +\n builtin/rm.c                                 |  1 +\n builtin/show-branch.c                        |  1 +\n builtin/show-index.c                         |  1 +\n builtin/update-index.c                       |  1 +\n builtin/update-ref.c                         |  1 +\n builtin/upload-archive.c                     |  1 +\n builtin/worktree.c                           |  1 +\n checkout.c                                   |  1 +\n chunk-format.c                               |  1 +\n common-main.c                                |  1 +\n compat/fsmonitor/fsm-ipc-darwin.c            |  1 +\n compat/fsmonitor/fsm-ipc-win32.c             |  1 +\n compat/precompose_utf8.c                     |  1 +\n compat/win32/trace2_win32_process_info.c     |  1 +\n copy.c                                       |  1 +\n csum-file.c                                  |  1 +\n daemon.c                                     |  1 +\n editor.c                                     |  1 +\n exec-cmd.c                                   |  1 +\n fsmonitor-ipc.c                              |  1 +\n gpg-interface.c                              |  1 +\n hash-lookup.c                                |  1 +\n hash.h                                       | 97 --------------------\n hex.c                                        |  1 +\n hook.c                                       |  1 +\n khash.h                                      |  1 +\n merge-ort-wrappers.c                         |  1 +\n negotiator/default.c                         |  1 +\n negotiator/skipping.c                        |  1 +\n object-file.h                                |  2 +\n object.h                                     |  1 +\n oid-array.h                                  |  1 +\n oidmap.c                                     |  1 +\n oidtree.c                                    |  1 +\n parallel-checkout.c                          |  1 +\n pathspec.c                                   |  1 +\n progress.c                                   |  1 +\n rebase-interactive.c                         |  1 +\n refs/files-backend.c                         |  1 +\n refs/packed-backend.c                        |  1 +\n refs/ref-cache.c                             |  1 +\n refs/ref-cache.h                             |  1 +\n refspec.c                                    |  1 +\n repository.h                                 | 96 +++++++++++++++++++\n resolve-undo.c                               |  1 +\n split-index.c                                |  1 +\n strbuf.c                                     |  1 +\n t/helper/test-bloom.c                        |  1 +\n t/helper/test-cache-tree.c                   |  1 +\n t/helper/test-dump-cache-tree.c              |  1 +\n t/helper/test-dump-fsmonitor.c               |  1 +\n t/helper/test-dump-untracked-cache.c         |  1 +\n t/helper/test-example-decorate.c             |  1 +\n t/helper/test-fsmonitor-client.c             |  1 +\n t/helper/test-lazy-init-name-hash.c          |  1 +\n t/helper/test-match-trees.c                  |  1 +\n t/helper/test-oidmap.c                       |  1 +\n t/helper/test-path-utils.c                   |  1 +\n t/helper/test-read-cache.c                   |  1 +\n t/helper/test-scrap-cache-tree.c             |  1 +\n t/helper/test-submodule-config.c             |  1 +\n t/helper/test-submodule-nested-repo-config.c |  1 +\n t/helper/test-submodule.c                    |  1 +\n t/helper/test-trace2.c                       |  1 +\n t/helper/test-write-cache.c                  |  1 +\n trace2.c                                     |  1 +\n trace2/tr2_tgt_event.c                       |  1 +\n trace2/tr2_tgt_normal.c                      |  1 +\n trace2/tr2_tgt_perf.c                        |  1 +\n tree-walk.h                                  |  1 +\n tree.h                                       |  1 +\n wrapper.c                                    |  1 +\n 93 files changed, 189 insertions(+), 97 deletions(-)\n\ndiff --git a/alloc.c b/alloc.c\nindex 2886aa93543..377e80f5dda 100644\n--- a/alloc.c\n+++ b/alloc.c\n@@ -13,6 +13,7 @@\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\n+#include \"repository.h\"\n #include \"tag.h\"\n #include \"alloc.h\"\n \ndiff --git a/branch.c b/branch.c\nindex 7df982693af..9415ee3f340 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -9,6 +9,7 @@\n #include \"refs.h\"\n #include \"refspec.h\"\n #include \"remote.h\"\n+#include \"repository.h\"\n #include \"sequencer.h\"\n #include \"commit.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex fe72c0ec3eb..e3ff02a09e3 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"apply.h\"\n \n static const char * const apply_usage[] = {\ndiff --git a/builtin/archive.c b/builtin/archive.c\nindex d13934f1a80..b0eaa3c14a3 100644\n--- a/builtin/archive.c\n+++ b/builtin/archive.c\n@@ -9,6 +9,7 @@\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"sideband.h\"\n \n static void create_output_file(const char *output_file)\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 584d905d965..44113389d7a 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -5,6 +5,7 @@\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"cache.h\"\n #include \"bundle.h\"\n \ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 037bf1aaa2a..b2b678847f5 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -7,6 +7,7 @@\n #include \"gettext.h\"\n #include \"object-name.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"parse-options.h\"\n #include \"write-or-die.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 9401dad0070..e4b78782a32 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -7,6 +7,7 @@\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"submodule.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 7df673e3e70..9375a05539f 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -11,6 +11,7 @@\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\n #include \"entry.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 14c0d555eac..78852d28cec 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -14,6 +14,7 @@\n #include \"dir.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 9401f1e5e3b..7efcf2d2159 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -10,6 +10,7 @@\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 508da4c6e4d..204e78ac772 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"wrapper.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex 8977604eb9d..30c6ccf56c0 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"credential.h\"\n+#include \"path.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n #include \"write-or-die.h\"\ndiff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c\nindex 27425c2fc9e..c28b0b3543a 100644\n--- a/builtin/for-each-repo.c\n+++ b/builtin/for-each-repo.c\n@@ -3,6 +3,8 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"string-list.h\"\n \ndiff --git a/builtin/help.c b/builtin/help.c\nindex 128aa83099a..d3cf4af3f6e 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -8,6 +8,7 @@\n #include \"gettext.h\"\n #include \"pager.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"run-command.h\"\n #include \"config-list.h\"\n #include \"help.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex cda6ee75eb5..aef40361052 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -14,6 +14,7 @@\n #include \"exec-cmd.h\"\n #include \"object-file.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\ndiff --git a/builtin/merge-index.c b/builtin/merge-index.c\nindex c875f5d37ee..f044382ed8f 100644\n--- a/builtin/merge-index.c\n+++ b/builtin/merge-index.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n \n static const char *pgm;\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex fa1035405c3..eae25c9486e 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -6,6 +6,7 @@\n #include \"tag.h\"\n #include \"merge-recursive.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"xdiff-interface.h\"\n \n static const char builtin_merge_recursive_usage[] =\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 32935af48e6..665bd274485 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -18,6 +18,7 @@\n #include \"cache-tree.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"entry.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 7d2b0505aac..4e5780dd50d 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -15,6 +15,7 @@\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"send-pack.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex d61cbad96de..440f19b1b87 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -19,6 +19,7 @@\n #include \"dir.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"resolve-undo.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex d4a03707b1a..d4bd52797f4 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\n #include \"wrapper.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex d36072252e7..ccbce94d07d 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -15,6 +15,7 @@\n #include \"tree-walk.h\"\n #include \"object-name.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 20030b75e39..04167b14060 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -10,6 +10,7 @@\n #include \"strvec.h\"\n #include \"object-name.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"dir.h\"\n #include \"commit-slab.h\"\n #include \"date.h\"\ndiff --git a/builtin/show-index.c b/builtin/show-index.c\nindex d4bbbbcd6ce..6608b5d252e 100644\n--- a/builtin/show-index.c\n+++ b/builtin/show-index.c\n@@ -4,6 +4,7 @@\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n \n static const char *const show_index_usage[] = {\n \t\"git show-index [--object-format=<hash-algorithm>]\",\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 58bbc80db77..df36bc0a42d 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -21,6 +21,7 @@\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"split-index.h\"\n #include \"symlinks.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 6ca85420c3b..ef1fcb86718 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -6,6 +6,7 @@\n #include \"object-name.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"strvec.h\"\n \n static const char * const git_update_ref_usage[] = {\ndiff --git a/builtin/upload-archive.c b/builtin/upload-archive.c\nindex 945ee2b4126..5be97ca1af5 100644\n--- a/builtin/upload-archive.c\n+++ b/builtin/upload-archive.c\n@@ -6,6 +6,7 @@\n #include \"archive.h\"\n #include \"pkt-line.h\"\n #include \"sideband.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"strvec.h\"\n \ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 0b411e9deee..5d3ca819e76 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -14,6 +14,7 @@\n #include \"strvec.h\"\n #include \"branch.h\"\n #include \"refs.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"hook.h\"\n #include \"sigchain.h\"\ndiff --git a/checkout.c b/checkout.c\nindex 04238b27133..4256e71a7c4 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -2,6 +2,7 @@\n #include \"object-name.h\"\n #include \"remote.h\"\n #include \"refspec.h\"\n+#include \"repository.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n #include \"strbuf.h\"\ndiff --git a/chunk-format.c b/chunk-format.c\nindex 60a73c1b140..6bd87b7de89 100644\n--- a/chunk-format.c\n+++ b/chunk-format.c\n@@ -3,6 +3,7 @@\n #include \"chunk-format.h\"\n #include \"csum-file.h\"\n #include \"gettext.h\"\n+#include \"repository.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/common-main.c b/common-main.c\nindex 601a875e2fb..8ab50fa37a4 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -2,6 +2,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"attr.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex eb25123fa12..e62f093cc19 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c\nindex c9536dfb666..8928fa93ce2 100644\n--- a/compat/fsmonitor/fsm-ipc-win32.c\n+++ b/compat/fsmonitor/fsm-ipc-win32.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"path.h\"\n \n const char *fsmonitor_ipc__get_path(struct repository *r) {\n \tstatic char *ret;\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 8a9881db077..a4d11376ba5 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"path.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\n \ndiff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c\nindex e3e895c78a2..a4e33768f43 100644\n--- a/compat/win32/trace2_win32_process_info.c\n+++ b/compat/win32/trace2_win32_process_info.c\n@@ -1,5 +1,6 @@\n #include \"../../cache.h\"\n #include \"../../json-writer.h\"\n+#include \"../../repository.h\"\n #include \"../../trace2.h\"\n #include \"lazyload.h\"\n #include <Psapi.h>\ndiff --git a/copy.c b/copy.c\nindex db6b615c188..923d8a6dc61 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"copy.h\"\n+#include \"path.h\"\n #include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\ndiff --git a/csum-file.c b/csum-file.c\nindex 82ae2973d30..2d14b76c533 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -10,6 +10,7 @@\n #include \"git-compat-util.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n+#include \"repository.h\"\n #include \"wrapper.h\"\n \n static void verify_buffer_or_die(struct hashfile *f,\ndiff --git a/daemon.c b/daemon.c\nindex 75c3c064574..f89f99d7ef4 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -3,6 +3,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\n+#include \"path.h\"\n #include \"pkt-line.h\"\n #include \"protocol.h\"\n #include \"run-command.h\"\ndiff --git a/editor.c b/editor.c\nindex b34e10606d2..38c5dbbb79b 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -6,6 +6,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\n+#include \"path.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 6f618463896..1e34e48c0e4 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -3,6 +3,7 @@\n #include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n+#include \"path.h\"\n #include \"quote.h\"\n #include \"strvec.h\"\n #include \"trace.h\"\ndiff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c\nindex 866828e2992..6a6a89764a6 100644\n--- a/fsmonitor-ipc.c\n+++ b/fsmonitor-ipc.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex aceeb083367..8615dcd4b4b 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -7,6 +7,7 @@\n #include \"dir.h\"\n #include \"ident.h\"\n #include \"gpg-interface.h\"\n+#include \"path.h\"\n #include \"sigchain.h\"\n #include \"tempfile.h\"\n #include \"alias.h\"\ndiff --git a/hash-lookup.c b/hash-lookup.c\nindex b98ed5e11e8..68cf6d03bf3 100644\n--- a/hash-lookup.c\n+++ b/hash-lookup.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"hash-lookup.h\"\n+#include \"repository.h\"\n \n static uint32_t take2(const struct object_id *oid, size_t ofs)\n {\ndiff --git a/hash.h b/hash.h\nindex d39f73618cb..ed963816289 100644\n--- a/hash.h\n+++ b/hash.h\n@@ -1,8 +1,6 @@\n #ifndef HASH_H\n #define HASH_H\n \n-#include \"repository.h\"\n-\n #if defined(SHA1_APPLE)\n #include <CommonCrypto/CommonDigest.h>\n #elif defined(SHA1_OPENSSL)\n@@ -230,8 +228,6 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n \treturn p - hash_algos;\n }\n \n-#define the_hash_algo the_repository->hash_algo\n-\n const struct object_id *null_oid(void);\n \n static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n@@ -245,21 +241,6 @@ static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *\n \treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n }\n \n-static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n-{\n-\treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n-}\n-\n-static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n-{\n-\tconst struct git_hash_algo *algop;\n-\tif (!oid1->algo)\n-\t\talgop = the_hash_algo;\n-\telse\n-\t\talgop = &hash_algos[oid1->algo];\n-\treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n-}\n-\n static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n {\n \t/*\n@@ -271,53 +252,12 @@ static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *s\n \treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n }\n \n-static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n-{\n-\treturn hasheq_algop(sha1, sha2, the_hash_algo);\n-}\n-\n-static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n-{\n-\tconst struct git_hash_algo *algop;\n-\tif (!oid1->algo)\n-\t\talgop = the_hash_algo;\n-\telse\n-\t\talgop = &hash_algos[oid1->algo];\n-\treturn hasheq_algop(oid1->hash, oid2->hash, algop);\n-}\n-\n-static inline int is_null_oid(const struct object_id *oid)\n-{\n-\treturn oideq(oid, null_oid());\n-}\n-\n-static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n-{\n-\tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n-}\n-\n static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n {\n \tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n \tdst->algo = src->algo;\n }\n \n-/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n-static inline void oidcpy_with_padding(struct object_id *dst,\n-\t\t\t\t       const struct object_id *src)\n-{\n-\tsize_t hashsz;\n-\n-\tif (!src->algo)\n-\t\thashsz = the_hash_algo->rawsz;\n-\telse\n-\t\thashsz = hash_algos[src->algo].rawsz;\n-\n-\tmemcpy(dst->hash, src->hash, hashsz);\n-\tmemset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz);\n-\tdst->algo = src->algo;\n-}\n-\n static inline struct object_id *oiddup(const struct object_id *src)\n {\n \tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n@@ -325,43 +265,6 @@ static inline struct object_id *oiddup(const struct object_id *src)\n \treturn dst;\n }\n \n-static inline void hashclr(unsigned char *hash)\n-{\n-\tmemset(hash, 0, the_hash_algo->rawsz);\n-}\n-\n-static inline void oidclr(struct object_id *oid)\n-{\n-\tmemset(oid->hash, 0, GIT_MAX_RAWSZ);\n-\toid->algo = hash_algo_by_ptr(the_hash_algo);\n-}\n-\n-static inline void oidread(struct object_id *oid, const unsigned char *hash)\n-{\n-\tmemcpy(oid->hash, hash, the_hash_algo->rawsz);\n-\toid->algo = hash_algo_by_ptr(the_hash_algo);\n-}\n-\n-static inline int is_empty_blob_sha1(const unsigned char *sha1)\n-{\n-\treturn hasheq(sha1, the_hash_algo->empty_blob->hash);\n-}\n-\n-static inline int is_empty_blob_oid(const struct object_id *oid)\n-{\n-\treturn oideq(oid, the_hash_algo->empty_blob);\n-}\n-\n-static inline int is_empty_tree_sha1(const unsigned char *sha1)\n-{\n-\treturn hasheq(sha1, the_hash_algo->empty_tree->hash);\n-}\n-\n-static inline int is_empty_tree_oid(const struct object_id *oid)\n-{\n-\treturn oideq(oid, the_hash_algo->empty_tree);\n-}\n-\n static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n {\n \toid->algo = hash_algo_by_ptr(algop);\ndiff --git a/hex.c b/hex.c\nindex 0a1bddc1284..f6849b51b28 100644\n--- a/hex.c\n+++ b/hex.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n \n const signed char hexval_table[256] = {\n \t -1, -1, -1, -1, -1, -1, -1, -1,\t\t/* 00-07 */\ndiff --git a/hook.c b/hook.c\nindex 76e322f5804..3ca5e60895d 100644\n--- a/hook.c\n+++ b/hook.c\n@@ -2,6 +2,7 @@\n #include \"advice.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"path.h\"\n #include \"run-command.h\"\n #include \"config.h\"\n #include \"strbuf.h\"\ndiff --git a/khash.h b/khash.h\nindex 85362718c56..edd5b45d000 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -27,6 +27,7 @@\n #define __AC_KHASH_H\n \n #include \"hashmap.h\"\n+#include \"repository.h\"\n \n #define AC_VERSION_KHASH_H \"0.2.8\"\n \ndiff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c\nindex c00dfbab1cd..2d1e8aa7ee7 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -2,6 +2,7 @@\n #include \"gettext.h\"\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n+#include \"repository.h\"\n \n #include \"commit.h\"\n \ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex f4b78eb47dd..5cb2b1d2046 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -4,6 +4,7 @@\n #include \"../fetch-negotiator.h\"\n #include \"../prio-queue.h\"\n #include \"../refs.h\"\n+#include \"../repository.h\"\n #include \"../tag.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex c7d6ab39bc5..97e7e1ae725 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -5,6 +5,7 @@\n #include \"../hex.h\"\n #include \"../prio-queue.h\"\n #include \"../refs.h\"\n+#include \"../repository.h\"\n #include \"../tag.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/object-file.h b/object-file.h\nindex e0cfc3a5db8..d6414610f80 100644\n--- a/object-file.h\n+++ b/object-file.h\n@@ -4,6 +4,8 @@\n #include \"git-zlib.h\"\n #include \"object.h\"\n \n+struct index_state;\n+\n /*\n  * Set this to 0 to prevent oid_object_info_extended() from fetching missing\n  * blobs. This has a difference only if extensions.partialClone is set.\ndiff --git a/object.h b/object.h\nindex 96e52e24fb1..6cd8b49fa66 100644\n--- a/object.h\n+++ b/object.h\n@@ -4,6 +4,7 @@\n #include \"hash.h\"\n \n struct buffer_slab;\n+struct repository;\n \n struct parsed_object_pool {\n \tstruct object **obj_hash;\ndiff --git a/oid-array.h b/oid-array.h\nindex f60f9af6741..8bfe452259b 100644\n--- a/oid-array.h\n+++ b/oid-array.h\n@@ -2,6 +2,7 @@\n #define OID_ARRAY_H\n \n #include \"hash.h\"\n+#include \"repository.h\"\n \n /**\n  * The API provides storage and manipulation of sets of object identifiers.\ndiff --git a/oidmap.c b/oidmap.c\nindex 8c1a139c974..d268486f4e8 100644\n--- a/oidmap.c\n+++ b/oidmap.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"oidmap.h\"\n+#include \"repository.h\"\n \n static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,\n \t\t      const struct hashmap_entry *e1,\ndiff --git a/oidtree.c b/oidtree.c\nindex 7d57b7b19e3..634214673dd 100644\n--- a/oidtree.c\n+++ b/oidtree.c\n@@ -6,6 +6,7 @@\n #include \"oidtree.h\"\n #include \"alloc.h\"\n #include \"hash.h\"\n+#include \"repository.h\"\n \n struct oidtree_iter_data {\n \toidtree_iter fn;\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 7f0569cc930..78cb6e3003a 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -7,6 +7,7 @@\n #include \"parallel-checkout.h\"\n #include \"pkt-line.h\"\n #include \"progress.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n #include \"streaming.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex ec335a214e2..1e57b6c667d 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -6,6 +6,7 @@\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"symlinks.h\"\ndiff --git a/progress.c b/progress.c\nindex 72d5e0c73c1..f695798acac 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -12,6 +12,7 @@\n #include \"git-compat-util.h\"\n #include \"pager.h\"\n #include \"progress.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 789f4073617..852a3313182 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"commit-slab.h\"\n #include \"config.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 1128a9af292..212a0c14ea4 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -14,6 +14,7 @@\n #include \"../lockfile.h\"\n #include \"../object.h\"\n #include \"../object-file.h\"\n+#include \"../repository.h\"\n #include \"../dir.h\"\n #include \"../chdir-notify.h\"\n #include \"../setup.h\"\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 2333ed5a1f7..b3a46f9d4dd 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -9,6 +9,7 @@\n #include \"../iterator.h\"\n #include \"../lockfile.h\"\n #include \"../chdir-notify.h\"\n+#include \"../repository.h\"\n #include \"../wrapper.h\"\n #include \"../write-or-die.h\"\n \ndiff --git a/refs/ref-cache.c b/refs/ref-cache.c\nindex dc1ca49c85f..84c3838c743 100644\n--- a/refs/ref-cache.c\n+++ b/refs/ref-cache.c\n@@ -4,6 +4,7 @@\n #include \"refs-internal.h\"\n #include \"ref-cache.h\"\n #include \"../iterator.h\"\n+#include \"../repository.h\"\n \n void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry)\n {\ndiff --git a/refs/ref-cache.h b/refs/ref-cache.h\nindex cf4ad9070b9..31ebe24f6cf 100644\n--- a/refs/ref-cache.h\n+++ b/refs/ref-cache.h\n@@ -5,6 +5,7 @@\n \n struct ref_dir;\n struct ref_store;\n+struct repository;\n \n /*\n  * If this ref_cache is filled lazily, this function is used to load\ndiff --git a/refspec.c b/refspec.c\nindex 7b5c305514d..68020ee84c6 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -5,6 +5,7 @@\n #include \"strvec.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\n+#include \"repository.h\"\n \n static struct refspec_item s_tag_refspec = {\n \t.force = 0,\ndiff --git a/repository.h b/repository.h\nindex 15a8afc5fb5..9e36868207f 100644\n--- a/repository.h\n+++ b/repository.h\n@@ -1,6 +1,7 @@\n #ifndef REPOSITORY_H\n #define REPOSITORY_H\n \n+#include \"hash.h\"\n #include \"path.h\"\n \n struct config_set;\n@@ -238,4 +239,99 @@ void prepare_repo_settings(struct repository *r);\n  */\n int upgrade_repository_format(int target_version);\n \n+#define the_hash_algo the_repository->hash_algo\n+\n+static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n+{\n+\treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n+}\n+\n+static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n+{\n+\tconst struct git_hash_algo *algop;\n+\tif (!oid1->algo)\n+\t\talgop = the_hash_algo;\n+\telse\n+\t\talgop = &hash_algos[oid1->algo];\n+\treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n+}\n+\n+static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n+{\n+\treturn hasheq_algop(sha1, sha2, the_hash_algo);\n+}\n+\n+static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n+{\n+\tconst struct git_hash_algo *algop;\n+\tif (!oid1->algo)\n+\t\talgop = the_hash_algo;\n+\telse\n+\t\talgop = &hash_algos[oid1->algo];\n+\treturn hasheq_algop(oid1->hash, oid2->hash, algop);\n+}\n+\n+static inline int is_null_oid(const struct object_id *oid)\n+{\n+\treturn oideq(oid, null_oid());\n+}\n+\n+static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n+{\n+\tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n+}\n+\n+/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n+static inline void oidcpy_with_padding(struct object_id *dst,\n+\t\t\t\t       const struct object_id *src)\n+{\n+\tsize_t hashsz;\n+\n+\tif (!src->algo)\n+\t\thashsz = the_hash_algo->rawsz;\n+\telse\n+\t\thashsz = hash_algos[src->algo].rawsz;\n+\n+\tmemcpy(dst->hash, src->hash, hashsz);\n+\tmemset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz);\n+\tdst->algo = src->algo;\n+}\n+\n+static inline void hashclr(unsigned char *hash)\n+{\n+\tmemset(hash, 0, the_hash_algo->rawsz);\n+}\n+\n+static inline void oidclr(struct object_id *oid)\n+{\n+\tmemset(oid->hash, 0, GIT_MAX_RAWSZ);\n+\toid->algo = hash_algo_by_ptr(the_hash_algo);\n+}\n+\n+static inline void oidread(struct object_id *oid, const unsigned char *hash)\n+{\n+\tmemcpy(oid->hash, hash, the_hash_algo->rawsz);\n+\toid->algo = hash_algo_by_ptr(the_hash_algo);\n+}\n+\n+static inline int is_empty_blob_sha1(const unsigned char *sha1)\n+{\n+\treturn hasheq(sha1, the_hash_algo->empty_blob->hash);\n+}\n+\n+static inline int is_empty_blob_oid(const struct object_id *oid)\n+{\n+\treturn oideq(oid, the_hash_algo->empty_blob);\n+}\n+\n+static inline int is_empty_tree_sha1(const unsigned char *sha1)\n+{\n+\treturn hasheq(sha1, the_hash_algo->empty_tree->hash);\n+}\n+\n+static inline int is_empty_tree_oid(const struct object_id *oid)\n+{\n+\treturn oideq(oid, the_hash_algo->empty_tree);\n+}\n+\n #endif /* REPOSITORY_H */\ndiff --git a/resolve-undo.c b/resolve-undo.c\nindex e81096e2d45..7dbd38a2cf9 100644\n--- a/resolve-undo.c\n+++ b/resolve-undo.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"dir.h\"\n #include \"resolve-undo.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n \n /* The only error case is to run out of memory in string-list */\ndiff --git a/split-index.c b/split-index.c\nindex 3fc4e91485a..bce6480084e 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"mem-pool.h\"\n+#include \"repository.h\"\n #include \"split-index.h\"\n #include \"strbuf.h\"\n #include \"ewah/ewok.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex 729378ec824..08eec8f1d8b 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -6,6 +6,7 @@\n #include \"hex.h\"\n #include \"object-name.h\"\n #include \"refs.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n #include \"date.h\"\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex d2b30d644da..aabe31d724b 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -2,6 +2,7 @@\n #include \"bloom.h\"\n #include \"hex.h\"\n #include \"commit.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\ndiff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex cdaf5046f5a..9507b356e22 100644\n--- a/t/helper/test-cache-tree.c\n+++ b/t/helper/test-cache-tree.c\n@@ -6,6 +6,7 @@\n #include \"tree.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static char const * const test_cache_tree_usage[] = {\ndiff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c\nindex 715aabfbae7..df30cc92d24 100644\n--- a/t/helper/test-dump-cache-tree.c\n+++ b/t/helper/test-dump-cache-tree.c\n@@ -4,6 +4,7 @@\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static void dump_one(struct cache_tree *it, const char *pfx, const char *x)\ndiff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c\nindex 7e9de296db3..6dc49583375 100644\n--- a/t/helper/test-dump-fsmonitor.c\n+++ b/t/helper/test-dump-fsmonitor.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n int cmd__dump_fsmonitor(int ac, const char **av)\ndiff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c\nindex 415f55f31da..d1b99d21dcd 100644\n--- a/t/helper/test-dump-untracked-cache.c\n+++ b/t/helper/test-dump-untracked-cache.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"dir.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static int compare_untracked(const void *a_, const void *b_)\ndiff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c\nindex 7c7fc8efc13..43707486dd4 100644\n--- a/t/helper/test-example-decorate.c\n+++ b/t/helper/test-example-decorate.c\n@@ -2,6 +2,7 @@\n #include \"git-compat-util.h\"\n #include \"object.h\"\n #include \"decorate.h\"\n+#include \"repository.h\"\n \n int cmd__example_decorate(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex a37236cd0a6..bb00e1e5d14 100644\n--- a/t/helper/test-fsmonitor-client.c\n+++ b/t/helper/test-fsmonitor-client.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex f23d983c118..b83a75d19f6 100644\n--- a/t/helper/test-lazy-init-name-hash.c\n+++ b/t/helper/test-lazy-init-name-hash.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"environment.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"trace.h\"\n \ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex a498fece7a3..3c62e33ccdf 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n \ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex de6ab77fdaa..bba4099f65f 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -2,6 +2,7 @@\n #include \"hex.h\"\n #include \"object-name.h\"\n #include \"oidmap.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n \ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex 6355c9e4b6d..2ef53d5f7a2 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n+#include \"path.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\n #include \"trace.h\"\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex a4c24d0e421..c1ae2763954 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"wrapper.h\"\n \ndiff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c\nindex 15b7688774c..444a4c02c8d 100644\n--- a/t/helper/test-scrap-cache-tree.c\n+++ b/t/helper/test-scrap-cache-tree.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"lockfile.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex c7c7fdbea98..8b1969ea48d 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"config.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex d31f5e48ab5..ecd40ded995 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,4 +1,5 @@\n #include \"test-tool.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c\nindex 0e34581b209..cad8b0ca681 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -2,6 +2,7 @@\n #include \"test-tool-utils.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex a476df6c6cb..ab084d6034e 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -3,6 +3,7 @@\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"trace2.h\"\n \n typedef int(fn_unit_test)(int argc, const char **argv);\ndiff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c\nindex a93417ed3a9..eace08072d7 100644\n--- a/t/helper/test-write-cache.c\n+++ b/t/helper/test-write-cache.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"lockfile.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n int cmd__write_cache(int argc, const char **argv)\ndiff --git a/trace2.c b/trace2.c\nindex 21264df71b7..0efc4e7b958 100644\n--- a/trace2.c\n+++ b/trace2.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"json-writer.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n #include \"thread-utils.h\"\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex 9e7aab6d510..2af53e5d4de 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"json-writer.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"version.h\"\n #include \"trace2/tr2_dst.h\"\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex 8672c2c2d04..1ebfb464d54 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\n #include \"version.h\"\ndiff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c\nindex 3f2b2d53118..328e483a05e 100644\n--- a/trace2/tr2_tgt_perf.c\n+++ b/trace2/tr2_tgt_perf.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\n #include \"version.h\"\ndiff --git a/tree-walk.h b/tree-walk.h\nindex 25fe27e3529..1a3a1b8d4b1 100644\n--- a/tree-walk.h\n+++ b/tree-walk.h\n@@ -4,6 +4,7 @@\n #include \"hash.h\"\n \n struct index_state;\n+struct repository;\n \n #define MAX_TRAVERSE_TREES 8\n \ndiff --git a/tree.h b/tree.h\nindex 6efff003e21..0499ad01aa7 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -3,6 +3,7 @@\n \n #include \"object.h\"\n \n+struct pathspec;\n struct repository;\n struct strbuf;\n \ndiff --git a/wrapper.c b/wrapper.c\nindex e80f83498d8..5ab0460de5c 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\n-- \ngitgitgadget\n\n"},{"id":"475471","messageId":"1aa36d91b596522ba01d24b50149bb507e697958.1681614207.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 21/23] object-store.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:23Z","receivedAt":"2023-04-16T03:04:37Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n object-file.c      | 1 +\n object-name.c      | 1 +\n object-store.h     | 8 ++++----\n submodule-config.c | 1 +\n 4 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/object-file.c b/object-file.c\nindex 8e0df7360ae..921a717d8a5 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -38,6 +38,7 @@\n #include \"packfile.h\"\n #include \"object-file.h\"\n #include \"object-store.h\"\n+#include \"oidtree.h\"\n #include \"promisor-remote.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 5ccbe854b60..88d839f70bc 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -14,6 +14,7 @@\n #include \"remote.h\"\n #include \"dir.h\"\n #include \"oid-array.h\"\n+#include \"oidtree.h\"\n #include \"packfile.h\"\n #include \"pretty.h\"\n #include \"object-store.h\"\ndiff --git a/object-store.h b/object-store.h\nindex f9d225783ae..23ea86d3702 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -2,16 +2,16 @@\n #define OBJECT_STORE_H\n \n #include \"object.h\"\n-#include \"oidmap.h\"\n #include \"list.h\"\n-#include \"oid-array.h\"\n-#include \"strbuf.h\"\n #include \"thread-utils.h\"\n #include \"khash.h\"\n #include \"dir.h\"\n-#include \"oidtree.h\"\n #include \"oidset.h\"\n \n+struct oidmap;\n+struct oidtree;\n+struct strbuf;\n+\n struct object_directory {\n \tstruct object_directory *next;\n \ndiff --git a/submodule-config.c b/submodule-config.c\nindex 7fc0812b644..58dfbde9ae5 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -12,6 +12,7 @@\n #include \"object-name.h\"\n #include \"object-store.h\"\n #include \"parse-options.h\"\n+#include \"thread-utils.h\"\n #include \"tree-walk.h\"\n \n /*\n-- \ngitgitgadget\n\n"},{"id":"475473","messageId":"c6d585736610120baf20be804238bd38a5f690d4.1681614206.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 20/23] commit.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:22Z","receivedAt":"2023-04-16T03:04:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-interactive.c    |  1 +\n archive.c            |  2 ++\n bloom.c              |  1 +\n builtin/diff-tree.c  |  1 +\n builtin/diff.c       |  1 +\n builtin/gc.c         |  1 +\n builtin/log.c        |  1 +\n builtin/merge-tree.c |  1 +\n combine-diff.c       |  1 +\n commit-graph.c       |  1 +\n commit.c             |  1 +\n commit.h             | 11 ++++-------\n dir.c                |  1 +\n fetch-pack.c         |  1 +\n fsck.c               |  1 +\n gpg-interface.c      |  1 +\n grep.c               |  1 +\n http-push.c          |  1 +\n log-tree.c           |  1 +\n merge-ort-wrappers.c |  1 +\n merge.c              |  1 +\n notes-cache.c        |  1 +\n notes-utils.c        |  1 +\n object-name.c        |  1 +\n pack-bitmap-write.c  |  1 +\n parse-options-cb.c   |  1 +\n parse-options.c      |  1 +\n read-cache.c         |  1 +\n ref-filter.c         |  1 +\n reflog.c             |  1 +\n refs/debug.c         |  1 +\n refspec.c            |  1 +\n revision.h           |  1 +\n send-pack.c          |  1 +\n wt-status.c          |  1 +\n 35 files changed, 39 insertions(+), 7 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 757a9929d41..de877ca0525 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -12,6 +12,7 @@\n #include \"dir.h\"\n #include \"run-command.h\"\n #include \"prompt.h\"\n+#include \"tree.h\"\n \n static void init_color(struct repository *r, struct add_i_state *s,\n \t\t       const char *section_and_slot, char *dst,\ndiff --git a/archive.c b/archive.c\nindex ab8966d73a5..6226e16b25e 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -6,10 +6,12 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"pretty.h\"\n #include \"setup.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\n+#include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"attr.h\"\n #include \"archive.h\"\ndiff --git a/bloom.c b/bloom.c\nindex d0730525da5..aef6b5fea2d 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -6,6 +6,7 @@\n #include \"hashmap.h\"\n #include \"commit-graph.h\"\n #include \"commit.h\"\n+#include \"commit-slab.h\"\n \n define_commit_slab(bloom_filter_slab, struct bloom_filter);\n \ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex 385c2d0230c..0b02c62b85e 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"submodule.h\"\n #include \"repository.h\"\n+#include \"tree.h\"\n \n static struct rev_info log_tree_opt;\n \ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 8f386535d61..457dee14457 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -22,6 +22,7 @@\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"oid-array.h\"\n+#include \"tree.h\"\n \n #define DIFF_NO_INDEX_EXPLICIT 1\n #define DIFF_NO_INDEX_IMPLICIT 2\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex b95154fba16..d11712b1444 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -12,6 +12,7 @@\n \n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 95de51921f8..137b84b31ef 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -44,6 +44,7 @@\n #include \"commit-reach.h\"\n #include \"range-diff.h\"\n #include \"tmp-objdir.h\"\n+#include \"tree.h\"\n #include \"write-or-die.h\"\n \n #define MAIL_DEFAULT_WRAP 72\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 6b9f006ec19..aa8040c2a6a 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -16,6 +16,7 @@\n #include \"exec-cmd.h\"\n #include \"merge-blobs.h\"\n #include \"quote.h\"\n+#include \"tree.h\"\n \n static int line_termination = '\\n';\n \ndiff --git a/combine-diff.c b/combine-diff.c\nindex f8d61965776..1e3cd7fb170 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -13,6 +13,7 @@\n #include \"xdiff/xmacros.h\"\n #include \"log-tree.h\"\n #include \"refs.h\"\n+#include \"tree.h\"\n #include \"userdiff.h\"\n #include \"oid-array.h\"\n #include \"revision.h\"\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 0c4f2266445..6f612f368ba 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -23,6 +23,7 @@\n #include \"shallow.h\"\n #include \"json-writer.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"chunk-format.h\"\n #include \"wrapper.h\"\n \ndiff --git a/commit.c b/commit.c\nindex 878b4473e4c..10676165a1d 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -26,6 +26,7 @@\n #include \"run-command.h\"\n #include \"setup.h\"\n #include \"shallow.h\"\n+#include \"tree.h\"\n #include \"hook.h\"\n \n static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);\ndiff --git a/commit.h b/commit.h\nindex 69b2f376e9d..28928833c54 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -2,13 +2,10 @@\n #define COMMIT_H\n \n #include \"object.h\"\n-#include \"tree.h\"\n-#include \"strbuf.h\"\n-#include \"decorate.h\"\n-#include \"gpg-interface.h\"\n-#include \"string-list.h\"\n-#include \"pretty.h\"\n-#include \"commit-slab.h\"\n+\n+struct signature_check;\n+struct strbuf;\n+struct tree;\n \n #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF\n #define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1)\ndiff --git a/dir.c b/dir.c\nindex ed262fa6e43..a7469df3ac7 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -27,6 +27,7 @@\n #include \"submodule-config.h\"\n #include \"symlinks.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"wrapper.h\"\n \n /*\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 677102465a1..a9745bd9faf 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/fsck.c b/fsck.c\nindex adbe8bf59e7..3261ef9ec28 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"date.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 8615dcd4b4b..49d72c2066b 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/grep.c b/grep.c\nindex d144b374894..e620e375b1d 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -4,6 +4,7 @@\n #include \"grep.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n+#include \"pretty.h\"\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"diff.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 637a4e91f7a..3f184986362 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -15,6 +15,7 @@\n #include \"setup.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n+#include \"tree.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex b5cf3d8439c..8861900b592 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -24,6 +24,7 @@\n #include \"help.h\"\n #include \"range-diff.h\"\n #include \"strmap.h\"\n+#include \"tree.h\"\n #include \"write-or-die.h\"\n \n static struct decoration name_decoration = { \"object names\" };\ndiff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c\nindex 2d1e8aa7ee7..ad2bb676e13 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -3,6 +3,7 @@\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n #include \"repository.h\"\n+#include \"tree.h\"\n \n #include \"commit.h\"\n \ndiff --git a/merge.c b/merge.c\nindex da7fa652c27..10aaec3a6c1 100644\n--- a/merge.c\n+++ b/merge.c\n@@ -7,6 +7,7 @@\n #include \"commit.h\"\n #include \"run-command.h\"\n #include \"resolve-undo.h\"\n+#include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\n #include \"dir.h\"\ndiff --git a/notes-cache.c b/notes-cache.c\nindex fbcdfd0dfe5..14288caf98f 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"notes-cache.h\"\n #include \"object-store.h\"\n+#include \"pretty.h\"\n #include \"repository.h\"\n #include \"commit.h\"\n #include \"refs.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex cb88171b7bb..4a793eb347f 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -6,6 +6,7 @@\n #include \"refs.h\"\n #include \"notes-utils.h\"\n #include \"repository.h\"\n+#include \"strbuf.h\"\n \n void create_notes_commit(struct repository *r,\n \t\t\t struct notes_tree *t,\ndiff --git a/object-name.c b/object-name.c\nindex 3cd5b327293..5ccbe854b60 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -15,6 +15,7 @@\n #include \"dir.h\"\n #include \"oid-array.h\"\n #include \"packfile.h\"\n+#include \"pretty.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n #include \"setup.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex faf67c94d37..3d3fd380654 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -18,6 +18,7 @@\n #include \"commit-reach.h\"\n #include \"prio-queue.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex 26a4c7d08a9..be81158f861 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -3,6 +3,7 @@\n #include \"branch.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-name.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex b6803647d0e..f8a155ee13b 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -5,6 +5,7 @@\n #include \"commit.h\"\n #include \"color.h\"\n #include \"gettext.h\"\n+#include \"strbuf.h\"\n #include \"utf8.h\"\n \n static int disallow_abbreviated_options;\ndiff --git a/read-cache.c b/read-cache.c\nindex b3e2917ddc9..d64d93bc364 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -6,6 +6,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"hex.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 594e66ad361..84eee904ba3 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"gpg-interface.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 9c094430884..57dc7c0d051 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -4,6 +4,7 @@\n #include \"reflog.h\"\n #include \"refs.h\"\n #include \"revision.h\"\n+#include \"tree.h\"\n #include \"worktree.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/refs/debug.c b/refs/debug.c\nindex adc34c836fc..6f11e6de46c 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"hex.h\"\n #include \"refs-internal.h\"\n+#include \"string-list.h\"\n #include \"trace.h\"\n \n static struct trace_key trace_refs = TRACE_KEY_INIT(REFS);\ndiff --git a/refspec.c b/refspec.c\nindex 68020ee84c6..2ddea205d10 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -6,6 +6,7 @@\n #include \"refs.h\"\n #include \"refspec.h\"\n #include \"repository.h\"\n+#include \"strbuf.h\"\n \n static struct refspec_item s_tag_refspec = {\n \t.force = 0,\ndiff --git a/revision.h b/revision.h\nindex 742700504a7..6630bb2eae2 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -8,6 +8,7 @@\n #include \"pretty.h\"\n #include \"diff.h\"\n #include \"commit-slab-decl.h\"\n+#include \"decorate.h\"\n #include \"ident.h\"\n #include \"list-objects-filter-options.h\"\n \ndiff --git a/send-pack.c b/send-pack.c\nindex 351037b07bc..e68da24cc52 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"date.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex 97b9c1c0359..068b76ef6d9 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -22,6 +22,7 @@\n #include \"strbuf.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n #include \"lockfile.h\"\n-- \ngitgitgadget\n\n"},{"id":"475474","messageId":"d70e3b99daef23aa9064cb2d55240aa5e08cb8e4.1681614207.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 22/23] diff.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:24Z","receivedAt":"2023-04-16T03:04:51Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n attr.c              | 1 +\n diff.h              | 1 -\n http-push.c         | 1 +\n line-log.c          | 1 +\n pack-bitmap-write.c | 1 +\n reflog.c            | 1 +\n tree-diff.c         | 1 +\n 7 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/attr.c b/attr.c\nindex 2d8aeb8b58c..ddf2b0cbc2e 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -20,6 +20,7 @@\n #include \"object-store.h\"\n #include \"setup.h\"\n #include \"thread-utils.h\"\n+#include \"tree-walk.h\"\n \n const char git_attr__true[] = \"(builtin)true\";\n const char git_attr__false[] = \"\\0(builtin)false\";\ndiff --git a/diff.h b/diff.h\nindex 53aeb02a54b..69e574f4315 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -4,7 +4,6 @@\n #ifndef DIFF_H\n #define DIFF_H\n \n-#include \"tree-walk.h\"\n #include \"pathspec.h\"\n #include \"oidset.h\"\n #include \"strbuf.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 3f184986362..866ba243a89 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -16,6 +16,7 @@\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\ndiff --git a/line-log.c b/line-log.c\nindex 10c19daec4a..6a7ac312a43 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -18,6 +18,7 @@\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"bloom.h\"\n+#include \"tree-walk.h\"\n \n static void range_set_grow(struct range_set *rs, size_t extra)\n {\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 3d3fd380654..cdffe2ce47d 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -19,6 +19,7 @@\n #include \"prio-queue.h\"\n #include \"trace2.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/reflog.c b/reflog.c\nindex 57dc7c0d051..ee1bf5d032c 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -5,6 +5,7 @@\n #include \"refs.h\"\n #include \"revision.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n #include \"worktree.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/tree-diff.c b/tree-diff.c\nindex 9ea2dd7a6c3..20bb15f38d9 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -5,6 +5,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n \n /*\n  * Some mode bits are also used internally for computations.\n-- \ngitgitgadget\n\n"},{"id":"475475","messageId":"f32d4fa3dbffa3879b7127f8910a7b4586bea81c.1681614207.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH 23/23] reftable: ensure git-compat-util.h is the first (indirect) include","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-16T03:03:25Z","receivedAt":"2023-04-16T03:04:53Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n reftable/error.c         | 1 +\n reftable/publicbasics.c  | 2 +-\n reftable/tree.c          | 2 +-\n reftable/tree_test.c     | 1 +\n t/helper/test-reftable.c | 1 +\n 5 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/reftable/error.c b/reftable/error.c\nindex 93941f21457..0d1766735e8 100644\n--- a/reftable/error.c\n+++ b/reftable/error.c\n@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"reftable-error.h\"\n \n #include <stdio.h>\ndiff --git a/reftable/publicbasics.c b/reftable/publicbasics.c\nindex 0ad7d5c0ff2..bcb82530d6c 100644\n--- a/reftable/publicbasics.c\n+++ b/reftable/publicbasics.c\n@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"reftable-malloc.h\"\n \n #include \"basics.h\"\n-#include \"system.h\"\n \n static void *(*reftable_malloc_ptr)(size_t sz);\n static void *(*reftable_realloc_ptr)(void *, size_t);\ndiff --git a/reftable/tree.c b/reftable/tree.c\nindex b8899e060ab..a5bf8809854 100644\n--- a/reftable/tree.c\n+++ b/reftable/tree.c\n@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"tree.h\"\n \n #include \"basics.h\"\n-#include \"system.h\"\n \n struct tree_node *tree_search(void *key, struct tree_node **rootp,\n \t\t\t      int (*compare)(const void *, const void *),\ndiff --git a/reftable/tree_test.c b/reftable/tree_test.c\nindex cbff1255886..ac3a045ad4a 100644\n--- a/reftable/tree_test.c\n+++ b/reftable/tree_test.c\n@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"tree.h\"\n \n #include \"basics.h\"\ndiff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c\nindex 1f0a28cbb64..00237ef0d9e 100644\n--- a/t/helper/test-reftable.c\n+++ b/t/helper/test-reftable.c\n@@ -1,3 +1,4 @@\n+#include \"reftable/system.h\"\n #include \"reftable/reftable-tests.h\"\n #include \"test-tool.h\"\n \n-- \ngitgitgadget\n"},{"id":"475558","messageId":"ad90e716-ba23-040f-66be-4c4faff02ea8@github.com","threadId":"59603","inReplyTo":"1c6989ae456c86850761b079384f1505735e317a.1681614206.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-04-17T20:59:42Z","receivedAt":"2023-04-17T21:02:07Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote:\n> From: Elijah Newren <newren@gmail.com>\n> \n> Previously, hash.h depended upon and included repository.h, due to\n> the definition and use of the_hash_algo (defined as\n> the_repository->hash_algo).  Move this #define, and the associated\n> inline functions that depend upon it, from hash.h to repository.h.\n> Due to that movement, reverse the dependencies so repository.h includes\n> hash.h.\n> \n> This allows hash.h and object.h to be fairly small, minimal headers.  It\n> also exposes a lot of hidden dependencies on both path.h (which was\n> brought in by repository.h) and repository.h (which was previously\n> implicitly brought in by object.h).\n\nThis is the first patch in the series where I don't immediately agree\nwith the patch. This is a big list of methods that don't seem like\nthey fit in repository.h:\n\n> diff --git a/repository.h b/repository.h\n> +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n> +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n> +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n> +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n> +static inline int is_null_oid(const struct object_id *oid)\n> +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n> +static inline void oidcpy_with_padding(struct object_id *dst,\n> +\t\t\t\t       const struct object_id *src)\n> +static inline void hashclr(unsigned char *hash)\n> +static inline void oidclr(struct object_id *oid)\n> +static inline void oidread(struct object_id *oid, const unsigned char *hash)\n> +static inline int is_empty_blob_sha1(const unsigned char *sha1)\n> +static inline int is_empty_blob_oid(const struct object_id *oid)\n> +static inline int is_empty_tree_sha1(const unsigned char *sha1)\n> +static inline int is_empty_tree_oid(const struct object_id *oid)\n\nThe goal to remove repository.h from hash.h and object.h makes sense\nas a goal, but is there another way to do it? Can we redefine\n'extern struct repository *the_repository;' in hash.h so we have\naccess to that pointer?\n\nThanks,\n-Stolee\n"},{"id":"475559","messageId":"ce9ef1c6-23c1-2e9f-ed5f-3790e5ff3e1f@github.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"Re: [PATCH 00/23] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-04-17T21:07:13Z","receivedAt":"2023-04-17T21:08:12Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote:\n> This series continues to focus on splitting declarations from cache.h to\n> separate headers. This series also untangles some dependencies between\n> hash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\n> up a few other headers. At the end of this series the number of cache.h\n> includes drops from 189 down to 149.\n\nThank you for continuing to do this work.\n\n>  * Patch 14-16: move functions between hash<->repository and\n>    read-cache<->tree to simplify dependencies\n\nMy only comment was on patch 14, where I'm not sure I like the methods\nmoving from hash.h to repository.h. If we can find an alternative, that\nwould make me happy.\n\nThe rest of the series looked very good.\n\nThanks,\n-Stolee\n"},{"id":"475577","messageId":"CABPp-BFV2HByQ7=6TvsLgSxZTXcWFG4jbxATGWAd_UT_Nr=KVA@mail.gmail.com","threadId":"59603","inReplyTo":"ad90e716-ba23-040f-66be-4c4faff02ea8@github.com","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-18T02:36:06Z","receivedAt":"2023-04-18T02:36:24Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Apr 17, 2023 at 1:59 PM Derrick Stolee <derrickstolee@github.com> wrote:\n>\n> On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote:\n> > From: Elijah Newren <newren@gmail.com>\n> >\n> > Previously, hash.h depended upon and included repository.h, due to\n> > the definition and use of the_hash_algo (defined as\n> > the_repository->hash_algo).  Move this #define, and the associated\n> > inline functions that depend upon it, from hash.h to repository.h.\n> > Due to that movement, reverse the dependencies so repository.h includes\n> > hash.h.\n> >\n> > This allows hash.h and object.h to be fairly small, minimal headers.  It\n> > also exposes a lot of hidden dependencies on both path.h (which was\n> > brought in by repository.h) and repository.h (which was previously\n> > implicitly brought in by object.h).\n>\n> This is the first patch in the series where I don't immediately agree\n> with the patch. This is a big list of methods that don't seem like\n> they fit in repository.h:\n>\n> > diff --git a/repository.h b/repository.h\n> > +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n> > +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n> > +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n> > +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n> > +static inline int is_null_oid(const struct object_id *oid)\n> > +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n> > +static inline void oidcpy_with_padding(struct object_id *dst,\n> > +                                    const struct object_id *src)\n> > +static inline void hashclr(unsigned char *hash)\n> > +static inline void oidclr(struct object_id *oid)\n> > +static inline void oidread(struct object_id *oid, const unsigned char *hash)\n> > +static inline int is_empty_blob_sha1(const unsigned char *sha1)\n> > +static inline int is_empty_blob_oid(const struct object_id *oid)\n> > +static inline int is_empty_tree_sha1(const unsigned char *sha1)\n> > +static inline int is_empty_tree_oid(const struct object_id *oid)\n\nYeah, their names suggest they in no way depend upon internals of a\nrepository, but that's largely because they are misnamed, similar to\nour old friends like get_oid() and repo_get_oid().\n\n> The goal to remove repository.h from hash.h and object.h makes sense\n> as a goal, but is there another way to do it? Can we redefine\n> 'extern struct repository *the_repository;' in hash.h so we have\n> access to that pointer?\n\nHaving access to the pointer is insufficient.  These functions all\nmake use of the_repository->hash_algo, and are inline, so the\ndefinition and layout of struct repository is necessary.\n\nAn alternate solution might be to just wrap the #define of\nthe_hash_algo, as well as these functions, with\nNO_THE_REPOSITORY_COMPATIBILITY_MACROS, try to convince Ævar that we\nput those #ifdefs in before he wrote his series[1] and that he thus\nmissed some uses of that macro, and then watch him transform all of\nthem with a series of cocci changes so these functions just go away.\n;-)\n\nBut that sounds like a separate big series, and I'm dubious about my\nability to hoodwink Ævar.\n\nAny other ideas?\n\n\n[1] https://lore.kernel.org/git/cover-v2-00.17-00000000000-20230328T110946Z-avarab@gmail.com/\n"},{"id":"475578","messageId":"CABPp-BE4dsPc0u7D4mYtsQ6Ko-j1fOKfEwfmrpiCoAgvdG0AXA@mail.gmail.com","threadId":"59603","inReplyTo":"ce9ef1c6-23c1-2e9f-ed5f-3790e5ff3e1f@github.com","subject":"Re: [PATCH 00/23] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-18T02:41:03Z","receivedAt":"2023-04-18T02:41:20Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Apr 17, 2023 at 2:07 PM Derrick Stolee <derrickstolee@github.com> wrote:\n>\n> On 4/15/2023 11:03 PM, Elijah Newren via GitGitGadget wrote:\n> > This series continues to focus on splitting declarations from cache.h to\n> > separate headers. This series also untangles some dependencies between\n> > hash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\n> > up a few other headers. At the end of this series the number of cache.h\n> > includes drops from 189 down to 149.\n>\n> Thank you for continuing to do this work.\n>\n> >  * Patch 14-16: move functions between hash<->repository and\n> >    read-cache<->tree to simplify dependencies\n>\n> My only comment was on patch 14, where I'm not sure I like the methods\n> moving from hash.h to repository.h. If we can find an alternative, that\n> would make me happy.\n\nI'm not aware of one, but I tried to deviously nerd snipe an expert on\ncleaning up compatibility macros for the_repository to see if he might\nhave any bright ideas.  :-)\n\nAlso, if you have any other ideas that might work, I'm all ears.\n\n> The rest of the series looked very good.\n\nThanks for taking a look!\n"},{"id":"475675","messageId":"xmqqedogbwh3.fsf@gitster.g","threadId":"59603","inReplyTo":"ad90e716-ba23-040f-66be-4c4faff02ea8@github.com","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-18T23:29:28Z","receivedAt":"2023-04-18T23:29:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Derrick Stolee <derrickstolee@github.com> writes:\n\n> This is the first patch in the series where I don't immediately agree\n> with the patch. This is a big list of methods that don't seem like\n> they fit in repository.h:\n>\n>> diff --git a/repository.h b/repository.h\n>> +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n>> +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n>> +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n>> +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n>> +static inline int is_null_oid(const struct object_id *oid)\n>> +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n>> +static inline void oidcpy_with_padding(struct object_id *dst,\n>> +\t\t\t\t       const struct object_id *src)\n>> +static inline void hashclr(unsigned char *hash)\n>> +static inline void oidclr(struct object_id *oid)\n>> +static inline void oidread(struct object_id *oid, const unsigned char *hash)\n>> +static inline int is_empty_blob_sha1(const unsigned char *sha1)\n>> +static inline int is_empty_blob_oid(const struct object_id *oid)\n>> +static inline int is_empty_tree_sha1(const unsigned char *sha1)\n>> +static inline int is_empty_tree_oid(const struct object_id *oid)\n>\n> The goal to remove repository.h from hash.h and object.h makes sense\n> as a goal, but is there another way to do it?\n\nIndeed.\n\nAll of the above sit very well in hash simply because they are all\nabout hashes.  It does not have much to do with \"repository\", not\nmore than \"well, hashes we use to identify objects, and objects are\nstored in repositories\".\n\nFrom the point of view of somebody who needs to use these macros, it\nis utterly unnatural that they have to include \"repository.h\" (as\nopposed to, say, \"hash.h\") just to be able to compare two hash\nvalues.  Most of our programs interact with only one repository, and\nit is understandable to include a header \"repository.h\" if your\nprogram needs to interact with an extra repository other than the\n\"current\" one.  But this feels backwards and not quite satisfactory,\neven though inlines are special and I can fully sympathize with the\nauthor who felt that this patch was necessary.\n\n"},{"id":"475725","messageId":"CABPp-BELApT-6YrYJ5qwme9uwP_2gqERdiLiE7mJu_b0bXmCbg@mail.gmail.com","threadId":"59603","inReplyTo":"xmqqedogbwh3.fsf@gitster.g","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-20T05:06:00Z","receivedAt":"2023-04-20T05:07:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Apr 18, 2023 at 4:29 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Derrick Stolee <derrickstolee@github.com> writes:\n>\n> > This is the first patch in the series where I don't immediately agree\n> > with the patch. This is a big list of methods that don't seem like\n> > they fit in repository.h:\n> >\n> >> diff --git a/repository.h b/repository.h\n> >> +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n> >> +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n> >> +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n> >> +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n> >> +static inline int is_null_oid(const struct object_id *oid)\n> >> +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n> >> +static inline void oidcpy_with_padding(struct object_id *dst,\n> >> +                                   const struct object_id *src)\n> >> +static inline void hashclr(unsigned char *hash)\n> >> +static inline void oidclr(struct object_id *oid)\n> >> +static inline void oidread(struct object_id *oid, const unsigned char *hash)\n> >> +static inline int is_empty_blob_sha1(const unsigned char *sha1)\n> >> +static inline int is_empty_blob_oid(const struct object_id *oid)\n> >> +static inline int is_empty_tree_sha1(const unsigned char *sha1)\n> >> +static inline int is_empty_tree_oid(const struct object_id *oid)\n> >\n> > The goal to remove repository.h from hash.h and object.h makes sense\n> > as a goal, but is there another way to do it?\n>\n> Indeed.\n>\n> All of the above sit very well in hash simply because they are all\n> about hashes.  It does not have much to do with \"repository\", not\n> more than \"well, hashes we use to identify objects, and objects are\n> stored in repositories\".\n>\n> From the point of view of somebody who needs to use these macros, it\n> is utterly unnatural that they have to include \"repository.h\" (as\n> opposed to, say, \"hash.h\") just to be able to compare two hash\n> values.  Most of our programs interact with only one repository, and\n> it is understandable to include a header \"repository.h\" if your\n> program needs to interact with an extra repository other than the\n> \"current\" one.  But this feels backwards and not quite satisfactory,\n> even though inlines are special and I can fully sympathize with the\n> author who felt that this patch was necessary.\n\nWhat would you think of either of the two following alternative solutions:\n\n  * Move these into a new header, say \"hash-repository.h\" that folks\ncould include.  People wanting to use these macros would have to\ninclude an alternate header, but one that is perhaps more logically\nnamed, and would allow other headers to get the basics of hash.h\nwithout repository.h\n\n  * Move everything else in hash.h to a new header, say\n\"hash-basics.h\", which hash.h will #include.  That retains the ability\nfor people to depend on hash.h and use these inline functions, while\nalso giving other headers the option of including the basics of\ntoday's hash.h without repository.h.\n"},{"id":"475733","messageId":"947db4da-13d9-d81a-1c0c-d8fe62a9279f@github.com","threadId":"59603","inReplyTo":"CABPp-BELApT-6YrYJ5qwme9uwP_2gqERdiLiE7mJu_b0bXmCbg@mail.gmail.com","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-04-20T13:14:10Z","receivedAt":"2023-04-20T13:14:52Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/20/2023 1:06 AM, Elijah Newren wrote:\n\n> What would you think of either of the two following alternative solutions:\n> \n>   * Move these into a new header, say \"hash-repository.h\" that folks\n> could include.  People wanting to use these macros would have to\n> include an alternate header, but one that is perhaps more logically\n> named, and would allow other headers to get the basics of hash.h\n> without repository.h\n> \n>   * Move everything else in hash.h to a new header, say\n> \"hash-basics.h\", which hash.h will #include.  That retains the ability\n> for people to depend on hash.h and use these inline functions, while\n> also giving other headers the option of including the basics of\n> today's hash.h without repository.h.\n\nI like both of these options, but prefer the second one.\n\nThis is mostly because most consumers in the Git codebase will want\nthese methods, and only the most fundamental hashing code will care\nabout hashing separate from the_hash_algo. So, the most-natural name\nfor \"the header file that lets me hash stuff\" would be \"hash.h\" and\n\"hash-basics.h\" is for \"I'm doing very simple, low-level hashing\".\n\nThanks,\n-Stolee\n"},{"id":"475737","messageId":"xmqqpm7y4kht.fsf@gitster.g","threadId":"59603","inReplyTo":"947db4da-13d9-d81a-1c0c-d8fe62a9279f@github.com","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-20T15:54:38Z","receivedAt":"2023-04-20T15:54:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Derrick Stolee <derrickstolee@github.com> writes:\n\n> This is mostly because most consumers in the Git codebase will want\n> these methods, and only the most fundamental hashing code will care\n> about hashing separate from the_hash_algo. So, the most-natural name\n> for \"the header file that lets me hash stuff\" would be \"hash.h\" and\n> \"hash-basics.h\" is for \"I'm doing very simple, low-level hashing\".\n\nI do agree with the reasoning for \"most people want 'hash.h'\"; what\nis called the \"basics\" sounds more like for advanced users of the\nlow-level machinery, but somehow I expect \"basic\" would the one to\nbe used in sample programs in tutorials or something.  \"ll-hash.h\"\nfor low-level hash features?  I dunno.\n\nBut whatever the name for the header file meant to be used by\n\"advanced callers to low-level machinery\" would be, I like your\nchoice of the latter variant between the ones Elijah presented.\n\nThanks.\n"},{"id":"475759","messageId":"kl6lsfcu1g8w.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59603","inReplyTo":"xmqqpm7y4kht.fsf@gitster.g","subject":"Re: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-04-20T19:54:39Z","receivedAt":"2023-04-20T19:54:58Z","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> Derrick Stolee <derrickstolee@github.com> writes:\n>\n>> This is mostly because most consumers in the Git codebase will want\n>> these methods, and only the most fundamental hashing code will care\n>> about hashing separate from the_hash_algo. So, the most-natural name\n>> for \"the header file that lets me hash stuff\" would be \"hash.h\" and\n>> \"hash-basics.h\" is for \"I'm doing very simple, low-level hashing\".\n>\n> I do agree with the reasoning for \"most people want 'hash.h'\"; what\n> is called the \"basics\" sounds more like for advanced users of the\n> low-level machinery, but somehow I expect \"basic\" would the one to\n> be used in sample programs in tutorials or something.  \"ll-hash.h\"\n> for low-level hash features?  I dunno.\n>\n> But whatever the name for the header file meant to be used by\n> \"advanced callers to low-level machinery\" would be, I like your\n> choice of the latter variant between the ones Elijah presented.\n\nFWIW, I also think this is a good idea. I suspect that a lot of the\nlibification effort will need a similar distinction between \"a subsystem\nsupporting the needs of the git binary\" (aka high-level) and \"basic,\nreusable functionality that can be its own library\" (aka low-level).\n"},{"id":"475853","messageId":"1341ae8125eb23e7d469a5b3c79e3dee2d230537.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 01/22] treewide: be explicit about dependence on strbuf.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:08Z","receivedAt":"2023-04-22T20:17:41Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n color.c                       | 1 +\n common-main.c                 | 1 +\n credential.c                  | 1 +\n date.c                        | 1 +\n ll-merge.c                    | 1 +\n split-index.c                 | 1 +\n t/helper/test-mergesort.c     | 1 +\n t/helper/test-oid-array.c     | 1 +\n t/helper/test-oidtree.c       | 1 +\n t/helper/test-parse-options.c | 1 +\n t/helper/test-string-list.c   | 1 +\n wrapper.c                     | 1 +\n ws.c                          | 1 +\n 13 files changed, 13 insertions(+)\n\ndiff --git a/color.c b/color.c\nindex 6031998d3ea..f8a25ca807b 100644\n--- a/color.c\n+++ b/color.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pager.h\"\n+#include \"strbuf.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\n int color_stdout_is_tty = -1;\ndiff --git a/common-main.c b/common-main.c\nindex f3193173535..601a875e2fb 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"attr.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/credential.c b/credential.c\nindex e6417bf8804..42194efc9e0 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -8,6 +8,7 @@\n #include \"url.h\"\n #include \"prompt.h\"\n #include \"sigchain.h\"\n+#include \"strbuf.h\"\n #include \"urlmatch.h\"\n #include \"git-compat-util.h\"\n \ndiff --git a/date.c b/date.c\nindex e944c8905af..bc030da012f 100644\n--- a/date.c\n+++ b/date.c\n@@ -8,6 +8,7 @@\n #include \"date.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\n+#include \"strbuf.h\"\n \n /*\n  * This is like mktime, but without normalization of tm_wday and tm_yday.\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 28bc94c45d6..85517e668e3 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -12,6 +12,7 @@\n #include \"run-command.h\"\n #include \"ll-merge.h\"\n #include \"quote.h\"\n+#include \"strbuf.h\"\n #include \"wrapper.h\"\n \n struct ll_merge_driver;\ndiff --git a/split-index.c b/split-index.c\nindex 5602b74994b..3fc4e91485a 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"mem-pool.h\"\n #include \"split-index.h\"\n+#include \"strbuf.h\"\n #include \"ewah/ewok.h\"\n \n struct split_index *init_split_index(struct index_state *istate)\ndiff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c\nindex 737e0c52358..3aabae6c1c4 100644\n--- a/t/helper/test-mergesort.c\n+++ b/t/helper/test-mergesort.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"mem-pool.h\"\n #include \"mergesort.h\"\n+#include \"strbuf.h\"\n \n static uint32_t minstd_rand(uint32_t *state)\n {\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex fd6f73ea03b..ea3bf278984 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"oid-array.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n \n static int print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex edcb7e9f448..796c9811e0f 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"oidtree.h\"\n #include \"setup.h\"\n+#include \"strbuf.h\"\n \n static enum cb_next print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c\nindex 506835521a4..20a81a1eb21 100644\n--- a/t/helper/test-parse-options.c\n+++ b/t/helper/test-parse-options.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"parse-options.h\"\n+#include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"trace2.h\"\n \ndiff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c\nindex 2123dda85bf..959f27c74c6 100644\n--- a/t/helper/test-string-list.c\n+++ b/t/helper/test-string-list.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"strbuf.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/wrapper.c b/wrapper.c\nindex c130d7518bf..e80f83498d8 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"strbuf.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\n \ndiff --git a/ws.c b/ws.c\nindex da3d0e28cbb..036ccb8ee9d 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"attr.h\"\n+#include \"strbuf.h\"\n \n static struct whitespace_rule {\n \tconst char *rule_name;\n-- \ngitgitgadget\n\n"},{"id":"475854","messageId":"4a1f197e1e09e0941ce4a3b658cd199df52eeee5.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 02/22] symlinks.h: move declarations for symlinks.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:09Z","receivedAt":"2023-04-22T20:17:44Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c                |  1 +\n builtin/checkout.c     |  1 +\n builtin/update-index.c |  1 +\n cache.h                | 22 ----------------------\n compat/mingw.c         |  1 +\n diff-lib.c             |  1 +\n dir.c                  |  1 +\n entry.c                |  1 +\n merge-recursive.c      |  1 +\n parallel-checkout.c    |  1 +\n pathspec.c             |  1 +\n preload-index.c        |  1 +\n read-cache.c           |  1 +\n run-command.c          |  1 +\n symlinks.c             |  3 ++-\n symlinks.h             | 28 ++++++++++++++++++++++++++++\n unpack-trees.c         |  1 +\n 17 files changed, 44 insertions(+), 23 deletions(-)\n create mode 100644 symlinks.h\n\ndiff --git a/apply.c b/apply.c\nindex 2868cef5ddd..efe2dcb0e62 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -30,6 +30,7 @@\n #include \"apply.h\"\n #include \"entry.h\"\n #include \"setup.h\"\n+#include \"symlinks.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 6f5d82ed3d3..715eeb5048f 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -28,6 +28,7 @@\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 33b00cef151..58bbc80db77 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -23,6 +23,7 @@\n #include \"dir.h\"\n #include \"setup.h\"\n #include \"split-index.h\"\n+#include \"symlinks.h\"\n #include \"fsmonitor.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/cache.h b/cache.h\nindex 71e2fe74c4f..ffec289dc5d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,28 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-struct cache_def {\n-\tstruct strbuf path;\n-\tint flags;\n-\tint track_flags;\n-\tint prefix_len_stat_func;\n-};\n-#define CACHE_DEF_INIT { \\\n-\t.path = STRBUF_INIT, \\\n-}\n-static inline void cache_def_clear(struct cache_def *cache)\n-{\n-\tstrbuf_release(&cache->path);\n-}\n-\n-int has_symlink_leading_path(const char *name, int len);\n-int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);\n-int check_leading_path(const char *name, int len, int warn_on_lstat_err);\n-int has_dirs_only_path(const char *name, int len, int prefix_len);\n-void invalidate_lstat_cache(void);\n-void schedule_dir_for_removal(const char *name, int len);\n-void remove_scheduled_dirs(void);\n-\n struct pack_window {\n \tstruct pack_window *next;\n \tunsigned char *base;\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex abbc3faf32f..d06cdc6254f 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -13,6 +13,7 @@\n #include \"../config.h\"\n #include \"../environment.h\"\n #include \"../trace2.h\"\n+#include \"../symlinks.h\"\n #include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/diff-lib.c b/diff-lib.c\nindex d292405a262..60e979dc1bd 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -14,6 +14,7 @@\n #include \"unpack-trees.h\"\n #include \"refs.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"trace.h\"\n #include \"dir.h\"\n #include \"fsmonitor.h\"\ndiff --git a/dir.c b/dir.c\nindex aa840995c40..ed262fa6e43 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -25,6 +25,7 @@\n #include \"fsmonitor.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\n \ndiff --git a/entry.c b/entry.c\nindex d89e61fa641..91a540bd29f 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -7,6 +7,7 @@\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"progress.h\"\n #include \"fsmonitor.h\"\n #include \"entry.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 9875bdb11cb..d4d2ab05b2e 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -30,6 +30,7 @@\n #include \"string-list.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n+#include \"symlinks.h\"\n #include \"tag.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 50fd7fe31ef..7f0569cc930 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -10,6 +10,7 @@\n #include \"run-command.h\"\n #include \"sigchain.h\"\n #include \"streaming.h\"\n+#include \"symlinks.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 6972d515f0c..ec335a214e2 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -8,6 +8,7 @@\n #include \"attr.h\"\n #include \"setup.h\"\n #include \"strvec.h\"\n+#include \"symlinks.h\"\n #include \"quote.h\"\n \n /*\ndiff --git a/preload-index.c b/preload-index.c\nindex 4abf9c983b2..7a26b08c213 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -11,6 +11,7 @@\n #include \"progress.h\"\n #include \"thread-utils.h\"\n #include \"repository.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/read-cache.c b/read-cache.c\nindex f225bf44cd0..206c003e558 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -30,6 +30,7 @@\n #include \"trace2.h\"\n #include \"varint.h\"\n #include \"split-index.h\"\n+#include \"symlinks.h\"\n #include \"utf8.h\"\n #include \"fsmonitor.h\"\n #include \"thread-utils.h\"\ndiff --git a/run-command.c b/run-command.c\nindex e64bb08a5bf..d4247d5fcc6 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n+#include \"symlinks.h\"\n #include \"thread-utils.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/symlinks.c b/symlinks.c\nindex 27ecc93693b..b29e340c2da 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"setup.h\"\n+#include \"symlinks.h\"\n \n static int threaded_check_leading_path(struct cache_def *cache, const char *name,\n \t\t\t\t       int len, int warn_on_lstat_err);\ndiff --git a/symlinks.h b/symlinks.h\nnew file mode 100644\nindex 00000000000..7ae3d5b8569\n--- /dev/null\n+++ b/symlinks.h\n@@ -0,0 +1,28 @@\n+#ifndef SYMLINKS_H\n+#define SYMLINKS_H\n+\n+#include \"strbuf.h\"\n+\n+struct cache_def {\n+\tstruct strbuf path;\n+\tint flags;\n+\tint track_flags;\n+\tint prefix_len_stat_func;\n+};\n+#define CACHE_DEF_INIT { \\\n+\t.path = STRBUF_INIT, \\\n+}\n+static inline void cache_def_clear(struct cache_def *cache)\n+{\n+\tstrbuf_release(&cache->path);\n+}\n+\n+int has_symlink_leading_path(const char *name, int len);\n+int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);\n+int check_leading_path(const char *name, int len, int warn_on_lstat_err);\n+int has_dirs_only_path(const char *name, int len, int prefix_len);\n+void invalidate_lstat_cache(void);\n+void schedule_dir_for_removal(const char *name, int len);\n+void remove_scheduled_dirs(void);\n+\n+#endif /* SYMLINKS_H */\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex c6de2ca5a7e..e8a5295e737 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -18,6 +18,7 @@\n #include \"sparse-index.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n+#include \"symlinks.h\"\n #include \"trace2.h\"\n #include \"fsmonitor.h\"\n #include \"object-store.h\"\n-- \ngitgitgadget\n\n"},{"id":"475855","messageId":"99dfc5eb5dc1db367feeb90f668d32f4133fb044.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 03/22] packfile.h: move pack_window and pack_entry from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:10Z","receivedAt":"2023-04-22T20:17:49Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                   | 14 --------------\n packfile.h                | 16 ++++++++++++++--\n t/helper/test-read-midx.c |  1 +\n 3 files changed, 15 insertions(+), 16 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex ffec289dc5d..ffb9028f015 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,20 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-struct pack_window {\n-\tstruct pack_window *next;\n-\tunsigned char *base;\n-\toff_t offset;\n-\tsize_t len;\n-\tunsigned int last_used;\n-\tunsigned int inuse_cnt;\n-};\n-\n-struct pack_entry {\n-\toff_t offset;\n-\tstruct packed_git *p;\n-};\n-\n /* Dumb servers support */\n int update_server_info(int);\n \ndiff --git a/packfile.h b/packfile.h\nindex 665603b696a..c3692308b8d 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -6,10 +6,22 @@\n \n /* in object-store.h */\n struct packed_git;\n-struct pack_entry;\n-struct pack_window;\n struct object_info;\n \n+struct pack_window {\n+\tstruct pack_window *next;\n+\tunsigned char *base;\n+\toff_t offset;\n+\tsize_t len;\n+\tunsigned int last_used;\n+\tunsigned int inuse_cnt;\n+};\n+\n+struct pack_entry {\n+\toff_t offset;\n+\tstruct packed_git *p;\n+};\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\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex 05c4f2b2625..b32abff7f11 100644\n--- a/t/helper/test-read-midx.c\n+++ b/t/helper/test-read-midx.c\n@@ -5,6 +5,7 @@\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"pack-bitmap.h\"\n+#include \"packfile.h\"\n #include \"setup.h\"\n \n static int read_midx_file(const char *object_dir, int show_objects)\n-- \ngitgitgadget\n\n"},{"id":"475856","messageId":"2d829783f30ad9d9bee116d777f38b3d89ae0e0c.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 07/22] pkt-line.h: move declarations for pkt-line.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:14Z","receivedAt":"2023-04-22T20:17:53Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/bundle.c    | 1 +\n builtin/clone.c     | 1 +\n builtin/fetch.c     | 1 +\n builtin/ls-remote.c | 1 +\n builtin/push.c      | 1 +\n cache.h             | 3 ---\n pkt-line.h          | 2 ++\n 7 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex e68fc83d943..584d905d965 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -4,6 +4,7 @@\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n+#include \"pkt-line.h\"\n #include \"cache.h\"\n #include \"bundle.h\"\n \ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 017ebc3faa8..fa300f483e9 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -39,6 +39,7 @@\n #include \"setup.h\"\n #include \"connected.h\"\n #include \"packfile.h\"\n+#include \"pkt-line.h\"\n #include \"list-objects-filter-options.h\"\n #include \"hook.h\"\n #include \"bundle.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 61e8ac113b1..4fee2a62376 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -29,6 +29,7 @@\n #include \"utf8.h\"\n #include \"packfile.h\"\n #include \"pager.h\"\n+#include \"pkt-line.h\"\n #include \"list-objects-filter-options.h\"\n #include \"commit-reach.h\"\n #include \"branch.h\"\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex 11d9424804a..7972febf726 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n+#include \"pkt-line.h\"\n #include \"ref-filter.h\"\n #include \"remote.h\"\n #include \"refs.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 6001e4ae0a4..7d2b0505aac 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -14,6 +14,7 @@\n #include \"remote.h\"\n #include \"transport.h\"\n #include \"parse-options.h\"\n+#include \"pkt-line.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"send-pack.h\"\ndiff --git a/cache.h b/cache.h\nindex b89f4c59802..fde782a96f0 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* pkt-line.c */\n-void packet_trace_identity(const char *prog);\n-\n /* add */\n /*\n  * return 0 if success, 1 - if addition of a file failed and\ndiff --git a/pkt-line.h b/pkt-line.h\nindex 8e9846f3151..7c23a4bfaf7 100644\n--- a/pkt-line.h\n+++ b/pkt-line.h\n@@ -246,4 +246,6 @@ void packet_writer_error(struct packet_writer *writer, const char *fmt, ...);\n void packet_writer_delim(struct packet_writer *writer);\n void packet_writer_flush(struct packet_writer *writer);\n \n+void packet_trace_identity(const char *prog);\n+\n #endif\n-- \ngitgitgadget\n\n"},{"id":"475857","messageId":"b2ce7a1786892267dc46669ef8aa5e2ec838170b.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 04/22] server-info.h: move declarations for server-info.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:11Z","receivedAt":"2023-04-22T20:17:55Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/receive-pack.c       | 1 +\n builtin/repack.c             | 1 +\n builtin/update-server-info.c | 1 +\n cache.h                      | 3 ---\n server-info.c                | 3 ++-\n server-info.h                | 7 +++++++\n 6 files changed, 12 insertions(+), 4 deletions(-)\n create mode 100644 server-info.h\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 7d921170f1c..dae99e4554d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -33,6 +33,7 @@\n #include \"object-store.h\"\n #include \"protocol.h\"\n #include \"commit-reach.h\"\n+#include \"server-info.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex df4d8e0f0ba..bed2c2aaafb 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -7,6 +7,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n+#include \"server-info.h\"\n #include \"sigchain.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex e7bff27ae40..19dce3c0655 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -3,6 +3,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"server-info.h\"\n \n static const char * const update_server_info_usage[] = {\n \t\"git update-server-info [-f | --force]\",\ndiff --git a/cache.h b/cache.h\nindex ffb9028f015..2eb4546473f 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* Dumb servers support */\n-int update_server_info(int);\n-\n #define COPY_READ_ERROR (-2)\n #define COPY_WRITE_ERROR (-3)\n int copy_fd(int ifd, int ofd);\ndiff --git a/server-info.c b/server-info.c\nindex 68098ddd1ad..55aa04f00ab 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n #include \"environment.h\"\n@@ -11,6 +11,7 @@\n #include \"packfile.h\"\n #include \"object-file.h\"\n #include \"object-store.h\"\n+#include \"server-info.h\"\n #include \"strbuf.h\"\n #include \"wrapper.h\"\n \ndiff --git a/server-info.h b/server-info.h\nnew file mode 100644\nindex 00000000000..13bbde2c55f\n--- /dev/null\n+++ b/server-info.h\n@@ -0,0 +1,7 @@\n+#ifndef SERVER_INFO_H\n+#define SERVER_INFO_H\n+\n+/* Dumb servers support */\n+int update_server_info(int);\n+\n+#endif /* SERVER_INFO_H */\n-- \ngitgitgadget\n\n"},{"id":"475858","messageId":"513ffafa597f18363bdcd308cf8159c21e66ecb0.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 05/22] copy.h: move declarations for copy.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:12Z","receivedAt":"2023-04-22T20:17:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/bisect.c     |  1 +\n builtin/clone.c      |  1 +\n builtin/difftool.c   |  1 +\n builtin/init-db.c    |  1 +\n builtin/worktree.c   |  1 +\n bundle-uri.c         |  1 +\n cache.h              |  6 ------\n convert.c            |  1 +\n copy.c               |  1 +\n copy.h               | 10 ++++++++++\n pkt-line.c           |  1 +\n refs/files-backend.c |  1 +\n rerere.c             |  1 +\n sequencer.c          |  1 +\n 14 files changed, 22 insertions(+), 6 deletions(-)\n create mode 100644 copy.h\n\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 4b2143d4557..4812450c393 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 4ed0a1d5aad..017ebc3faa8 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -13,6 +13,7 @@\n #include \"abspath.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 3ffb0524be7..409507983f2 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"environment.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 6183f3fb3ff..cda6ee75eb5 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -6,6 +6,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 0621f6f708e..0b411e9deee 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n #include \"environment.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 1ff1cf51dad..6d44662ee1f 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"bundle-uri.h\"\n #include \"bundle.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\ndiff --git a/cache.h b/cache.h\nindex 2eb4546473f..2b661764794 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,12 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-#define COPY_READ_ERROR (-2)\n-#define COPY_WRITE_ERROR (-3)\n-int copy_fd(int ifd, int ofd);\n-int copy_file(const char *dst, const char *src, int mode);\n-int copy_file_with_time(const char *dst, const char *src, int mode);\n-\n /* base85 */\n int decode_85(char *dst, const char *line, int linelen);\n void encode_85(char *buf, const unsigned char *data, int bytes);\ndiff --git a/convert.c b/convert.c\nindex 5a2ea5308d6..7cf7bd0c883 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -2,6 +2,7 @@\n #include \"advice.h\"\n #include \"config.h\"\n #include \"convert.h\"\n+#include \"copy.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/copy.c b/copy.c\nindex c3250f08221..db6b615c188 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\ndiff --git a/copy.h b/copy.h\nnew file mode 100644\nindex 00000000000..2af77cba864\n--- /dev/null\n+++ b/copy.h\n@@ -0,0 +1,10 @@\n+#ifndef COPY_H\n+#define COPY_H\n+\n+#define COPY_READ_ERROR (-2)\n+#define COPY_WRITE_ERROR (-3)\n+int copy_fd(int ifd, int ofd);\n+int copy_file(const char *dst, const char *src, int mode);\n+int copy_file_with_time(const char *dst, const char *src, int mode);\n+\n+#endif /* COPY_H */\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 3561d853584..8b5fa788517 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"copy.h\"\n #include \"pkt-line.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d0581ee41ac..1128a9af292 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1,5 +1,6 @@\n #include \"../cache.h\"\n #include \"../config.h\"\n+#include \"../copy.h\"\n #include \"../environment.h\"\n #include \"../gettext.h\"\n #include \"../hex.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 7abc94bf444..e968d413d65 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex fcca3b81447..c16df514434 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3,6 +3,7 @@\n #include \"advice.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"copy.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n-- \ngitgitgadget\n\n"},{"id":"475860","messageId":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.git.1681614205.gitgitgadget@gmail.com","subject":"[PATCH v2 00/22] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:07Z","receivedAt":"2023-04-22T20:17:58Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Changes since v1:\n\n * dropped the 3rd patch (it was pulled into the series this one depends\n   upon to fix an issue in it)\n * redid the old patch 14 (new patch 13); moved the parts of hash.h not\n   depending on repository.h into hash-ll.h so that other headers and files\n   could depend upon just that part. (Are people happy with the hash-ll.h\n   name or have alternate suggestions?)\n\nMaintainer notes: (1) This series is based on en/header-split-cache-h (now\nin next). (2) Although I've tweaked the series to minimize conflicts, there\nis a semantic conflict with sl/sparse-write-tree in next; to resolve, add an\ninclude of repository.h in builtin/write-tree.c.\n\nThis series continues to focus on splitting declarations from cache.h to\nseparate headers. This series also untangles some dependencies between\nhash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\nup a few other headers. At the end of this series the number of cache.h\nincludes drops from 189 down to 149.\n\nThe series may appear to be long at first glance, but is filled with mostly\nrepetitive and simple changes similar to those from earlier series. An\noverview:\n\n * Patch 1: files depending on strbuf.h should be explicit about it\n * Patches 2-13: move stuff out of cache.h into other more logical headers\n * Patch 14-16: move functions between hash<->repository and\n   read-cache<->tree to simplify dependencies\n * Patch 17: remove includes of cache.h permitted by the previous 16 patches\n * Patches 18-22: clean up now-unnecessary includes in other headers\n * Patch 23: start enforcing git-compat-util.h is first include for reftable\n   files as well.\n\nAnd thanks once again to Dscho for gitgitgadget. Getting multiple platform\ntesting + all the special tests (sparse, cocci, hdr-check, etc.) really\nhelps clean out all the issues that would otherwise hit a series like this.\n\nElijah Newren (22):\n  treewide: be explicit about dependence on strbuf.h\n  symlinks.h: move declarations for symlinks.c functions from cache.h\n  packfile.h: move pack_window and pack_entry from cache.h\n  server-info.h: move declarations for server-info.c functions from\n    cache.h\n  copy.h: move declarations for copy.c functions from cache.h\n  base85.h: move declarations for base85.c functions from cache.h\n  pkt-line.h: move declarations for pkt-line.c functions from cache.h\n  match-trees.h: move declarations for match-trees.c functions from\n    cache.h\n  ws.h: move declarations for ws.c functions from cache.h\n  versioncmp.h: move declarations for versioncmp.c functions from\n    cache.h\n  dir.h: move DTYPE defines from cache.h\n  tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h\n  hash-ll.h: split out of hash.h to remove dependency on repository.h\n  cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c\n  cache,tree: move basic name compare functions from read-cache to tree\n  treewide: remove cache.h inclusion due to previous changes\n  cache.h: remove unnecessary headers\n  fsmonitor: reduce includes of cache.h\n  commit.h: reduce unnecessary includes\n  object-store.h: reduce unnecessary includes\n  diff.h: reduce unnecessary includes\n  reftable: ensure git-compat-util.h is the first (indirect) include\n\n add-interactive.c                            |   1 +\n alloc.c                                      |   1 +\n apply.c                                      |   3 +\n apply.h                                      |   2 +-\n archive-zip.c                                |   2 +-\n archive.c                                    |   2 +\n attr.c                                       |   1 +\n base85.c                                     |   3 +-\n base85.h                                     |   7 +\n bloom.c                                      |   1 +\n branch.c                                     |   1 +\n builtin/apply.c                              |   1 +\n builtin/archive.c                            |   1 +\n builtin/bisect.c                             |   1 +\n builtin/bundle.c                             |   2 +\n builtin/check-attr.c                         |   1 +\n builtin/check-ignore.c                       |   1 +\n builtin/checkout-index.c                     |   1 +\n builtin/checkout.c                           |   1 +\n builtin/clean.c                              |   1 +\n builtin/clone.c                              |   2 +\n builtin/config.c                             |   1 +\n builtin/credential-cache.c                   |   1 +\n builtin/credential-store.c                   |   1 +\n builtin/diff-tree.c                          |   1 +\n builtin/diff.c                               |   1 +\n builtin/difftool.c                           |   1 +\n builtin/fetch.c                              |   1 +\n builtin/for-each-repo.c                      |   2 +\n builtin/gc.c                                 |   1 +\n builtin/help.c                               |   1 +\n builtin/init-db.c                            |   2 +\n builtin/log.c                                |   1 +\n builtin/ls-remote.c                          |   1 +\n builtin/merge-index.c                        |   1 +\n builtin/merge-recursive.c                    |   2 +\n builtin/merge-tree.c                         |   1 +\n builtin/mv.c                                 |   1 +\n builtin/push.c                               |   2 +\n builtin/read-tree.c                          |   1 +\n builtin/receive-pack.c                       |   1 +\n builtin/repack.c                             |   1 +\n builtin/rerere.c                             |   1 +\n builtin/rm.c                                 |   2 +\n builtin/show-branch.c                        |   2 +\n builtin/show-index.c                         |   2 +\n builtin/update-index.c                       |   3 +\n builtin/update-ref.c                         |   2 +\n builtin/update-server-info.c                 |   1 +\n builtin/upload-archive.c                     |   1 +\n builtin/worktree.c                           |   2 +\n bundle-uri.c                                 |   3 +-\n cache.h                                      | 122 +-------\n checkout.c                                   |   1 +\n checkout.h                                   |   2 +-\n chunk-format.c                               |   1 +\n chunk-format.h                               |   2 +-\n color.c                                      |   3 +-\n combine-diff.c                               |   3 +-\n commit-graph.c                               |   1 +\n commit.c                                     |   1 +\n commit.h                                     |  11 +-\n common-main.c                                |   4 +-\n compat/fsmonitor/fsm-health-darwin.c         |   2 +-\n compat/fsmonitor/fsm-ipc-darwin.c            |   4 +-\n compat/fsmonitor/fsm-ipc-win32.c             |   1 +\n compat/fsmonitor/fsm-listen-darwin.c         |   3 +-\n compat/mingw.c                               |   1 +\n compat/precompose_utf8.c                     |   1 +\n compat/win32/trace2_win32_process_info.c     |   1 +\n config.c                                     |   3 +-\n convert.c                                    |   1 +\n convert.h                                    |   2 +-\n copy.c                                       |   4 +-\n copy.h                                       |  10 +\n credential.c                                 |   3 +-\n csum-file.c                                  |   1 +\n csum-file.h                                  |   2 +-\n daemon.c                                     |   3 +-\n date.c                                       |   3 +-\n diagnose.c                                   |   2 +-\n diff-lib.c                                   |   1 +\n diff.c                                       |   2 +\n diff.h                                       |   1 -\n diffcore.h                                   |   2 +-\n dir.c                                        |   2 +\n dir.h                                        |  15 +\n editor.c                                     |   1 +\n entry.c                                      |   1 +\n environment.c                                |   3 +-\n exec-cmd.c                                   |   1 +\n fetch-pack.c                                 |   1 +\n fsck.c                                       |   1 +\n fsmonitor--daemon.h                          |   1 -\n fsmonitor-ipc.c                              |   1 +\n gpg-interface.c                              |   2 +\n grep.c                                       |   1 +\n hash-ll.h                                    | 276 +++++++++++++++++++\n hash-lookup.c                                |   1 +\n hash.h                                       | 273 +-----------------\n hashmap.h                                    |   2 +-\n hex.c                                        |   1 +\n hex.h                                        |   2 +-\n hook.c                                       |   1 +\n http-push.c                                  |   2 +\n khash.h                                      |   1 +\n line-log.c                                   |   1 +\n ll-merge.c                                   |   3 +-\n log-tree.c                                   |   1 +\n ls-refs.c                                    |   1 +\n match-trees.c                                |   3 +-\n match-trees.h                                |  10 +\n merge-ort-wrappers.c                         |   2 +\n merge-ort.c                                  |   1 +\n merge-ort.h                                  |   2 +-\n merge-recursive.c                            |   2 +\n merge.c                                      |   1 +\n midx.c                                       |   2 +-\n negotiator/default.c                         |   1 +\n negotiator/skipping.c                        |   1 +\n notes-cache.c                                |   1 +\n notes-utils.c                                |   1 +\n object-file.c                                |   3 +-\n object-file.h                                |   2 +\n object-name.c                                |   2 +\n object-store.h                               |   8 +-\n object.h                                     |   3 +-\n oidmap.c                                     |   1 +\n oidtree.h                                    |   2 +-\n pack-bitmap-write.c                          |   2 +\n packfile.c                                   |   2 +-\n packfile.h                                   |  16 +-\n parallel-checkout.c                          |   2 +\n parse-options-cb.c                           |   1 +\n parse-options.c                              |   1 +\n pathspec.c                                   |   2 +\n pkt-line.c                                   |   3 +-\n pkt-line.h                                   |   2 +\n preload-index.c                              |   1 +\n progress.c                                   |   1 +\n protocol-caps.c                              |   2 +-\n range-diff.c                                 |   2 +-\n read-cache.c                                 |  81 +-----\n rebase-interactive.c                         |   1 +\n ref-filter.c                                 |   4 +-\n reflog.c                                     |   2 +\n refs/debug.c                                 |   1 +\n refs/files-backend.c                         |   2 +\n refs/packed-backend.c                        |   1 +\n refs/ref-cache.c                             |   2 +\n refs/ref-cache.h                             |   3 +-\n refspec.c                                    |   2 +\n reftable/dump.c                              |   2 +-\n reftable/error.c                             |   1 +\n reftable/publicbasics.c                      |   2 +-\n reftable/system.h                            |   2 +-\n reftable/tree.c                              |   2 +-\n reftable/tree_test.c                         |   1 +\n rerere.c                                     |   1 +\n reset.h                                      |   2 +-\n resolve-undo.c                               |   1 +\n resolve-undo.h                               |   2 +-\n revision.h                                   |   1 +\n run-command.c                                |   1 +\n send-pack.c                                  |   1 +\n sequencer.c                                  |   1 +\n server-info.c                                |   3 +-\n server-info.h                                |   7 +\n split-index.c                                |   2 +\n split-index.h                                |   2 +-\n strbuf.c                                     |   1 +\n submodule-config.c                           |   1 +\n symlinks.c                                   |   3 +-\n symlinks.h                                   |  28 ++\n t/helper/test-bloom.c                        |   1 +\n t/helper/test-cache-tree.c                   |   1 +\n t/helper/test-dump-cache-tree.c              |   2 +\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-example-decorate.c             |   1 +\n t/helper/test-fsmonitor-client.c             |   1 +\n t/helper/test-lazy-init-name-hash.c          |   1 +\n t/helper/test-match-trees.c                  |   3 +-\n t/helper/test-mergesort.c                    |   2 +-\n t/helper/test-oid-array.c                    |   2 +-\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   2 +-\n t/helper/test-parse-options.c                |   2 +-\n t/helper/test-path-utils.c                   |   1 +\n t/helper/test-read-cache.c                   |   1 +\n t/helper/test-read-midx.c                    |   2 +-\n t/helper/test-reftable.c                     |   1 +\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-string-list.c                  |   2 +-\n t/helper/test-submodule-config.c             |   2 +\n t/helper/test-submodule-nested-repo-config.c |   1 +\n t/helper/test-submodule.c                    |   1 +\n t/helper/test-trace2.c                       |   1 +\n t/helper/test-write-cache.c                  |   1 +\n trace2.c                                     |   1 +\n trace2/tr2_tgt_event.c                       |   1 +\n trace2/tr2_tgt_normal.c                      |   1 +\n trace2/tr2_tgt_perf.c                        |   1 +\n tree-diff.c                                  |  16 +-\n tree-walk.c                                  |   2 +-\n tree-walk.h                                  |   3 +-\n tree.c                                       |  72 ++++-\n tree.h                                       |  11 +-\n unpack-trees.c                               |   1 +\n versioncmp.c                                 |   3 +-\n versioncmp.h                                 |   6 +\n wrapper.c                                    |   5 +-\n ws.c                                         |   6 +-\n ws.h                                         |  33 +++\n wt-status.c                                  |   1 +\n xdiff-interface.h                            |   2 +-\n 216 files changed, 785 insertions(+), 545 deletions(-)\n create mode 100644 base85.h\n create mode 100644 copy.h\n create mode 100644 hash-ll.h\n create mode 100644 match-trees.h\n create mode 100644 server-info.h\n create mode 100644 symlinks.h\n create mode 100644 versioncmp.h\n create mode 100644 ws.h\n\n\nbase-commit: 331b094eec6d4c937af6e59df2a537112e4d8205\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1517%2Fnewren%2Fheader-cleanup-4-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1517/newren/header-cleanup-4-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1517\n\nRange-diff vs v1:\n\n  1:  6d6b8099374 =  1:  1341ae8125e treewide: be explicit about dependence on strbuf.h\n  2:  9f9a3561295 =  2:  4a1f197e1e0 symlinks.h: move declarations for symlinks.c functions from cache.h\n  3:  003548de707 <  -:  ----------- protocol.h: move definition of DEFAULT_GIT_PORT from cache.h\n  4:  cf28ce0ee20 =  3:  99dfc5eb5dc packfile.h: move pack_window and pack_entry from cache.h\n  5:  e22c8f242f3 =  4:  b2ce7a17868 server-info.h: move declarations for server-info.c functions from cache.h\n  6:  dbd08e60b58 =  5:  513ffafa597 copy.h: move declarations for copy.c functions from cache.h\n  7:  9d9672ebf52 =  6:  c5831480855 base85.h: move declarations for base85.c functions from cache.h\n  8:  e8efc37ecb2 =  7:  2d829783f30 pkt-line.h: move declarations for pkt-line.c functions from cache.h\n  9:  11c6cd13e2b =  8:  0a321c41c3f match-trees.h: move declarations for match-trees.c functions from cache.h\n 10:  e600309df1f =  9:  951eff98a4d ws.h: move declarations for ws.c functions from cache.h\n 11:  07e5da241dc = 10:  ff99d0eb207 versioncmp.h: move declarations for versioncmp.c functions from cache.h\n 12:  4c951a53737 = 11:  673a3ae4fe2 dir.h: move DTYPE defines from cache.h\n 13:  dec377e17f5 = 12:  7b55f82e62e tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h\n 14:  1c6989ae456 ! 13:  d95f97f5e90 hash.h, repository.h: reverse the order of these dependencies\n     @@ Metadata\n      Author: Elijah Newren <newren@gmail.com>\n      \n       ## Commit message ##\n     -    hash.h, repository.h: reverse the order of these dependencies\n     +    hash-ll.h: split out of hash.h to remove dependency on repository.h\n      \n     -    Previously, hash.h depended upon and included repository.h, due to\n     -    the definition and use of the_hash_algo (defined as\n     -    the_repository->hash_algo).  Move this #define, and the associated\n     -    inline functions that depend upon it, from hash.h to repository.h.\n     -    Due to that movement, reverse the dependencies so repository.h includes\n     -    hash.h.\n     +    hash.h depends upon and includes repository.h, due to the definition and\n     +    use of the_hash_algo (defined as the_repository->hash_algo).  However,\n     +    most headers trying to include hash.h are only interested in the layout\n     +    of the structs like object_id.  Move the parts of hash.h that do not\n     +    depend upon repository.h into a new file hash-ll.h (the \"low level\"\n     +    parts of hash.h), and adjust other files to use this new header where\n     +    the convenience inline functions aren't needed.\n      \n          This allows hash.h and object.h to be fairly small, minimal headers.  It\n          also exposes a lot of hidden dependencies on both path.h (which was\n          brought in by repository.h) and repository.h (which was previously\n     -    implicitly brought in by object.h).\n     +    implicitly brought in by object.h), so also adjust other files to be\n     +    more explicit about what they depend upon.\n      \n          Signed-off-by: Elijah Newren <newren@gmail.com>\n      \n     @@ alloc.c\n       #include \"alloc.h\"\n       \n      \n     + ## apply.h ##\n     +@@\n     + #ifndef APPLY_H\n     + #define APPLY_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"lockfile.h\"\n     + #include \"string-list.h\"\n     + #include \"strmap.h\"\n     +\n       ## branch.c ##\n      @@\n       #include \"refs.h\"\n     @@ builtin/clean.c\n      \n       ## builtin/config.c ##\n      @@\n     + #include \"ident.h\"\n       #include \"parse-options.h\"\n       #include \"urlmatch.h\"\n     ++#include \"path.h\"\n       #include \"quote.h\"\n     -+#include \"repository.h\"\n       #include \"setup.h\"\n       #include \"worktree.h\"\n     - #include \"wrapper.h\"\n      \n       ## builtin/credential-cache.c ##\n      @@\n       #include \"builtin.h\"\n       #include \"gettext.h\"\n       #include \"parse-options.h\"\n     -+#include \"repository.h\"\n     ++#include \"path.h\"\n       #include \"wrapper.h\"\n       #include \"write-or-die.h\"\n       \n     @@ builtin/merge-index.c\n      \n       ## builtin/merge-recursive.c ##\n      @@\n     + #include \"advice.h\"\n     + #include \"commit.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n       #include \"tag.h\"\n       #include \"merge-recursive.h\"\n       #include \"object-name.h\"\n     @@ builtin/rerere.c\n      \n       ## builtin/rm.c ##\n      @@\n     + #include \"dir.h\"\n     + #include \"cache-tree.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n       #include \"tree-walk.h\"\n       #include \"object-name.h\"\n       #include \"parse-options.h\"\n     @@ builtin/rm.c\n       #include \"submodule.h\"\n      \n       ## builtin/show-branch.c ##\n     +@@\n     + #include \"config.h\"\n     + #include \"environment.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"hex.h\"\n     + #include \"pretty.h\"\n     + #include \"refs.h\"\n      @@\n       #include \"strvec.h\"\n       #include \"object-name.h\"\n     @@ builtin/show-branch.c\n      \n       ## builtin/show-index.c ##\n      @@\n     + #include \"builtin.h\"\n     + #include \"cache.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n       #include \"hex.h\"\n       #include \"pack.h\"\n       #include \"parse-options.h\"\n     @@ builtin/show-index.c\n       \t\"git show-index [--object-format=<hash-algorithm>]\",\n      \n       ## builtin/update-index.c ##\n     +@@\n     + #include \"config.h\"\n     + #include \"environment.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"hex.h\"\n     + #include \"lockfile.h\"\n     + #include \"quote.h\"\n      @@\n       #include \"parse-options.h\"\n       #include \"pathspec.h\"\n     @@ builtin/update-index.c\n      \n       ## builtin/update-ref.c ##\n      @@\n     + #include \"cache.h\"\n     + #include \"config.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"refs.h\"\n     + #include \"builtin.h\"\n       #include \"object-name.h\"\n       #include \"parse-options.h\"\n       #include \"quote.h\"\n     @@ checkout.c\n       #include \"config.h\"\n       #include \"strbuf.h\"\n      \n     + ## checkout.h ##\n     +@@\n     + #ifndef CHECKOUT_H\n     + #define CHECKOUT_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + /*\n     +  * Check if the branch name uniquely matches a branch name on a remote\n     +\n       ## chunk-format.c ##\n      @@\n       #include \"chunk-format.h\"\n       #include \"csum-file.h\"\n       #include \"gettext.h\"\n     -+#include \"repository.h\"\n     ++#include \"hash.h\"\n       #include \"trace2.h\"\n       \n       /*\n      \n     + ## chunk-format.h ##\n     +@@\n     + #ifndef CHUNK_FORMAT_H\n     + #define CHUNK_FORMAT_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + struct hashfile;\n     + struct chunkfile;\n     +\n       ## common-main.c ##\n      @@\n       #include \"exec-cmd.h\"\n     @@ compat/win32/trace2_win32_process_info.c\n       #include \"lazyload.h\"\n       #include <Psapi.h>\n      \n     + ## convert.h ##\n     +@@\n     + #ifndef CONVERT_H\n     + #define CONVERT_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"string-list.h\"\n     + \n     + struct index_state;\n     +\n       ## copy.c ##\n      @@\n       #include \"cache.h\"\n     @@ csum-file.c\n       #include \"git-compat-util.h\"\n       #include \"progress.h\"\n       #include \"csum-file.h\"\n     -+#include \"repository.h\"\n     ++#include \"hash.h\"\n       #include \"wrapper.h\"\n       \n       static void verify_buffer_or_die(struct hashfile *f,\n      \n     + ## csum-file.h ##\n     +@@\n     + #ifndef CSUM_FILE_H\n     + #define CSUM_FILE_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"write-or-die.h\"\n     + \n     + struct progress;\n     +\n       ## daemon.c ##\n      @@\n       #include \"alloc.h\"\n     @@ daemon.c\n       #include \"protocol.h\"\n       #include \"run-command.h\"\n      \n     + ## diffcore.h ##\n     +@@\n     + #ifndef DIFFCORE_H\n     + #define DIFFCORE_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + struct diff_options;\n     + struct mem_pool;\n     +\n       ## editor.c ##\n      @@\n       #include \"environment.h\"\n     @@ gpg-interface.c\n       #include \"tempfile.h\"\n       #include \"alias.h\"\n      \n     + ## hash-ll.h (new) ##\n     +@@\n     ++#ifndef HASH_LL_H\n     ++#define HASH_LL_H\n     ++\n     ++#if defined(SHA1_APPLE)\n     ++#include <CommonCrypto/CommonDigest.h>\n     ++#elif defined(SHA1_OPENSSL)\n     ++#include <openssl/sha.h>\n     ++#elif defined(SHA1_DC)\n     ++#include \"sha1dc_git.h\"\n     ++#else /* SHA1_BLK */\n     ++#include \"block-sha1/sha1.h\"\n     ++#endif\n     ++\n     ++#if defined(SHA256_NETTLE)\n     ++#include \"sha256/nettle.h\"\n     ++#elif defined(SHA256_GCRYPT)\n     ++#define SHA256_NEEDS_CLONE_HELPER\n     ++#include \"sha256/gcrypt.h\"\n     ++#elif defined(SHA256_OPENSSL)\n     ++#include <openssl/sha.h>\n     ++#else\n     ++#include \"sha256/block/sha256.h\"\n     ++#endif\n     ++\n     ++#ifndef platform_SHA_CTX\n     ++/*\n     ++ * platform's underlying implementation of SHA-1; could be OpenSSL,\n     ++ * blk_SHA, Apple CommonCrypto, etc...  Note that the relevant\n     ++ * SHA-1 header may have already defined platform_SHA_CTX for our\n     ++ * own implementations like block-sha1, so we list\n     ++ * the default for OpenSSL compatible SHA-1 implementations here.\n     ++ */\n     ++#define platform_SHA_CTX\tSHA_CTX\n     ++#define platform_SHA1_Init\tSHA1_Init\n     ++#define platform_SHA1_Update\tSHA1_Update\n     ++#define platform_SHA1_Final    \tSHA1_Final\n     ++#endif\n     ++\n     ++#define git_SHA_CTX\t\tplatform_SHA_CTX\n     ++#define git_SHA1_Init\t\tplatform_SHA1_Init\n     ++#define git_SHA1_Update\t\tplatform_SHA1_Update\n     ++#define git_SHA1_Final\t\tplatform_SHA1_Final\n     ++\n     ++#ifndef platform_SHA256_CTX\n     ++#define platform_SHA256_CTX\tSHA256_CTX\n     ++#define platform_SHA256_Init\tSHA256_Init\n     ++#define platform_SHA256_Update\tSHA256_Update\n     ++#define platform_SHA256_Final\tSHA256_Final\n     ++#endif\n     ++\n     ++#define git_SHA256_CTX\t\tplatform_SHA256_CTX\n     ++#define git_SHA256_Init\t\tplatform_SHA256_Init\n     ++#define git_SHA256_Update\tplatform_SHA256_Update\n     ++#define git_SHA256_Final\tplatform_SHA256_Final\n     ++\n     ++#ifdef platform_SHA256_Clone\n     ++#define git_SHA256_Clone\tplatform_SHA256_Clone\n     ++#endif\n     ++\n     ++#ifdef SHA1_MAX_BLOCK_SIZE\n     ++#include \"compat/sha1-chunked.h\"\n     ++#undef git_SHA1_Update\n     ++#define git_SHA1_Update\t\tgit_SHA1_Update_Chunked\n     ++#endif\n     ++\n     ++static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)\n     ++{\n     ++\tmemcpy(dst, src, sizeof(*dst));\n     ++}\n     ++\n     ++#ifndef SHA256_NEEDS_CLONE_HELPER\n     ++static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)\n     ++{\n     ++\tmemcpy(dst, src, sizeof(*dst));\n     ++}\n     ++#endif\n     ++\n     ++/*\n     ++ * Note that these constants are suitable for indexing the hash_algos array and\n     ++ * comparing against each other, but are otherwise arbitrary, so they should not\n     ++ * be exposed to the user or serialized to disk.  To know whether a\n     ++ * git_hash_algo struct points to some usable hash function, test the format_id\n     ++ * field for being non-zero.  Use the name field for user-visible situations and\n     ++ * the format_id field for fixed-length fields on disk.\n     ++ */\n     ++/* An unknown hash function. */\n     ++#define GIT_HASH_UNKNOWN 0\n     ++/* SHA-1 */\n     ++#define GIT_HASH_SHA1 1\n     ++/* SHA-256  */\n     ++#define GIT_HASH_SHA256 2\n     ++/* Number of algorithms supported (including unknown). */\n     ++#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)\n     ++\n     ++/* \"sha1\", big-endian */\n     ++#define GIT_SHA1_FORMAT_ID 0x73686131\n     ++\n     ++/* The length in bytes and in hex digits of an object name (SHA-1 value). */\n     ++#define GIT_SHA1_RAWSZ 20\n     ++#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)\n     ++/* The block size of SHA-1. */\n     ++#define GIT_SHA1_BLKSZ 64\n     ++\n     ++/* \"s256\", big-endian */\n     ++#define GIT_SHA256_FORMAT_ID 0x73323536\n     ++\n     ++/* The length in bytes and in hex digits of an object name (SHA-256 value). */\n     ++#define GIT_SHA256_RAWSZ 32\n     ++#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)\n     ++/* The block size of SHA-256. */\n     ++#define GIT_SHA256_BLKSZ 64\n     ++\n     ++/* The length in byte and in hex digits of the largest possible hash value. */\n     ++#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ\n     ++#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ\n     ++/* The largest possible block size for any supported hash. */\n     ++#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ\n     ++\n     ++struct object_id {\n     ++\tunsigned char hash[GIT_MAX_RAWSZ];\n     ++\tint algo;\t/* XXX requires 4-byte alignment */\n     ++};\n     ++\n     ++#define GET_OID_QUIETLY           01\n     ++#define GET_OID_COMMIT            02\n     ++#define GET_OID_COMMITTISH        04\n     ++#define GET_OID_TREE             010\n     ++#define GET_OID_TREEISH          020\n     ++#define GET_OID_BLOB             040\n     ++#define GET_OID_FOLLOW_SYMLINKS 0100\n     ++#define GET_OID_RECORD_PATH     0200\n     ++#define GET_OID_ONLY_TO_DIE    04000\n     ++#define GET_OID_REQUIRE_PATH  010000\n     ++\n     ++#define GET_OID_DISAMBIGUATORS \\\n     ++\t(GET_OID_COMMIT | GET_OID_COMMITTISH | \\\n     ++\tGET_OID_TREE | GET_OID_TREEISH | \\\n     ++\tGET_OID_BLOB)\n     ++\n     ++enum get_oid_result {\n     ++\tFOUND = 0,\n     ++\tMISSING_OBJECT = -1, /* The requested object is missing */\n     ++\tSHORT_NAME_AMBIGUOUS = -2,\n     ++\t/* The following only apply when symlinks are followed */\n     ++\tDANGLING_SYMLINK = -4, /*\n     ++\t\t\t\t* The initial symlink is there, but\n     ++\t\t\t\t* (transitively) points to a missing\n     ++\t\t\t\t* in-tree file\n     ++\t\t\t\t*/\n     ++\tSYMLINK_LOOP = -5,\n     ++\tNOT_DIR = -6, /*\n     ++\t\t       * Somewhere along the symlink chain, a path is\n     ++\t\t       * requested which contains a file as a\n     ++\t\t       * non-final element.\n     ++\t\t       */\n     ++};\n     ++\n     ++/* A suitably aligned type for stack allocations of hash contexts. */\n     ++union git_hash_ctx {\n     ++\tgit_SHA_CTX sha1;\n     ++\tgit_SHA256_CTX sha256;\n     ++};\n     ++typedef union git_hash_ctx git_hash_ctx;\n     ++\n     ++typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);\n     ++typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);\n     ++typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);\n     ++typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);\n     ++typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);\n     ++\n     ++struct git_hash_algo {\n     ++\t/*\n     ++\t * The name of the algorithm, as appears in the config file and in\n     ++\t * messages.\n     ++\t */\n     ++\tconst char *name;\n     ++\n     ++\t/* A four-byte version identifier, used in pack indices. */\n     ++\tuint32_t format_id;\n     ++\n     ++\t/* The length of the hash in binary. */\n     ++\tsize_t rawsz;\n     ++\n     ++\t/* The length of the hash in hex characters. */\n     ++\tsize_t hexsz;\n     ++\n     ++\t/* The block size of the hash. */\n     ++\tsize_t blksz;\n     ++\n     ++\t/* The hash initialization function. */\n     ++\tgit_hash_init_fn init_fn;\n     ++\n     ++\t/* The hash context cloning function. */\n     ++\tgit_hash_clone_fn clone_fn;\n     ++\n     ++\t/* The hash update function. */\n     ++\tgit_hash_update_fn update_fn;\n     ++\n     ++\t/* The hash finalization function. */\n     ++\tgit_hash_final_fn final_fn;\n     ++\n     ++\t/* The hash finalization function for object IDs. */\n     ++\tgit_hash_final_oid_fn final_oid_fn;\n     ++\n     ++\t/* The OID of the empty tree. */\n     ++\tconst struct object_id *empty_tree;\n     ++\n     ++\t/* The OID of the empty blob. */\n     ++\tconst struct object_id *empty_blob;\n     ++\n     ++\t/* The all-zeros OID. */\n     ++\tconst struct object_id *null_oid;\n     ++};\n     ++extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];\n     ++\n     ++/*\n     ++ * Return a GIT_HASH_* constant based on the name.  Returns GIT_HASH_UNKNOWN if\n     ++ * the name doesn't match a known algorithm.\n     ++ */\n     ++int hash_algo_by_name(const char *name);\n     ++/* Identical, except based on the format ID. */\n     ++int hash_algo_by_id(uint32_t format_id);\n     ++/* Identical, except based on the length. */\n     ++int hash_algo_by_length(int len);\n     ++/* Identical, except for a pointer to struct git_hash_algo. */\n     ++static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n     ++{\n     ++\treturn p - hash_algos;\n     ++}\n     ++\n     ++const struct object_id *null_oid(void);\n     ++\n     ++static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n     ++{\n     ++\t/*\n     ++\t * Teach the compiler that there are only two possibilities of hash size\n     ++\t * here, so that it can optimize for this case as much as possible.\n     ++\t */\n     ++\tif (algop->rawsz == GIT_MAX_RAWSZ)\n     ++\t\treturn memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n     ++\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n     ++}\n     ++\n     ++static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n     ++{\n     ++\t/*\n     ++\t * We write this here instead of deferring to hashcmp so that the\n     ++\t * compiler can properly inline it and avoid calling memcmp.\n     ++\t */\n     ++\tif (algop->rawsz == GIT_MAX_RAWSZ)\n     ++\t\treturn !memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n     ++\treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n     ++}\n     ++\n     ++static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n     ++{\n     ++\tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n     ++\tdst->algo = src->algo;\n     ++}\n     ++\n     ++static inline struct object_id *oiddup(const struct object_id *src)\n     ++{\n     ++\tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n     ++\toidcpy(dst, src);\n     ++\treturn dst;\n     ++}\n     ++\n     ++static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n     ++{\n     ++\toid->algo = hash_algo_by_ptr(algop);\n     ++}\n     ++\n     ++const char *empty_tree_oid_hex(void);\n     ++const char *empty_blob_oid_hex(void);\n     ++\n     ++#endif\n     +\n       ## hash-lookup.c ##\n      @@\n       #include \"cache.h\"\n     ++#include \"hash.h\"\n       #include \"hash-lookup.h\"\n     -+#include \"repository.h\"\n       \n       static uint32_t take2(const struct object_id *oid, size_t ofs)\n     - {\n      \n       ## hash.h ##\n      @@\n       #ifndef HASH_H\n       #define HASH_H\n       \n     --#include \"repository.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"repository.h\"\n     + \n     +-#if defined(SHA1_APPLE)\n     +-#include <CommonCrypto/CommonDigest.h>\n     +-#elif defined(SHA1_OPENSSL)\n     +-#include <openssl/sha.h>\n     +-#elif defined(SHA1_DC)\n     +-#include \"sha1dc_git.h\"\n     +-#else /* SHA1_BLK */\n     +-#include \"block-sha1/sha1.h\"\n     +-#endif\n      -\n     - #if defined(SHA1_APPLE)\n     - #include <CommonCrypto/CommonDigest.h>\n     - #elif defined(SHA1_OPENSSL)\n     -@@ hash.h: static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n     - \treturn p - hash_algos;\n     - }\n     - \n     --#define the_hash_algo the_repository->hash_algo\n     +-#if defined(SHA256_NETTLE)\n     +-#include \"sha256/nettle.h\"\n     +-#elif defined(SHA256_GCRYPT)\n     +-#define SHA256_NEEDS_CLONE_HELPER\n     +-#include \"sha256/gcrypt.h\"\n     +-#elif defined(SHA256_OPENSSL)\n     +-#include <openssl/sha.h>\n     +-#else\n     +-#include \"sha256/block/sha256.h\"\n     +-#endif\n      -\n     - const struct object_id *null_oid(void);\n     - \n     - static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n     -@@ hash.h: static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *\n     - \treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n     - }\n     - \n     --static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n     --{\n     --\treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n     --}\n     +-#ifndef platform_SHA_CTX\n     +-/*\n     +- * platform's underlying implementation of SHA-1; could be OpenSSL,\n     +- * blk_SHA, Apple CommonCrypto, etc...  Note that the relevant\n     +- * SHA-1 header may have already defined platform_SHA_CTX for our\n     +- * own implementations like block-sha1, so we list\n     +- * the default for OpenSSL compatible SHA-1 implementations here.\n     +- */\n     +-#define platform_SHA_CTX\tSHA_CTX\n     +-#define platform_SHA1_Init\tSHA1_Init\n     +-#define platform_SHA1_Update\tSHA1_Update\n     +-#define platform_SHA1_Final    \tSHA1_Final\n     +-#endif\n      -\n     --static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n     --{\n     --\tconst struct git_hash_algo *algop;\n     --\tif (!oid1->algo)\n     --\t\talgop = the_hash_algo;\n     --\telse\n     --\t\talgop = &hash_algos[oid1->algo];\n     --\treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n     --}\n     +-#define git_SHA_CTX\t\tplatform_SHA_CTX\n     +-#define git_SHA1_Init\t\tplatform_SHA1_Init\n     +-#define git_SHA1_Update\t\tplatform_SHA1_Update\n     +-#define git_SHA1_Final\t\tplatform_SHA1_Final\n      -\n     - static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n     - {\n     - \t/*\n     -@@ hash.h: static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *s\n     - \treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n     - }\n     - \n     --static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n     +-#ifndef platform_SHA256_CTX\n     +-#define platform_SHA256_CTX\tSHA256_CTX\n     +-#define platform_SHA256_Init\tSHA256_Init\n     +-#define platform_SHA256_Update\tSHA256_Update\n     +-#define platform_SHA256_Final\tSHA256_Final\n     +-#endif\n     +-\n     +-#define git_SHA256_CTX\t\tplatform_SHA256_CTX\n     +-#define git_SHA256_Init\t\tplatform_SHA256_Init\n     +-#define git_SHA256_Update\tplatform_SHA256_Update\n     +-#define git_SHA256_Final\tplatform_SHA256_Final\n     +-\n     +-#ifdef platform_SHA256_Clone\n     +-#define git_SHA256_Clone\tplatform_SHA256_Clone\n     +-#endif\n     +-\n     +-#ifdef SHA1_MAX_BLOCK_SIZE\n     +-#include \"compat/sha1-chunked.h\"\n     +-#undef git_SHA1_Update\n     +-#define git_SHA1_Update\t\tgit_SHA1_Update_Chunked\n     +-#endif\n     +-\n     +-static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)\n      -{\n     --\treturn hasheq_algop(sha1, sha2, the_hash_algo);\n     +-\tmemcpy(dst, src, sizeof(*dst));\n      -}\n      -\n     --static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n     +-#ifndef SHA256_NEEDS_CLONE_HELPER\n     +-static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)\n      -{\n     --\tconst struct git_hash_algo *algop;\n     --\tif (!oid1->algo)\n     --\t\talgop = the_hash_algo;\n     --\telse\n     --\t\talgop = &hash_algos[oid1->algo];\n     --\treturn hasheq_algop(oid1->hash, oid2->hash, algop);\n     +-\tmemcpy(dst, src, sizeof(*dst));\n      -}\n     +-#endif\n     +-\n     +-/*\n     +- * Note that these constants are suitable for indexing the hash_algos array and\n     +- * comparing against each other, but are otherwise arbitrary, so they should not\n     +- * be exposed to the user or serialized to disk.  To know whether a\n     +- * git_hash_algo struct points to some usable hash function, test the format_id\n     +- * field for being non-zero.  Use the name field for user-visible situations and\n     +- * the format_id field for fixed-length fields on disk.\n     +- */\n     +-/* An unknown hash function. */\n     +-#define GIT_HASH_UNKNOWN 0\n     +-/* SHA-1 */\n     +-#define GIT_HASH_SHA1 1\n     +-/* SHA-256  */\n     +-#define GIT_HASH_SHA256 2\n     +-/* Number of algorithms supported (including unknown). */\n     +-#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)\n     +-\n     +-/* \"sha1\", big-endian */\n     +-#define GIT_SHA1_FORMAT_ID 0x73686131\n     +-\n     +-/* The length in bytes and in hex digits of an object name (SHA-1 value). */\n     +-#define GIT_SHA1_RAWSZ 20\n     +-#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)\n     +-/* The block size of SHA-1. */\n     +-#define GIT_SHA1_BLKSZ 64\n     +-\n     +-/* \"s256\", big-endian */\n     +-#define GIT_SHA256_FORMAT_ID 0x73323536\n     +-\n     +-/* The length in bytes and in hex digits of an object name (SHA-256 value). */\n     +-#define GIT_SHA256_RAWSZ 32\n     +-#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)\n     +-/* The block size of SHA-256. */\n     +-#define GIT_SHA256_BLKSZ 64\n     +-\n     +-/* The length in byte and in hex digits of the largest possible hash value. */\n     +-#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ\n     +-#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ\n     +-/* The largest possible block size for any supported hash. */\n     +-#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ\n     +-\n     +-struct object_id {\n     +-\tunsigned char hash[GIT_MAX_RAWSZ];\n     +-\tint algo;\t/* XXX requires 4-byte alignment */\n     +-};\n      -\n     --static inline int is_null_oid(const struct object_id *oid)\n     +-#define GET_OID_QUIETLY           01\n     +-#define GET_OID_COMMIT            02\n     +-#define GET_OID_COMMITTISH        04\n     +-#define GET_OID_TREE             010\n     +-#define GET_OID_TREEISH          020\n     +-#define GET_OID_BLOB             040\n     +-#define GET_OID_FOLLOW_SYMLINKS 0100\n     +-#define GET_OID_RECORD_PATH     0200\n     +-#define GET_OID_ONLY_TO_DIE    04000\n     +-#define GET_OID_REQUIRE_PATH  010000\n     +-\n     +-#define GET_OID_DISAMBIGUATORS \\\n     +-\t(GET_OID_COMMIT | GET_OID_COMMITTISH | \\\n     +-\tGET_OID_TREE | GET_OID_TREEISH | \\\n     +-\tGET_OID_BLOB)\n     +-\n     +-enum get_oid_result {\n     +-\tFOUND = 0,\n     +-\tMISSING_OBJECT = -1, /* The requested object is missing */\n     +-\tSHORT_NAME_AMBIGUOUS = -2,\n     +-\t/* The following only apply when symlinks are followed */\n     +-\tDANGLING_SYMLINK = -4, /*\n     +-\t\t\t\t* The initial symlink is there, but\n     +-\t\t\t\t* (transitively) points to a missing\n     +-\t\t\t\t* in-tree file\n     +-\t\t\t\t*/\n     +-\tSYMLINK_LOOP = -5,\n     +-\tNOT_DIR = -6, /*\n     +-\t\t       * Somewhere along the symlink chain, a path is\n     +-\t\t       * requested which contains a file as a\n     +-\t\t       * non-final element.\n     +-\t\t       */\n     +-};\n     +-\n     +-/* A suitably aligned type for stack allocations of hash contexts. */\n     +-union git_hash_ctx {\n     +-\tgit_SHA_CTX sha1;\n     +-\tgit_SHA256_CTX sha256;\n     +-};\n     +-typedef union git_hash_ctx git_hash_ctx;\n     +-\n     +-typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);\n     +-typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);\n     +-typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);\n     +-typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);\n     +-typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);\n     +-\n     +-struct git_hash_algo {\n     +-\t/*\n     +-\t * The name of the algorithm, as appears in the config file and in\n     +-\t * messages.\n     +-\t */\n     +-\tconst char *name;\n     +-\n     +-\t/* A four-byte version identifier, used in pack indices. */\n     +-\tuint32_t format_id;\n     +-\n     +-\t/* The length of the hash in binary. */\n     +-\tsize_t rawsz;\n     +-\n     +-\t/* The length of the hash in hex characters. */\n     +-\tsize_t hexsz;\n     +-\n     +-\t/* The block size of the hash. */\n     +-\tsize_t blksz;\n     +-\n     +-\t/* The hash initialization function. */\n     +-\tgit_hash_init_fn init_fn;\n     +-\n     +-\t/* The hash context cloning function. */\n     +-\tgit_hash_clone_fn clone_fn;\n     +-\n     +-\t/* The hash update function. */\n     +-\tgit_hash_update_fn update_fn;\n     +-\n     +-\t/* The hash finalization function. */\n     +-\tgit_hash_final_fn final_fn;\n     +-\n     +-\t/* The hash finalization function for object IDs. */\n     +-\tgit_hash_final_oid_fn final_oid_fn;\n     +-\n     +-\t/* The OID of the empty tree. */\n     +-\tconst struct object_id *empty_tree;\n     +-\n     +-\t/* The OID of the empty blob. */\n     +-\tconst struct object_id *empty_blob;\n     +-\n     +-\t/* The all-zeros OID. */\n     +-\tconst struct object_id *null_oid;\n     +-};\n     +-extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];\n     +-\n     +-/*\n     +- * Return a GIT_HASH_* constant based on the name.  Returns GIT_HASH_UNKNOWN if\n     +- * the name doesn't match a known algorithm.\n     +- */\n     +-int hash_algo_by_name(const char *name);\n     +-/* Identical, except based on the format ID. */\n     +-int hash_algo_by_id(uint32_t format_id);\n     +-/* Identical, except based on the length. */\n     +-int hash_algo_by_length(int len);\n     +-/* Identical, except for a pointer to struct git_hash_algo. */\n     +-static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n      -{\n     --\treturn oideq(oid, null_oid());\n     +-\treturn p - hash_algos;\n      -}\n      -\n     --static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n     + #define the_hash_algo the_repository->hash_algo\n     + \n     +-const struct object_id *null_oid(void);\n     +-\n     +-static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n      -{\n     --\tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n     +-\t/*\n     +-\t * Teach the compiler that there are only two possibilities of hash size\n     +-\t * here, so that it can optimize for this case as much as possible.\n     +-\t */\n     +-\tif (algop->rawsz == GIT_MAX_RAWSZ)\n     +-\t\treturn memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n     +-\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n      -}\n      -\n     - static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n     + static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n       {\n     - \tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n     - \tdst->algo = src->algo;\n     + \treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n     +@@ hash.h: static inline int oidcmp(const struct object_id *oid1, const struct object_id *o\n     + \treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n       }\n       \n     --/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n     --static inline void oidcpy_with_padding(struct object_id *dst,\n     --\t\t\t\t       const struct object_id *src)\n     +-static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n      -{\n     --\tsize_t hashsz;\n     --\n     --\tif (!src->algo)\n     --\t\thashsz = the_hash_algo->rawsz;\n     --\telse\n     --\t\thashsz = hash_algos[src->algo].rawsz;\n     --\n     --\tmemcpy(dst->hash, src->hash, hashsz);\n     --\tmemset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz);\n     --\tdst->algo = src->algo;\n     +-\t/*\n     +-\t * We write this here instead of deferring to hashcmp so that the\n     +-\t * compiler can properly inline it and avoid calling memcmp.\n     +-\t */\n     +-\tif (algop->rawsz == GIT_MAX_RAWSZ)\n     +-\t\treturn !memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n     +-\treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n      -}\n      -\n     - static inline struct object_id *oiddup(const struct object_id *src)\n     + static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n       {\n     - \tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n     -@@ hash.h: static inline struct object_id *oiddup(const struct object_id *src)\n     - \treturn dst;\n     + \treturn hasheq_algop(sha1, sha2, the_hash_algo);\n     +@@ hash.h: static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n     + \tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n       }\n       \n     --static inline void hashclr(unsigned char *hash)\n     --{\n     --\tmemset(hash, 0, the_hash_algo->rawsz);\n     --}\n     --\n     --static inline void oidclr(struct object_id *oid)\n     --{\n     --\tmemset(oid->hash, 0, GIT_MAX_RAWSZ);\n     --\toid->algo = hash_algo_by_ptr(the_hash_algo);\n     --}\n     --\n     --static inline void oidread(struct object_id *oid, const unsigned char *hash)\n     --{\n     --\tmemcpy(oid->hash, hash, the_hash_algo->rawsz);\n     --\toid->algo = hash_algo_by_ptr(the_hash_algo);\n     --}\n     --\n     --static inline int is_empty_blob_sha1(const unsigned char *sha1)\n     +-static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n      -{\n     --\treturn hasheq(sha1, the_hash_algo->empty_blob->hash);\n     +-\tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n     +-\tdst->algo = src->algo;\n      -}\n      -\n     --static inline int is_empty_blob_oid(const struct object_id *oid)\n     + /* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n     + static inline void oidcpy_with_padding(struct object_id *dst,\n     + \t\t\t\t       const struct object_id *src)\n     +@@ hash.h: static inline void oidcpy_with_padding(struct object_id *dst,\n     + \tdst->algo = src->algo;\n     + }\n     + \n     +-static inline struct object_id *oiddup(const struct object_id *src)\n      -{\n     --\treturn oideq(oid, the_hash_algo->empty_blob);\n     +-\tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n     +-\toidcpy(dst, src);\n     +-\treturn dst;\n      -}\n      -\n     --static inline int is_empty_tree_sha1(const unsigned char *sha1)\n     + static inline void hashclr(unsigned char *hash)\n     + {\n     + \tmemset(hash, 0, the_hash_algo->rawsz);\n     +@@ hash.h: static inline int is_empty_tree_oid(const struct object_id *oid)\n     + \treturn oideq(oid, the_hash_algo->empty_tree);\n     + }\n     + \n     +-static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n      -{\n     --\treturn hasheq(sha1, the_hash_algo->empty_tree->hash);\n     +-\toid->algo = hash_algo_by_ptr(algop);\n      -}\n      -\n     --static inline int is_empty_tree_oid(const struct object_id *oid)\n     --{\n     --\treturn oideq(oid, the_hash_algo->empty_tree);\n     --}\n     +-const char *empty_tree_oid_hex(void);\n     +-const char *empty_blob_oid_hex(void);\n      -\n     - static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n     - {\n     - \toid->algo = hash_algo_by_ptr(algop);\n     + #endif\n     +\n     + ## hashmap.h ##\n     +@@\n     + #ifndef HASHMAP_H\n     + #define HASHMAP_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + /*\n     +  * Generic implementation of hash-based key-value mappings.\n      \n       ## hex.c ##\n      @@\n       #include \"git-compat-util.h\"\n     ++#include \"hash.h\"\n       #include \"hex.h\"\n     -+#include \"repository.h\"\n       \n       const signed char hexval_table[256] = {\n     - \t -1, -1, -1, -1, -1, -1, -1, -1,\t\t/* 00-07 */\n     +\n     + ## hex.h ##\n     +@@\n     + #ifndef HEX_H\n     + #define HEX_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + extern const signed char hexval_table[256];\n     + static inline unsigned int hexval(unsigned char c)\n      \n       ## hook.c ##\n      @@\n     @@ khash.h\n       #define __AC_KHASH_H\n       \n       #include \"hashmap.h\"\n     -+#include \"repository.h\"\n     ++#include \"hash.h\"\n       \n       #define AC_VERSION_KHASH_H \"0.2.8\"\n       \n      \n     + ## ls-refs.c ##\n     +@@\n     + #include \"git-compat-util.h\"\n     + #include \"environment.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"hex.h\"\n     + #include \"repository.h\"\n     + #include \"refs.h\"\n     +\n       ## merge-ort-wrappers.c ##\n      @@\n     + #include \"cache.h\"\n       #include \"gettext.h\"\n     ++#include \"hash.h\"\n       #include \"merge-ort.h\"\n       #include \"merge-ort-wrappers.h\"\n     -+#include \"repository.h\"\n       \n     - #include \"commit.h\"\n     +\n     + ## merge-ort.h ##\n     +@@\n     + #define MERGE_ORT_H\n     + \n     + #include \"merge-recursive.h\"\n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n       \n     + struct commit;\n     + struct tree;\n      \n       ## negotiator/default.c ##\n      @@\n     @@ object-file.h\n      \n       ## object.h ##\n      @@\n     - #include \"hash.h\"\n     + #ifndef OBJECT_H\n     + #define OBJECT_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n       \n       struct buffer_slab;\n      +struct repository;\n     @@ object.h\n       struct parsed_object_pool {\n       \tstruct object **obj_hash;\n      \n     - ## oid-array.h ##\n     -@@\n     - #define OID_ARRAY_H\n     - \n     - #include \"hash.h\"\n     -+#include \"repository.h\"\n     - \n     - /**\n     -  * The API provides storage and manipulation of sets of object identifiers.\n     -\n       ## oidmap.c ##\n      @@\n       #include \"git-compat-util.h\"\n     ++#include \"hash.h\"\n       #include \"oidmap.h\"\n     -+#include \"repository.h\"\n       \n       static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,\n     - \t\t      const struct hashmap_entry *e1,\n      \n     - ## oidtree.c ##\n     + ## oidtree.h ##\n      @@\n     - #include \"oidtree.h\"\n     - #include \"alloc.h\"\n     - #include \"hash.h\"\n     -+#include \"repository.h\"\n     + #define OIDTREE_H\n     + \n     + #include \"cbtree.h\"\n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"mem-pool.h\"\n       \n     - struct oidtree_iter_data {\n     - \toidtree_iter fn;\n     + struct oidtree {\n      \n       ## parallel-checkout.c ##\n      @@\n     + #include \"config.h\"\n     + #include \"entry.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"hex.h\"\n       #include \"parallel-checkout.h\"\n       #include \"pkt-line.h\"\n     - #include \"progress.h\"\n     -+#include \"repository.h\"\n     - #include \"run-command.h\"\n     - #include \"sigchain.h\"\n     - #include \"streaming.h\"\n      \n       ## pathspec.c ##\n      @@\n     @@ progress.c\n       #include \"trace.h\"\n       #include \"trace2.h\"\n      \n     + ## protocol-caps.c ##\n     +@@\n     + #include \"hex.h\"\n     + #include \"pkt-line.h\"\n     + #include \"strvec.h\"\n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"hex.h\"\n     + #include \"object.h\"\n     + #include \"object-store.h\"\n     +\n       ## rebase-interactive.c ##\n      @@\n       #include \"gettext.h\"\n     @@ rebase-interactive.c\n      \n       ## refs/files-backend.c ##\n      @@\n     - #include \"../lockfile.h\"\n     - #include \"../object.h\"\n     - #include \"../object-file.h\"\n     -+#include \"../repository.h\"\n     - #include \"../dir.h\"\n     - #include \"../chdir-notify.h\"\n     - #include \"../setup.h\"\n     + #include \"../copy.h\"\n     + #include \"../environment.h\"\n     + #include \"../gettext.h\"\n     ++#include \"../hash.h\"\n     + #include \"../hex.h\"\n     + #include \"../refs.h\"\n     + #include \"refs-internal.h\"\n      \n       ## refs/packed-backend.c ##\n      @@\n     - #include \"../iterator.h\"\n     - #include \"../lockfile.h\"\n     - #include \"../chdir-notify.h\"\n     -+#include \"../repository.h\"\n     - #include \"../wrapper.h\"\n     - #include \"../write-or-die.h\"\n     - \n     + #include \"../alloc.h\"\n     + #include \"../config.h\"\n     + #include \"../gettext.h\"\n     ++#include \"../hash.h\"\n     + #include \"../hex.h\"\n     + #include \"../refs.h\"\n     + #include \"refs-internal.h\"\n      \n       ## refs/ref-cache.c ##\n      @@\n     + #include \"../git-compat-util.h\"\n     + #include \"../alloc.h\"\n     ++#include \"../hash.h\"\n     + #include \"../refs.h\"\n     ++#include \"../repository.h\"\n       #include \"refs-internal.h\"\n       #include \"ref-cache.h\"\n       #include \"../iterator.h\"\n     -+#include \"../repository.h\"\n     - \n     - void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry)\n     - {\n      \n       ## refs/ref-cache.h ##\n      @@\n     + #ifndef REFS_REF_CACHE_H\n     + #define REFS_REF_CACHE_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n       \n       struct ref_dir;\n       struct ref_store;\n     @@ refs/ref-cache.h\n      \n       ## refspec.c ##\n      @@\n     + #include \"git-compat-util.h\"\n     + #include \"alloc.h\"\n     + #include \"gettext.h\"\n     ++#include \"hash.h\"\n     + #include \"hex.h\"\n       #include \"strvec.h\"\n       #include \"refs.h\"\n     - #include \"refspec.h\"\n     -+#include \"repository.h\"\n     +\n     + ## reftable/dump.c ##\n     +@@ reftable/dump.c: https://developers.google.com/open-source/licenses/bsd\n     + */\n       \n     - static struct refspec_item s_tag_refspec = {\n     - \t.force = 0,\n     + #include \"git-compat-util.h\"\n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + #include \"reftable-blocksource.h\"\n     + #include \"reftable-error.h\"\n      \n     - ## repository.h ##\n     -@@\n     - #ifndef REPOSITORY_H\n     - #define REPOSITORY_H\n     + ## reftable/system.h ##\n     +@@ reftable/system.h: https://developers.google.com/open-source/licenses/bsd\n       \n     -+#include \"hash.h\"\n     - #include \"path.h\"\n     + #include \"git-compat-util.h\"\n     + #include \"strbuf.h\"\n     +-#include \"hash.h\" /* hash ID, sizes.*/\n     ++#include \"hash-ll.h\" /* hash ID, sizes.*/\n     + #include \"dir.h\" /* remove_dir_recursively, for tests.*/\n       \n     - struct config_set;\n     -@@ repository.h: void prepare_repo_settings(struct repository *r);\n     -  */\n     - int upgrade_repository_format(int target_version);\n     + int hash_size(uint32_t id);\n     +\n     + ## reset.h ##\n     +@@\n     + #ifndef RESET_H\n     + #define RESET_H\n       \n     -+#define the_hash_algo the_repository->hash_algo\n     -+\n     -+static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n     -+{\n     -+\treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n     -+}\n     -+\n     -+static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)\n     -+{\n     -+\tconst struct git_hash_algo *algop;\n     -+\tif (!oid1->algo)\n     -+\t\talgop = the_hash_algo;\n     -+\telse\n     -+\t\talgop = &hash_algos[oid1->algo];\n     -+\treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n     -+}\n     -+\n     -+static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n     -+{\n     -+\treturn hasheq_algop(sha1, sha2, the_hash_algo);\n     -+}\n     -+\n     -+static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)\n     -+{\n     -+\tconst struct git_hash_algo *algop;\n     -+\tif (!oid1->algo)\n     -+\t\talgop = the_hash_algo;\n     -+\telse\n     -+\t\talgop = &hash_algos[oid1->algo];\n     -+\treturn hasheq_algop(oid1->hash, oid2->hash, algop);\n     -+}\n     -+\n     -+static inline int is_null_oid(const struct object_id *oid)\n     -+{\n     -+\treturn oideq(oid, null_oid());\n     -+}\n     -+\n     -+static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n     -+{\n     -+\tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n     -+}\n     -+\n     -+/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n     -+static inline void oidcpy_with_padding(struct object_id *dst,\n     -+\t\t\t\t       const struct object_id *src)\n     -+{\n     -+\tsize_t hashsz;\n     -+\n     -+\tif (!src->algo)\n     -+\t\thashsz = the_hash_algo->rawsz;\n     -+\telse\n     -+\t\thashsz = hash_algos[src->algo].rawsz;\n     -+\n     -+\tmemcpy(dst->hash, src->hash, hashsz);\n     -+\tmemset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz);\n     -+\tdst->algo = src->algo;\n     -+}\n     -+\n     -+static inline void hashclr(unsigned char *hash)\n     -+{\n     -+\tmemset(hash, 0, the_hash_algo->rawsz);\n     -+}\n     -+\n     -+static inline void oidclr(struct object_id *oid)\n     -+{\n     -+\tmemset(oid->hash, 0, GIT_MAX_RAWSZ);\n     -+\toid->algo = hash_algo_by_ptr(the_hash_algo);\n     -+}\n     -+\n     -+static inline void oidread(struct object_id *oid, const unsigned char *hash)\n     -+{\n     -+\tmemcpy(oid->hash, hash, the_hash_algo->rawsz);\n     -+\toid->algo = hash_algo_by_ptr(the_hash_algo);\n     -+}\n     -+\n     -+static inline int is_empty_blob_sha1(const unsigned char *sha1)\n     -+{\n     -+\treturn hasheq(sha1, the_hash_algo->empty_blob->hash);\n     -+}\n     -+\n     -+static inline int is_empty_blob_oid(const struct object_id *oid)\n     -+{\n     -+\treturn oideq(oid, the_hash_algo->empty_blob);\n     -+}\n     -+\n     -+static inline int is_empty_tree_sha1(const unsigned char *sha1)\n     -+{\n     -+\treturn hasheq(sha1, the_hash_algo->empty_tree->hash);\n     -+}\n     -+\n     -+static inline int is_empty_tree_oid(const struct object_id *oid)\n     -+{\n     -+\treturn oideq(oid, the_hash_algo->empty_tree);\n     -+}\n     -+\n     - #endif /* REPOSITORY_H */\n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"repository.h\"\n     + \n     + #define GIT_REFLOG_ACTION_ENVIRONMENT \"GIT_REFLOG_ACTION\"\n      \n       ## resolve-undo.c ##\n      @@\n       #include \"cache.h\"\n       #include \"dir.h\"\n     ++#include \"hash.h\"\n       #include \"resolve-undo.h\"\n     -+#include \"repository.h\"\n       #include \"string-list.h\"\n       \n     - /* The only error case is to run out of memory in string-list */\n     +\n     + ## resolve-undo.h ##\n     +@@ resolve-undo.h: struct index_state;\n     + struct pathspec;\n     + struct string_list;\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + struct resolve_undo_info {\n     + \tunsigned int mode[3];\n      \n       ## split-index.c ##\n      @@\n     + #include \"cache.h\"\n       #include \"alloc.h\"\n       #include \"gettext.h\"\n     ++#include \"hash.h\"\n       #include \"mem-pool.h\"\n     -+#include \"repository.h\"\n       #include \"split-index.h\"\n       #include \"strbuf.h\"\n     - #include \"ewah/ewok.h\"\n     +\n     + ## split-index.h ##\n     +@@\n     + #ifndef SPLIT_INDEX_H\n     + #define SPLIT_INDEX_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + \n     + struct index_state;\n     + struct strbuf;\n      \n       ## strbuf.c ##\n      @@\n     @@ t/helper/test-cache-tree.c\n      \n       ## t/helper/test-dump-cache-tree.c ##\n      @@\n     + #define USE_THE_INDEX_VARIABLE\n     + #include \"test-tool.h\"\n     + #include \"cache.h\"\n     ++#include \"hash.h\"\n       #include \"hex.h\"\n       #include \"tree.h\"\n       #include \"cache-tree.h\"\n     @@ t/helper/test-submodule-config.c\n      @@\n       #include \"test-tool.h\"\n       #include \"config.h\"\n     ++#include \"hash.h\"\n       #include \"object-name.h\"\n      +#include \"repository.h\"\n       #include \"setup.h\"\n     @@ trace2/tr2_tgt_perf.c\n      \n       ## tree-walk.h ##\n      @@\n     - #include \"hash.h\"\n     + #ifndef TREE_WALK_H\n     + #define TREE_WALK_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n       \n       struct index_state;\n      +struct repository;\n     @@ wrapper.c\n       #include \"strbuf.h\"\n       #include \"trace2.h\"\n       #include \"wrapper.h\"\n     +\n     + ## xdiff-interface.h ##\n     +@@\n     + #ifndef XDIFF_INTERFACE_H\n     + #define XDIFF_INTERFACE_H\n     + \n     +-#include \"hash.h\"\n     ++#include \"hash-ll.h\"\n     + #include \"xdiff/xdiff.h\"\n     + \n     + /*\n 15:  e1983d51c05 = 14:  5ef0e17d0aa cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c\n 16:  c72cc0dab90 = 15:  cc286133513 cache,tree: move basic name compare functions from read-cache to tree\n 17:  1edd8fd72a7 = 16:  960b5438ce4 treewide: remove cache.h inclusion due to previous changes\n 18:  34c9034e8ed = 17:  b459b60de89 cache.h: remove unnecessary headers\n 19:  8e747e889fb = 18:  80ebd46c862 fsmonitor: reduce includes of cache.h\n 20:  c6d58573661 ! 19:  7479e72ffd6 commit.h: reduce unnecessary includes\n     @@ log-tree.c\n      \n       ## merge-ort-wrappers.c ##\n      @@\n     + #include \"hash.h\"\n       #include \"merge-ort.h\"\n       #include \"merge-ort-wrappers.h\"\n     - #include \"repository.h\"\n      +#include \"tree.h\"\n       \n       #include \"commit.h\"\n     @@ refs/debug.c\n      \n       ## refspec.c ##\n      @@\n     + #include \"strvec.h\"\n       #include \"refs.h\"\n       #include \"refspec.h\"\n     - #include \"repository.h\"\n      +#include \"strbuf.h\"\n       \n       static struct refspec_item s_tag_refspec = {\n 21:  1aa36d91b59 = 20:  7705cbc2733 object-store.h: reduce unnecessary includes\n 22:  d70e3b99dae = 21:  b7a96a08d14 diff.h: reduce unnecessary includes\n 23:  f32d4fa3dbf = 22:  67d52c6e751 reftable: ensure git-compat-util.h is the first (indirect) include\n\n-- \ngitgitgadget\n"},{"id":"475859","messageId":"0a321c41c3f16ef32a7377263eb1c69a9ae0a819.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 08/22] match-trees.h: move declarations for match-trees.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:15Z","receivedAt":"2023-04-22T20:17:59Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                     |  4 ----\n match-trees.c               |  1 +\n match-trees.h               | 10 ++++++++++\n merge-ort.c                 |  1 +\n merge-recursive.c           |  1 +\n t/helper/test-match-trees.c |  1 +\n 6 files changed, 14 insertions(+), 4 deletions(-)\n create mode 100644 match-trees.h\n\ndiff --git a/cache.h b/cache.h\nindex fde782a96f0..0570f9ad07d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -603,10 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int\n /* diff.c */\n extern int diff_auto_refresh_index;\n \n-/* match-trees.c */\n-void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);\n-void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);\n-\n /*\n  * whitespace rules.\n  * used by both diff and apply\ndiff --git a/match-trees.c b/match-trees.c\nindex 5877fc64a8f..9b78d99507b 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"match-trees.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"object-store.h\"\ndiff --git a/match-trees.h b/match-trees.h\nnew file mode 100644\nindex 00000000000..e3877acd583\n--- /dev/null\n+++ b/match-trees.h\n@@ -0,0 +1,10 @@\n+#ifndef MATCH_TREES_H\n+#define MATCH_TREES_H\n+\n+struct object_id;\n+struct repository;\n+\n+void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);\n+void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);\n+\n+#endif /* MATCH_TREES_H */\ndiff --git a/merge-ort.c b/merge-ort.c\nindex 2c6a9ed9a41..65837db77f0 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -31,6 +31,7 @@\n #include \"hex.h\"\n #include \"entry.h\"\n #include \"ll-merge.h\"\n+#include \"match-trees.h\"\n #include \"mem-pool.h\"\n #include \"object-name.h\"\n #include \"object-store.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex d4d2ab05b2e..8e87b6386d9 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -22,6 +22,7 @@\n #include \"hex.h\"\n #include \"ll-merge.h\"\n #include \"lockfile.h\"\n+#include \"match-trees.h\"\n #include \"object-file.h\"\n #include \"object-name.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 3808e1ac38b..a498fece7a3 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"match-trees.h\"\n #include \"object-name.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n-- \ngitgitgadget\n\n"},{"id":"475861","messageId":"c58314808551082a140499dbddb975ee3d2833c0.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 06/22] base85.h: move declarations for base85.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:13Z","receivedAt":"2023-04-22T20:18:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c  | 1 +\n base85.c | 3 ++-\n base85.h | 7 +++++++\n cache.h  | 4 ----\n diff.c   | 1 +\n 5 files changed, 11 insertions(+), 5 deletions(-)\n create mode 100644 base85.h\n\ndiff --git a/apply.c b/apply.c\nindex efe2dcb0e62..a65a354eef5 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"base85.h\"\n #include \"config.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/base85.c b/base85.c\nindex 5ca601ee14f..bbacdca31b3 100644\n--- a/base85.c\n+++ b/base85.c\n@@ -1,4 +1,5 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"base85.h\"\n \n #undef DEBUG_85\n \ndiff --git a/base85.h b/base85.h\nnew file mode 100644\nindex 00000000000..c835086e093\n--- /dev/null\n+++ b/base85.h\n@@ -0,0 +1,7 @@\n+#ifndef BASE85_H\n+#define BASE85_H\n+\n+int decode_85(char *dst, const char *line, int linelen);\n+void encode_85(char *buf, const unsigned char *data, int bytes);\n+\n+#endif /* BASE85_H */\ndiff --git a/cache.h b/cache.h\nindex 2b661764794..b89f4c59802 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -593,10 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n-/* base85 */\n-int decode_85(char *dst, const char *line, int linelen);\n-void encode_85(char *buf, const unsigned char *data, int bytes);\n-\n /* pkt-line.c */\n void packet_trace_identity(const char *prog);\n \ndiff --git a/diff.c b/diff.c\nindex fa86d023196..e697f78a645 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"base85.h\"\n #include \"config.h\"\n #include \"convert.h\"\n #include \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"475862","messageId":"951eff98a4d3f7cc4190dcd080b0648f62b84cf1.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 09/22] ws.h: move declarations for ws.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:16Z","receivedAt":"2023-04-22T20:18:02Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n apply.c       |  1 +\n cache.h       | 26 --------------------------\n config.c      |  1 +\n diff.c        |  1 +\n environment.c |  1 -\n ws.c          |  5 ++++-\n ws.h          | 33 +++++++++++++++++++++++++++++++++\n 7 files changed, 40 insertions(+), 28 deletions(-)\n create mode 100644 ws.h\n\ndiff --git a/apply.c b/apply.c\nindex a65a354eef5..2de8bb203d7 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -32,6 +32,7 @@\n #include \"entry.h\"\n #include \"setup.h\"\n #include \"symlinks.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/cache.h b/cache.h\nindex 0570f9ad07d..dde275c9301 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -603,32 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int\n /* diff.c */\n extern int diff_auto_refresh_index;\n \n-/*\n- * whitespace rules.\n- * used by both diff and apply\n- * last two digits are tab width\n- */\n-#define WS_BLANK_AT_EOL         0100\n-#define WS_SPACE_BEFORE_TAB     0200\n-#define WS_INDENT_WITH_NON_TAB  0400\n-#define WS_CR_AT_EOL           01000\n-#define WS_BLANK_AT_EOF        02000\n-#define WS_TAB_IN_INDENT       04000\n-#define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n-#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)\n-#define WS_TAB_WIDTH_MASK        077\n-/* All WS_* -- when extended, adapt diff.c emit_symbol */\n-#define WS_RULE_MASK           07777\n-extern unsigned whitespace_rule_cfg;\n-unsigned whitespace_rule(struct index_state *, const char *);\n-unsigned parse_whitespace_rule(const char *);\n-unsigned ws_check(const char *line, int len, unsigned ws_rule);\n-void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);\n-char *whitespace_error_string(unsigned ws);\n-void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);\n-int ws_blank_line(const char *line, int len);\n-#define ws_tab_width(rule)     ((rule) & WS_TAB_WIDTH_MASK)\n-\n /* ls-files */\n void overlay_tree_on_index(struct index_state *istate,\n \t\t\t   const char *tree_name, const char *prefix);\ndiff --git a/config.c b/config.c\nindex 9beba19b41c..97063a0743e 100644\n--- a/config.c\n+++ b/config.c\n@@ -35,6 +35,7 @@\n #include \"setup.h\"\n #include \"trace2.h\"\n #include \"worktree.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/diff.c b/diff.c\nindex e697f78a645..73d2ac03673 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -41,6 +41,7 @@\n #include \"object-name.h\"\n #include \"setup.h\"\n #include \"strmap.h\"\n+#include \"ws.h\"\n #include \"wrapper.h\"\n \n #ifdef NO_FAST_WORKING_DIRECTORY\ndiff --git a/environment.c b/environment.c\nindex 8a96997539a..541f0b19acf 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -67,7 +67,6 @@ int read_replace_refs = 1;\n enum eol core_eol = EOL_UNSET;\n int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n char *check_roundtrip_encoding = \"SHIFT-JIS\";\n-unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;\n enum rebase_setup_type autorebase = AUTOREBASE_NEVER;\n enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;\ndiff --git a/ws.c b/ws.c\nindex 036ccb8ee9d..d356d4ec9ee 100644\n--- a/ws.c\n+++ b/ws.c\n@@ -3,9 +3,12 @@\n  *\n  * Copyright (c) 2007 Junio C Hamano\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"attr.h\"\n #include \"strbuf.h\"\n+#include \"ws.h\"\n+\n+unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n \n static struct whitespace_rule {\n \tconst char *rule_name;\ndiff --git a/ws.h b/ws.h\nnew file mode 100644\nindex 00000000000..5ba676c5595\n--- /dev/null\n+++ b/ws.h\n@@ -0,0 +1,33 @@\n+#ifndef WS_H\n+#define WS_H\n+\n+struct index_state;\n+struct strbuf;\n+\n+/*\n+ * whitespace rules.\n+ * used by both diff and apply\n+ * last two digits are tab width\n+ */\n+#define WS_BLANK_AT_EOL         0100\n+#define WS_SPACE_BEFORE_TAB     0200\n+#define WS_INDENT_WITH_NON_TAB  0400\n+#define WS_CR_AT_EOL           01000\n+#define WS_BLANK_AT_EOF        02000\n+#define WS_TAB_IN_INDENT       04000\n+#define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)\n+#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)\n+#define WS_TAB_WIDTH_MASK        077\n+/* All WS_* -- when extended, adapt diff.c emit_symbol */\n+#define WS_RULE_MASK           07777\n+extern unsigned whitespace_rule_cfg;\n+unsigned whitespace_rule(struct index_state *, const char *);\n+unsigned parse_whitespace_rule(const char *);\n+unsigned ws_check(const char *line, int len, unsigned ws_rule);\n+void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);\n+char *whitespace_error_string(unsigned ws);\n+void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);\n+int ws_blank_line(const char *line, int len);\n+#define ws_tab_width(rule)     ((rule) & WS_TAB_WIDTH_MASK)\n+\n+#endif /* WS_H */\n-- \ngitgitgadget\n\n"},{"id":"475863","messageId":"ff99d0eb207008642c0142996d34f849cbf6af8d.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 10/22] versioncmp.h: move declarations for versioncmp.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:17Z","receivedAt":"2023-04-22T20:18:04Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      | 2 --\n ref-filter.c | 1 +\n versioncmp.c | 3 ++-\n versioncmp.h | 6 ++++++\n 4 files changed, 9 insertions(+), 3 deletions(-)\n create mode 100644 versioncmp.h\n\ndiff --git a/cache.h b/cache.h\nindex dde275c9301..6955745cccd 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -648,6 +648,4 @@ int stat_validity_check(struct stat_validity *sv, const char *path);\n  */\n void stat_validity_update(struct stat_validity *sv, int fd);\n \n-int versioncmp(const char *s1, const char *s2);\n-\n #endif /* CACHE_H */\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 57a5884aec7..5387f79be6d 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -19,6 +19,7 @@\n #include \"revision.h\"\n #include \"utf8.h\"\n #include \"version.h\"\n+#include \"versioncmp.h\"\n #include \"trailer.h\"\n #include \"wt-status.h\"\n #include \"commit-slab.h\"\ndiff --git a/versioncmp.c b/versioncmp.c\nindex 069ee94a4d7..9b21ec142dd 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"string-list.h\"\n+#include \"versioncmp.h\"\n \n /*\n  * versioncmp(): copied from string/strverscmp.c in glibc commit\ndiff --git a/versioncmp.h b/versioncmp.h\nnew file mode 100644\nindex 00000000000..879b510e82a\n--- /dev/null\n+++ b/versioncmp.h\n@@ -0,0 +1,6 @@\n+#ifndef VERSIONCMP_H\n+#define VERSIONCMP_H\n+\n+int versioncmp(const char *s1, const char *s2);\n+\n+#endif /* VERSIONCMP_H */\n-- \ngitgitgadget\n\n"},{"id":"475864","messageId":"673a3ae4fe2cc9a341e33dde6bd756e517f6f658.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 11/22] dir.h: move DTYPE defines from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:18Z","receivedAt":"2023-04-22T20:18:08Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h | 14 --------------\n dir.h   | 15 +++++++++++++++\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 6955745cccd..ad741e70bc2 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -10,20 +10,6 @@\n #include \"object.h\"\n #include \"statinfo.h\"\n \n-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n-#define DTYPE(de)\t((de)->d_type)\n-#else\n-#undef DT_UNKNOWN\n-#undef DT_DIR\n-#undef DT_REG\n-#undef DT_LNK\n-#define DT_UNKNOWN\t0\n-#define DT_DIR\t\t1\n-#define DT_REG\t\t2\n-#define DT_LNK\t\t3\n-#define DTYPE(de)\tDT_UNKNOWN\n-#endif\n-\n /*\n  * Some mode bits are also used internally for computations.\n  *\ndiff --git a/dir.h b/dir.h\nindex 3d6c87387e9..79b85a01ee4 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -640,4 +640,19 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n \n \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n }\n+\n+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#undef DT_UNKNOWN\n+#undef DT_DIR\n+#undef DT_REG\n+#undef DT_LNK\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DT_LNK\t\t3\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n #endif\n-- \ngitgitgadget\n\n"},{"id":"475865","messageId":"5ef0e17d0aa068bc4b1d78456932d3611098c5f6.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 14/22] cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:21Z","receivedAt":"2023-04-22T20:18:09Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSince cmp_cache_name_compare() was comparing cache_entry structs, it\nwas associated with the cache rather than with trees.  Move the\nfunction.  As a side effect, we can make cache_name_stage_compare()\nstatic as well.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      |  2 +-\n read-cache.c | 13 ++++++++++++-\n tree.c       | 10 ----------\n tree.h       |  1 -\n 4 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 7a46f300d9b..502e4c0b11a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -562,7 +562,7 @@ int base_name_compare(const char *name1, size_t len1, int mode1,\n int df_name_compare(const char *name1, size_t len1, int mode1,\n \t\t    const char *name2, size_t len2, int mode2);\n int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n+int cmp_cache_name_compare(const void *a_, const void *b_);\n \n /* add */\n /*\ndiff --git a/read-cache.c b/read-cache.c\nindex 206c003e558..8f00da4bf7a 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -567,7 +567,8 @@ int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n \treturn 0;\n }\n \n-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)\n+static int cache_name_stage_compare(const char *name1, int len1, int stage1,\n+\t\t\t\t    const char *name2, int len2, int stage2)\n {\n \tint cmp;\n \n@@ -582,6 +583,16 @@ int cache_name_stage_compare(const char *name1, int len1, int stage1, const char\n \treturn 0;\n }\n \n+int cmp_cache_name_compare(const void *a_, const void *b_)\n+{\n+\tconst struct cache_entry *ce1, *ce2;\n+\n+\tce1 = *((const struct cache_entry **)a_);\n+\tce2 = *((const struct cache_entry **)b_);\n+\treturn cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),\n+\t\t\t\t  ce2->name, ce2->ce_namelen, ce_stage(ce2));\n+}\n+\n static int index_name_stage_pos(struct index_state *istate,\n \t\t\t\tconst char *name, int namelen,\n \t\t\t\tint stage,\ndiff --git a/tree.c b/tree.c\nindex e9d51ce2e00..896b7f4776b 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -94,16 +94,6 @@ int read_tree(struct repository *r,\n \treturn ret;\n }\n \n-int cmp_cache_name_compare(const void *a_, const void *b_)\n-{\n-\tconst struct cache_entry *ce1, *ce2;\n-\n-\tce1 = *((const struct cache_entry **)a_);\n-\tce2 = *((const struct cache_entry **)b_);\n-\treturn cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),\n-\t\t\t\t  ce2->name, ce2->ce_namelen, ce_stage(ce2));\n-}\n-\n struct tree *lookup_tree(struct repository *r, const struct object_id *oid)\n {\n \tstruct object *obj = lookup_object(r, oid);\ndiff --git a/tree.h b/tree.h\nindex 0499ad01aa7..8e3c6d441cc 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -29,7 +29,6 @@ void free_tree_buffer(struct tree *tree);\n /* Parses and returns the tree in the given ent, chasing tags and commits. */\n struct tree *parse_tree_indirect(const struct object_id *oid);\n \n-int cmp_cache_name_compare(const void *a_, const void *b_);\n \n #define READ_TREE_RECURSIVE 1\n typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);\n-- \ngitgitgadget\n\n"},{"id":"475866","messageId":"cc28613351394344893a4dbedce081cc6bd26e31.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 15/22] cache,tree: move basic name compare functions from read-cache to tree","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:22Z","receivedAt":"2023-04-22T20:18:11Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nNone of base_name_compare(), df_name_compare(), or name_compare()\ndepended upon a cache_entry or index_state in any way.  By moving these\nfunctions to tree.h, half a dozen other files can stop depending upon\ncache.h (though that change will be made in a later commit).\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h      |  5 ----\n read-cache.c | 68 ----------------------------------------------------\n tree.c       | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n tree.h       |  9 +++++++\n 4 files changed, 77 insertions(+), 73 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 502e4c0b11a..591c67b0595 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -557,11 +557,6 @@ extern int verify_ce_order;\n #define DATA_CHANGED    0x0020\n #define TYPE_CHANGED    0x0040\n \n-int base_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t      const char *name2, size_t len2, int mode2);\n-int df_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t    const char *name2, size_t len2, int mode2);\n-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n int cmp_cache_name_compare(const void *a_, const void *b_);\n \n /* add */\ndiff --git a/read-cache.c b/read-cache.c\nindex 8f00da4bf7a..b3e2917ddc9 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -499,74 +499,6 @@ int ie_modified(struct index_state *istate,\n \treturn 0;\n }\n \n-int base_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t      const char *name2, size_t len2, int mode2)\n-{\n-\tunsigned char c1, c2;\n-\tsize_t len = len1 < len2 ? len1 : len2;\n-\tint cmp;\n-\n-\tcmp = memcmp(name1, name2, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\tc1 = name1[len];\n-\tc2 = name2[len];\n-\tif (!c1 && S_ISDIR(mode1))\n-\t\tc1 = '/';\n-\tif (!c2 && S_ISDIR(mode2))\n-\t\tc2 = '/';\n-\treturn (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;\n-}\n-\n-/*\n- * df_name_compare() is identical to base_name_compare(), except it\n- * compares conflicting directory/file entries as equal. Note that\n- * while a directory name compares as equal to a regular file, they\n- * then individually compare _differently_ to a filename that has\n- * a dot after the basename (because '\\0' < '.' < '/').\n- *\n- * This is used by routines that want to traverse the git namespace\n- * but then handle conflicting entries together when possible.\n- */\n-int df_name_compare(const char *name1, size_t len1, int mode1,\n-\t\t    const char *name2, size_t len2, int mode2)\n-{\n-\tunsigned char c1, c2;\n-\tsize_t len = len1 < len2 ? len1 : len2;\n-\tint cmp;\n-\n-\tcmp = memcmp(name1, name2, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\t/* Directories and files compare equal (same length, same name) */\n-\tif (len1 == len2)\n-\t\treturn 0;\n-\tc1 = name1[len];\n-\tif (!c1 && S_ISDIR(mode1))\n-\t\tc1 = '/';\n-\tc2 = name2[len];\n-\tif (!c2 && S_ISDIR(mode2))\n-\t\tc2 = '/';\n-\tif (c1 == '/' && !c2)\n-\t\treturn 0;\n-\tif (c2 == '/' && !c1)\n-\t\treturn 0;\n-\treturn c1 - c2;\n-}\n-\n-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n-{\n-\tsize_t min_len = (len1 < len2) ? len1 : len2;\n-\tint cmp = memcmp(name1, name2, min_len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\tif (len1 < len2)\n-\t\treturn -1;\n-\tif (len1 > len2)\n-\t\treturn 1;\n-\treturn 0;\n-}\n-\n static int cache_name_stage_compare(const char *name1, int len1, int stage1,\n \t\t\t\t    const char *name2, int len2, int stage2)\n {\ndiff --git a/tree.c b/tree.c\nindex 896b7f4776b..f242a7ab691 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -94,6 +94,74 @@ int read_tree(struct repository *r,\n \treturn ret;\n }\n \n+int base_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t      const char *name2, size_t len2, int mode2)\n+{\n+\tunsigned char c1, c2;\n+\tsize_t len = len1 < len2 ? len1 : len2;\n+\tint cmp;\n+\n+\tcmp = memcmp(name1, name2, len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\tc1 = name1[len];\n+\tc2 = name2[len];\n+\tif (!c1 && S_ISDIR(mode1))\n+\t\tc1 = '/';\n+\tif (!c2 && S_ISDIR(mode2))\n+\t\tc2 = '/';\n+\treturn (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;\n+}\n+\n+/*\n+ * df_name_compare() is identical to base_name_compare(), except it\n+ * compares conflicting directory/file entries as equal. Note that\n+ * while a directory name compares as equal to a regular file, they\n+ * then individually compare _differently_ to a filename that has\n+ * a dot after the basename (because '\\0' < '.' < '/').\n+ *\n+ * This is used by routines that want to traverse the git namespace\n+ * but then handle conflicting entries together when possible.\n+ */\n+int df_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t    const char *name2, size_t len2, int mode2)\n+{\n+\tunsigned char c1, c2;\n+\tsize_t len = len1 < len2 ? len1 : len2;\n+\tint cmp;\n+\n+\tcmp = memcmp(name1, name2, len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\t/* Directories and files compare equal (same length, same name) */\n+\tif (len1 == len2)\n+\t\treturn 0;\n+\tc1 = name1[len];\n+\tif (!c1 && S_ISDIR(mode1))\n+\t\tc1 = '/';\n+\tc2 = name2[len];\n+\tif (!c2 && S_ISDIR(mode2))\n+\t\tc2 = '/';\n+\tif (c1 == '/' && !c2)\n+\t\treturn 0;\n+\tif (c2 == '/' && !c1)\n+\t\treturn 0;\n+\treturn c1 - c2;\n+}\n+\n+int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n+{\n+\tsize_t min_len = (len1 < len2) ? len1 : len2;\n+\tint cmp = memcmp(name1, name2, min_len);\n+\tif (cmp)\n+\t\treturn cmp;\n+\tif (len1 < len2)\n+\t\treturn -1;\n+\tif (len1 > len2)\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n struct tree *lookup_tree(struct repository *r, const struct object_id *oid)\n {\n \tstruct object *obj = lookup_object(r, oid);\ndiff --git a/tree.h b/tree.h\nindex 8e3c6d441cc..1b5ecbda6b3 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -29,6 +29,15 @@ void free_tree_buffer(struct tree *tree);\n /* Parses and returns the tree in the given ent, chasing tags and commits. */\n struct tree *parse_tree_indirect(const struct object_id *oid);\n \n+/*\n+ * Functions for comparing pathnames\n+ */\n+int base_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t      const char *name2, size_t len2, int mode2);\n+int df_name_compare(const char *name1, size_t len1, int mode1,\n+\t\t    const char *name2, size_t len2, int mode2);\n+int name_compare(const char *name1, size_t len1,\n+\t\t const char *name2, size_t len2);\n \n #define READ_TREE_RECURSIVE 1\n typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);\n-- \ngitgitgadget\n\n"},{"id":"475867","messageId":"7b55f82e62ecf761b804432c8d08dffabbb7605f.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:19Z","receivedAt":"2023-04-22T20:18:16Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nS_DIFFTREE_IFXMIN_NEQ is *only* used in tree-diff.c, so there is no\npoint exposing it in cache.h.  Move it to tree-diff.c.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h     | 15 ---------------\n tree-diff.c | 13 +++++++++++++\n 2 files changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex ad741e70bc2..7a46f300d9b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -10,21 +10,6 @@\n #include \"object.h\"\n #include \"statinfo.h\"\n \n-/*\n- * Some mode bits are also used internally for computations.\n- *\n- * They *must* not overlap with any valid modes, and they *must* not be emitted\n- * to outside world - i.e. appear on disk or network. In other words, it's just\n- * temporary fields, which we internally use, but they have to stay in-house.\n- *\n- * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n- *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n- */\n-\n-/* used internally in tree-diff */\n-#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n-\n-\n /*\n  * Basic data structures for the directory cache\n  */\ndiff --git a/tree-diff.c b/tree-diff.c\nindex 69031d7cbae..a76e6dae619 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -6,6 +6,19 @@\n #include \"diffcore.h\"\n #include \"tree.h\"\n \n+/*\n+ * Some mode bits are also used internally for computations.\n+ *\n+ * They *must* not overlap with any valid modes, and they *must* not be emitted\n+ * to outside world - i.e. appear on disk or network. In other words, it's just\n+ * temporary fields, which we internally use, but they have to stay in-house.\n+ *\n+ * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n+ *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n+ */\n+\n+#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n+\n /*\n  * internal mode marker, saying a tree entry != entry of tp[imin]\n  * (see ll_diff_tree_paths for what it means there)\n-- \ngitgitgadget\n\n"},{"id":"475868","messageId":"960b5438ce494a29cc93501cdf4ba4745740f374.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 16/22] treewide: remove cache.h inclusion due to previous changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:23Z","receivedAt":"2023-04-22T20:18:17Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n archive-zip.c                 | 2 +-\n bundle-uri.c                  | 2 +-\n color.c                       | 2 +-\n combine-diff.c                | 2 +-\n common-main.c                 | 2 +-\n config.c                      | 2 +-\n copy.c                        | 2 +-\n credential.c                  | 2 +-\n daemon.c                      | 2 +-\n date.c                        | 2 +-\n diagnose.c                    | 2 +-\n environment.c                 | 2 +-\n ll-merge.c                    | 2 +-\n match-trees.c                 | 2 +-\n midx.c                        | 2 +-\n object-file.c                 | 2 +-\n packfile.c                    | 2 +-\n pkt-line.c                    | 2 +-\n range-diff.c                  | 2 +-\n ref-filter.c                  | 2 +-\n t/helper/test-match-trees.c   | 1 -\n t/helper/test-mergesort.c     | 1 -\n t/helper/test-oid-array.c     | 1 -\n t/helper/test-oidtree.c       | 1 -\n t/helper/test-parse-options.c | 1 -\n t/helper/test-read-midx.c     | 1 -\n t/helper/test-string-list.c   | 1 -\n tree-diff.c                   | 2 +-\n tree-walk.c                   | 2 +-\n tree.c                        | 2 +-\n wrapper.c                     | 3 ++-\n 31 files changed, 25 insertions(+), 31 deletions(-)\n\ndiff --git a/archive-zip.c b/archive-zip.c\nindex ef538a90df4..d0d065a312e 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -1,7 +1,7 @@\n /*\n  * Copyright (c) 2006 Rene Scharfe\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"archive.h\"\n #include \"gettext.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 6d44662ee1f..ec1552bbca2 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"bundle-uri.h\"\n #include \"bundle.h\"\n #include \"copy.h\"\ndiff --git a/color.c b/color.c\nindex f8a25ca807b..83abb11eda0 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"color.h\"\n #include \"editor.h\"\ndiff --git a/combine-diff.c b/combine-diff.c\nindex f7e9fb57473..f8d61965776 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\n #include \"convert.h\"\ndiff --git a/common-main.c b/common-main.c\nindex 8ab50fa37a4..033778b3c56 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"attr.h\"\ndiff --git a/config.c b/config.c\nindex 97063a0743e..2a9ed27efe5 100644\n--- a/config.c\n+++ b/config.c\n@@ -5,7 +5,7 @@\n  * Copyright (C) Johannes Schindelin, 2005\n  *\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"advice.h\"\n #include \"alloc.h\"\ndiff --git a/copy.c b/copy.c\nindex 923d8a6dc61..882c79cffb0 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"copy.h\"\n #include \"path.h\"\n #include \"wrapper.h\"\ndiff --git a/credential.c b/credential.c\nindex 42194efc9e0..a600d0c1ac1 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"credential.h\"\ndiff --git a/daemon.c b/daemon.c\nindex f89f99d7ef4..7139cc201d7 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/date.c b/date.c\nindex bc030da012f..a6ca6b318bd 100644\n--- a/date.c\n+++ b/date.c\n@@ -4,7 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"date.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\ndiff --git a/diagnose.c b/diagnose.c\nindex f9a2496c7ff..58f49f76c7a 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diagnose.h\"\n #include \"compat/disk.h\"\n #include \"archive.h\"\ndiff --git a/environment.c b/environment.c\nindex 541f0b19acf..28d18eaca8e 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -7,7 +7,7 @@\n  * even if you might want to know where the git directory etc\n  * are.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"branch.h\"\n #include \"convert.h\"\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 85517e668e3..1993530688e 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -4,7 +4,7 @@\n  * Copyright (c) 2007 Junio C Hamano\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"convert.h\"\n #include \"attr.h\"\ndiff --git a/match-trees.c b/match-trees.c\nindex 9b78d99507b..6bc8eb76477 100644\n--- a/match-trees.c\n+++ b/match-trees.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"tree.h\"\ndiff --git a/midx.c b/midx.c\nindex 2d0da573281..c7679c3c4f5 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 8163ddbaddd..8e0df7360ae 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -6,7 +6,7 @@\n  * This handles basic git object files - packing, unpacking,\n  * creation etc.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/packfile.c b/packfile.c\nindex 9ae2278c22e..1ee9f65242c 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 8b5fa788517..62b4208b66e 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"copy.h\"\n #include \"pkt-line.h\"\n #include \"gettext.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex a1e0cffb9f6..6a704e6f471 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"range-diff.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 5387f79be6d..594e66ad361 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 3c62e33ccdf..a0afc1b4bc8 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"object-name.h\"\ndiff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c\nindex 3aabae6c1c4..42ccc870516 100644\n--- a/t/helper/test-mergesort.c\n+++ b/t/helper/test-mergesort.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"mem-pool.h\"\n #include \"mergesort.h\"\n #include \"strbuf.h\"\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex ea3bf278984..241e5da3157 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"oid-array.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex 796c9811e0f..dc509fb8065 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"oidtree.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c\nindex 20a81a1eb21..3003987ec17 100644\n--- a/t/helper/test-parse-options.c\n+++ b/t/helper/test-parse-options.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex b32abff7f11..211addaa005 100644\n--- a/t/helper/test-read-midx.c\n+++ b/t/helper/test-read-midx.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"midx.h\"\n #include \"repository.h\"\ndiff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c\nindex 959f27c74c6..042c6ff0059 100644\n--- a/t/helper/test-string-list.c\n+++ b/t/helper/test-string-list.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n \ndiff --git a/tree-diff.c b/tree-diff.c\nindex a76e6dae619..9ea2dd7a6c3 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -1,7 +1,7 @@\n /*\n  * Helper functions for tree diff generation\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"tree.h\"\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 2993c48c2f3..d3c48e06df0 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"tree-walk.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\ndiff --git a/tree.c b/tree.c\nindex f242a7ab691..0dd2029a8a2 100644\n--- a/tree.c\n+++ b/tree.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"cache-tree.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 5ab0460de5c..67f5f5dbe19 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -1,10 +1,11 @@\n /*\n  * Various trivial helper wrappers around standard functions\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"object.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\n-- \ngitgitgadget\n\n"},{"id":"475869","messageId":"b459b60de89750d0226c7c4f1c7c28de249b475b.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 17/22] cache.h: remove unnecessary headers","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:24Z","receivedAt":"2023-04-22T20:18:19Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h                              | 2 --\n compat/fsmonitor/fsm-ipc-darwin.c    | 1 +\n compat/fsmonitor/fsm-listen-darwin.c | 1 +\n 3 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 591c67b0595..bdedb87e83b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -4,8 +4,6 @@\n #include \"git-compat-util.h\"\n #include \"strbuf.h\"\n #include \"hashmap.h\"\n-#include \"gettext.h\"\n-#include \"string-list.h\"\n #include \"pathspec.h\"\n #include \"object.h\"\n #include \"statinfo.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex e62f093cc19..bc68dca0cae 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 5eb6402ab82..18c0e3913dc 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -29,6 +29,7 @@\n #include \"fsmonitor--daemon.h\"\n #include \"fsmonitor-path-utils.h\"\n #include \"gettext.h\"\n+#include \"string-list.h\"\n \n struct fsm_listen_data\n {\n-- \ngitgitgadget\n\n"},{"id":"475870","messageId":"80ebd46c862456bc726748ed11d7cf1bb1ba0e86.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 18/22] fsmonitor: reduce includes of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:25Z","receivedAt":"2023-04-22T20:18:21Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/fsmonitor/fsm-health-darwin.c | 2 +-\n compat/fsmonitor/fsm-ipc-darwin.c    | 2 +-\n compat/fsmonitor/fsm-listen-darwin.c | 2 +-\n fsmonitor--daemon.h                  | 1 -\n 4 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/fsmonitor/fsm-health-darwin.c b/compat/fsmonitor/fsm-health-darwin.c\nindex b9f709e8548..4c291f8a066 100644\n--- a/compat/fsmonitor/fsm-health-darwin.c\n+++ b/compat/fsmonitor/fsm-health-darwin.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"fsmonitor.h\"\n #include \"fsm-health.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex bc68dca0cae..793073aaa72 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 18c0e3913dc..23e24b4b374 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -23,7 +23,7 @@\n #endif\n #endif\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"fsmonitor.h\"\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\ndiff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h\nindex e24838f9a86..70d776c54f6 100644\n--- a/fsmonitor--daemon.h\n+++ b/fsmonitor--daemon.h\n@@ -3,7 +3,6 @@\n \n #ifdef HAVE_FSMONITOR_DAEMON_BACKEND\n \n-#include \"cache.h\"\n #include \"dir.h\"\n #include \"run-command.h\"\n #include \"simple-ipc.h\"\n-- \ngitgitgadget\n\n"},{"id":"475871","messageId":"7705cbc2733a52cbaa53adc3dffab58f41eb4105.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 20/22] object-store.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:27Z","receivedAt":"2023-04-22T20:18:23Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n object-file.c      | 1 +\n object-name.c      | 1 +\n object-store.h     | 8 ++++----\n submodule-config.c | 1 +\n 4 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/object-file.c b/object-file.c\nindex 8e0df7360ae..921a717d8a5 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -38,6 +38,7 @@\n #include \"packfile.h\"\n #include \"object-file.h\"\n #include \"object-store.h\"\n+#include \"oidtree.h\"\n #include \"promisor-remote.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 5ccbe854b60..88d839f70bc 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -14,6 +14,7 @@\n #include \"remote.h\"\n #include \"dir.h\"\n #include \"oid-array.h\"\n+#include \"oidtree.h\"\n #include \"packfile.h\"\n #include \"pretty.h\"\n #include \"object-store.h\"\ndiff --git a/object-store.h b/object-store.h\nindex f9d225783ae..23ea86d3702 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -2,16 +2,16 @@\n #define OBJECT_STORE_H\n \n #include \"object.h\"\n-#include \"oidmap.h\"\n #include \"list.h\"\n-#include \"oid-array.h\"\n-#include \"strbuf.h\"\n #include \"thread-utils.h\"\n #include \"khash.h\"\n #include \"dir.h\"\n-#include \"oidtree.h\"\n #include \"oidset.h\"\n \n+struct oidmap;\n+struct oidtree;\n+struct strbuf;\n+\n struct object_directory {\n \tstruct object_directory *next;\n \ndiff --git a/submodule-config.c b/submodule-config.c\nindex 7fc0812b644..58dfbde9ae5 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -12,6 +12,7 @@\n #include \"object-name.h\"\n #include \"object-store.h\"\n #include \"parse-options.h\"\n+#include \"thread-utils.h\"\n #include \"tree-walk.h\"\n \n /*\n-- \ngitgitgadget\n\n"},{"id":"475872","messageId":"d95f97f5e90da40b285aa8fd678efcff0ae11033.1682194651.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:20Z","receivedAt":"2023-04-22T20:18:25Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nhash.h depends upon and includes repository.h, due to the definition and\nuse of the_hash_algo (defined as the_repository->hash_algo).  However,\nmost headers trying to include hash.h are only interested in the layout\nof the structs like object_id.  Move the parts of hash.h that do not\ndepend upon repository.h into a new file hash-ll.h (the \"low level\"\nparts of hash.h), and adjust other files to use this new header where\nthe convenience inline functions aren't needed.\n\nThis allows hash.h and object.h to be fairly small, minimal headers.  It\nalso exposes a lot of hidden dependencies on both path.h (which was\nbrought in by repository.h) and repository.h (which was previously\nimplicitly brought in by object.h), so also adjust other files to be\nmore explicit about what they depend upon.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n alloc.c                                      |   1 +\n apply.h                                      |   2 +-\n branch.c                                     |   1 +\n builtin/apply.c                              |   1 +\n builtin/archive.c                            |   1 +\n builtin/bundle.c                             |   1 +\n builtin/check-attr.c                         |   1 +\n builtin/check-ignore.c                       |   1 +\n builtin/checkout-index.c                     |   1 +\n builtin/clean.c                              |   1 +\n builtin/config.c                             |   1 +\n builtin/credential-cache.c                   |   1 +\n builtin/credential-store.c                   |   1 +\n builtin/for-each-repo.c                      |   2 +\n builtin/help.c                               |   1 +\n builtin/init-db.c                            |   1 +\n builtin/merge-index.c                        |   1 +\n builtin/merge-recursive.c                    |   2 +\n builtin/mv.c                                 |   1 +\n builtin/push.c                               |   1 +\n builtin/read-tree.c                          |   1 +\n builtin/rerere.c                             |   1 +\n builtin/rm.c                                 |   2 +\n builtin/show-branch.c                        |   2 +\n builtin/show-index.c                         |   2 +\n builtin/update-index.c                       |   2 +\n builtin/update-ref.c                         |   2 +\n builtin/upload-archive.c                     |   1 +\n builtin/worktree.c                           |   1 +\n checkout.c                                   |   1 +\n checkout.h                                   |   2 +-\n chunk-format.c                               |   1 +\n chunk-format.h                               |   2 +-\n common-main.c                                |   1 +\n compat/fsmonitor/fsm-ipc-darwin.c            |   1 +\n compat/fsmonitor/fsm-ipc-win32.c             |   1 +\n compat/precompose_utf8.c                     |   1 +\n compat/win32/trace2_win32_process_info.c     |   1 +\n convert.h                                    |   2 +-\n copy.c                                       |   1 +\n csum-file.c                                  |   1 +\n csum-file.h                                  |   2 +-\n daemon.c                                     |   1 +\n diffcore.h                                   |   2 +-\n editor.c                                     |   1 +\n exec-cmd.c                                   |   1 +\n fsmonitor-ipc.c                              |   1 +\n gpg-interface.c                              |   1 +\n hash-ll.h                                    | 276 +++++++++++++++++++\n hash-lookup.c                                |   1 +\n hash.h                                       | 273 +-----------------\n hashmap.h                                    |   2 +-\n hex.c                                        |   1 +\n hex.h                                        |   2 +-\n hook.c                                       |   1 +\n khash.h                                      |   1 +\n ls-refs.c                                    |   1 +\n merge-ort-wrappers.c                         |   1 +\n merge-ort.h                                  |   2 +-\n negotiator/default.c                         |   1 +\n negotiator/skipping.c                        |   1 +\n object-file.h                                |   2 +\n object.h                                     |   3 +-\n oidmap.c                                     |   1 +\n oidtree.h                                    |   2 +-\n parallel-checkout.c                          |   1 +\n pathspec.c                                   |   1 +\n progress.c                                   |   1 +\n protocol-caps.c                              |   2 +-\n rebase-interactive.c                         |   1 +\n refs/files-backend.c                         |   1 +\n refs/packed-backend.c                        |   1 +\n refs/ref-cache.c                             |   2 +\n refs/ref-cache.h                             |   3 +-\n refspec.c                                    |   1 +\n reftable/dump.c                              |   2 +-\n reftable/system.h                            |   2 +-\n reset.h                                      |   2 +-\n resolve-undo.c                               |   1 +\n resolve-undo.h                               |   2 +-\n split-index.c                                |   1 +\n split-index.h                                |   2 +-\n strbuf.c                                     |   1 +\n t/helper/test-bloom.c                        |   1 +\n t/helper/test-cache-tree.c                   |   1 +\n t/helper/test-dump-cache-tree.c              |   2 +\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-example-decorate.c             |   1 +\n t/helper/test-fsmonitor-client.c             |   1 +\n t/helper/test-lazy-init-name-hash.c          |   1 +\n t/helper/test-match-trees.c                  |   1 +\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-path-utils.c                   |   1 +\n t/helper/test-read-cache.c                   |   1 +\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-submodule-config.c             |   2 +\n t/helper/test-submodule-nested-repo-config.c |   1 +\n t/helper/test-submodule.c                    |   1 +\n t/helper/test-trace2.c                       |   1 +\n t/helper/test-write-cache.c                  |   1 +\n trace2.c                                     |   1 +\n trace2/tr2_tgt_event.c                       |   1 +\n trace2/tr2_tgt_normal.c                      |   1 +\n trace2/tr2_tgt_perf.c                        |   1 +\n tree-walk.h                                  |   3 +-\n tree.h                                       |   1 +\n wrapper.c                                    |   1 +\n xdiff-interface.h                            |   2 +-\n 109 files changed, 398 insertions(+), 292 deletions(-)\n create mode 100644 hash-ll.h\n\ndiff --git a/alloc.c b/alloc.c\nindex 2886aa93543..377e80f5dda 100644\n--- a/alloc.c\n+++ b/alloc.c\n@@ -13,6 +13,7 @@\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\n+#include \"repository.h\"\n #include \"tag.h\"\n #include \"alloc.h\"\n \ndiff --git a/apply.h b/apply.h\nindex b9f18ce87d1..7cd38b1443c 100644\n--- a/apply.h\n+++ b/apply.h\n@@ -1,7 +1,7 @@\n #ifndef APPLY_H\n #define APPLY_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\n #include \"strmap.h\"\ndiff --git a/branch.c b/branch.c\nindex 7df982693af..9415ee3f340 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -9,6 +9,7 @@\n #include \"refs.h\"\n #include \"refspec.h\"\n #include \"remote.h\"\n+#include \"repository.h\"\n #include \"sequencer.h\"\n #include \"commit.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex fe72c0ec3eb..e3ff02a09e3 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"apply.h\"\n \n static const char * const apply_usage[] = {\ndiff --git a/builtin/archive.c b/builtin/archive.c\nindex d13934f1a80..b0eaa3c14a3 100644\n--- a/builtin/archive.c\n+++ b/builtin/archive.c\n@@ -9,6 +9,7 @@\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"sideband.h\"\n \n static void create_output_file(const char *output_file)\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 584d905d965..44113389d7a 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -5,6 +5,7 @@\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"cache.h\"\n #include \"bundle.h\"\n \ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 037bf1aaa2a..b2b678847f5 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -7,6 +7,7 @@\n #include \"gettext.h\"\n #include \"object-name.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"parse-options.h\"\n #include \"write-or-die.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex 9401dad0070..e4b78782a32 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -7,6 +7,7 @@\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"submodule.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 7df673e3e70..9375a05539f 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -11,6 +11,7 @@\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\n #include \"entry.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 14c0d555eac..78852d28cec 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -14,6 +14,7 @@\n #include \"dir.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 9401f1e5e3b..ff2fe8ef125 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -9,6 +9,7 @@\n #include \"ident.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\n+#include \"path.h\"\n #include \"quote.h\"\n #include \"setup.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 508da4c6e4d..0ffacfdd83c 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"wrapper.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex 8977604eb9d..30c6ccf56c0 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"credential.h\"\n+#include \"path.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n #include \"write-or-die.h\"\ndiff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c\nindex 27425c2fc9e..c28b0b3543a 100644\n--- a/builtin/for-each-repo.c\n+++ b/builtin/for-each-repo.c\n@@ -3,6 +3,8 @@\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"string-list.h\"\n \ndiff --git a/builtin/help.c b/builtin/help.c\nindex 128aa83099a..d3cf4af3f6e 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -8,6 +8,7 @@\n #include \"gettext.h\"\n #include \"pager.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"run-command.h\"\n #include \"config-list.h\"\n #include \"help.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex cda6ee75eb5..aef40361052 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -14,6 +14,7 @@\n #include \"exec-cmd.h\"\n #include \"object-file.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\ndiff --git a/builtin/merge-index.c b/builtin/merge-index.c\nindex c875f5d37ee..f044382ed8f 100644\n--- a/builtin/merge-index.c\n+++ b/builtin/merge-index.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n \n static const char *pgm;\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex fa1035405c3..90da9d07744 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -3,9 +3,11 @@\n #include \"advice.h\"\n #include \"commit.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"tag.h\"\n #include \"merge-recursive.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"xdiff-interface.h\"\n \n static const char builtin_merge_recursive_usage[] =\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 32935af48e6..665bd274485 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -18,6 +18,7 @@\n #include \"cache-tree.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"entry.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 7d2b0505aac..4e5780dd50d 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -15,6 +15,7 @@\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"repository.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"send-pack.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex d61cbad96de..440f19b1b87 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -19,6 +19,7 @@\n #include \"dir.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"resolve-undo.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex d4a03707b1a..d4bd52797f4 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\n #include \"wrapper.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex d36072252e7..b4589c824c0 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -12,9 +12,11 @@\n #include \"dir.h\"\n #include \"cache-tree.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"tree-walk.h\"\n #include \"object-name.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"setup.h\"\n #include \"submodule.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 20030b75e39..7ef4a642c17 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"pretty.h\"\n #include \"refs.h\"\n@@ -10,6 +11,7 @@\n #include \"strvec.h\"\n #include \"object-name.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"dir.h\"\n #include \"commit-slab.h\"\n #include \"date.h\"\ndiff --git a/builtin/show-index.c b/builtin/show-index.c\nindex d4bbbbcd6ce..d839e55335d 100644\n--- a/builtin/show-index.c\n+++ b/builtin/show-index.c\n@@ -1,9 +1,11 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n \n static const char *const show_index_usage[] = {\n \t\"git show-index [--object-format=<hash-algorithm>]\",\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 58bbc80db77..5fab9ad2ec4 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n@@ -21,6 +22,7 @@\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"split-index.h\"\n #include \"symlinks.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 6ca85420c3b..0c59b1c9eff 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,11 +1,13 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"object-name.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"strvec.h\"\n \n static const char * const git_update_ref_usage[] = {\ndiff --git a/builtin/upload-archive.c b/builtin/upload-archive.c\nindex 945ee2b4126..5be97ca1af5 100644\n--- a/builtin/upload-archive.c\n+++ b/builtin/upload-archive.c\n@@ -6,6 +6,7 @@\n #include \"archive.h\"\n #include \"pkt-line.h\"\n #include \"sideband.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"strvec.h\"\n \ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 0b411e9deee..5d3ca819e76 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -14,6 +14,7 @@\n #include \"strvec.h\"\n #include \"branch.h\"\n #include \"refs.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"hook.h\"\n #include \"sigchain.h\"\ndiff --git a/checkout.c b/checkout.c\nindex 04238b27133..4256e71a7c4 100644\n--- a/checkout.c\n+++ b/checkout.c\n@@ -2,6 +2,7 @@\n #include \"object-name.h\"\n #include \"remote.h\"\n #include \"refspec.h\"\n+#include \"repository.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n #include \"strbuf.h\"\ndiff --git a/checkout.h b/checkout.h\nindex 1917f3b3230..3c514a5ab4f 100644\n--- a/checkout.h\n+++ b/checkout.h\n@@ -1,7 +1,7 @@\n #ifndef CHECKOUT_H\n #define CHECKOUT_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n /*\n  * Check if the branch name uniquely matches a branch name on a remote\ndiff --git a/chunk-format.c b/chunk-format.c\nindex 60a73c1b140..e7d613c907e 100644\n--- a/chunk-format.c\n+++ b/chunk-format.c\n@@ -3,6 +3,7 @@\n #include \"chunk-format.h\"\n #include \"csum-file.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"trace2.h\"\n \n /*\ndiff --git a/chunk-format.h b/chunk-format.h\nindex 025c38f938e..c7794e84add 100644\n--- a/chunk-format.h\n+++ b/chunk-format.h\n@@ -1,7 +1,7 @@\n #ifndef CHUNK_FORMAT_H\n #define CHUNK_FORMAT_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct hashfile;\n struct chunkfile;\ndiff --git a/common-main.c b/common-main.c\nindex 601a875e2fb..8ab50fa37a4 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -2,6 +2,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"attr.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\nindex eb25123fa12..e62f093cc19 100644\n--- a/compat/fsmonitor/fsm-ipc-darwin.c\n+++ b/compat/fsmonitor/fsm-ipc-darwin.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c\nindex c9536dfb666..8928fa93ce2 100644\n--- a/compat/fsmonitor/fsm-ipc-win32.c\n+++ b/compat/fsmonitor/fsm-ipc-win32.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"path.h\"\n \n const char *fsmonitor_ipc__get_path(struct repository *r) {\n \tstatic char *ret;\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 8a9881db077..a4d11376ba5 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"path.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\n \ndiff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c\nindex e3e895c78a2..a4e33768f43 100644\n--- a/compat/win32/trace2_win32_process_info.c\n+++ b/compat/win32/trace2_win32_process_info.c\n@@ -1,5 +1,6 @@\n #include \"../../cache.h\"\n #include \"../../json-writer.h\"\n+#include \"../../repository.h\"\n #include \"../../trace2.h\"\n #include \"lazyload.h\"\n #include <Psapi.h>\ndiff --git a/convert.h b/convert.h\nindex 0a6e4086b8f..d925589444b 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -4,7 +4,7 @@\n #ifndef CONVERT_H\n #define CONVERT_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"string-list.h\"\n \n struct index_state;\ndiff --git a/copy.c b/copy.c\nindex db6b615c188..923d8a6dc61 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"copy.h\"\n+#include \"path.h\"\n #include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\ndiff --git a/csum-file.c b/csum-file.c\nindex 82ae2973d30..daf9b06dfff 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -10,6 +10,7 @@\n #include \"git-compat-util.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n+#include \"hash.h\"\n #include \"wrapper.h\"\n \n static void verify_buffer_or_die(struct hashfile *f,\ndiff --git a/csum-file.h b/csum-file.h\nindex 566e05cbd25..bc5bec27acb 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -1,7 +1,7 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"write-or-die.h\"\n \n struct progress;\ndiff --git a/daemon.c b/daemon.c\nindex 75c3c064574..f89f99d7ef4 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -3,6 +3,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\n+#include \"path.h\"\n #include \"pkt-line.h\"\n #include \"protocol.h\"\n #include \"run-command.h\"\ndiff --git a/diffcore.h b/diffcore.h\nindex 1701ed50b9c..5ffe4ec788f 100644\n--- a/diffcore.h\n+++ b/diffcore.h\n@@ -4,7 +4,7 @@\n #ifndef DIFFCORE_H\n #define DIFFCORE_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct diff_options;\n struct mem_pool;\ndiff --git a/editor.c b/editor.c\nindex b34e10606d2..38c5dbbb79b 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -6,6 +6,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"pager.h\"\n+#include \"path.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 6f618463896..1e34e48c0e4 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -3,6 +3,7 @@\n #include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n+#include \"path.h\"\n #include \"quote.h\"\n #include \"strvec.h\"\n #include \"trace.h\"\ndiff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c\nindex 866828e2992..6a6a89764a6 100644\n--- a/fsmonitor-ipc.c\n+++ b/fsmonitor-ipc.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex aceeb083367..8615dcd4b4b 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -7,6 +7,7 @@\n #include \"dir.h\"\n #include \"ident.h\"\n #include \"gpg-interface.h\"\n+#include \"path.h\"\n #include \"sigchain.h\"\n #include \"tempfile.h\"\n #include \"alias.h\"\ndiff --git a/hash-ll.h b/hash-ll.h\nnew file mode 100644\nindex 00000000000..80509251370\n--- /dev/null\n+++ b/hash-ll.h\n@@ -0,0 +1,276 @@\n+#ifndef HASH_LL_H\n+#define HASH_LL_H\n+\n+#if defined(SHA1_APPLE)\n+#include <CommonCrypto/CommonDigest.h>\n+#elif defined(SHA1_OPENSSL)\n+#include <openssl/sha.h>\n+#elif defined(SHA1_DC)\n+#include \"sha1dc_git.h\"\n+#else /* SHA1_BLK */\n+#include \"block-sha1/sha1.h\"\n+#endif\n+\n+#if defined(SHA256_NETTLE)\n+#include \"sha256/nettle.h\"\n+#elif defined(SHA256_GCRYPT)\n+#define SHA256_NEEDS_CLONE_HELPER\n+#include \"sha256/gcrypt.h\"\n+#elif defined(SHA256_OPENSSL)\n+#include <openssl/sha.h>\n+#else\n+#include \"sha256/block/sha256.h\"\n+#endif\n+\n+#ifndef platform_SHA_CTX\n+/*\n+ * platform's underlying implementation of SHA-1; could be OpenSSL,\n+ * blk_SHA, Apple CommonCrypto, etc...  Note that the relevant\n+ * SHA-1 header may have already defined platform_SHA_CTX for our\n+ * own implementations like block-sha1, so we list\n+ * the default for OpenSSL compatible SHA-1 implementations here.\n+ */\n+#define platform_SHA_CTX\tSHA_CTX\n+#define platform_SHA1_Init\tSHA1_Init\n+#define platform_SHA1_Update\tSHA1_Update\n+#define platform_SHA1_Final    \tSHA1_Final\n+#endif\n+\n+#define git_SHA_CTX\t\tplatform_SHA_CTX\n+#define git_SHA1_Init\t\tplatform_SHA1_Init\n+#define git_SHA1_Update\t\tplatform_SHA1_Update\n+#define git_SHA1_Final\t\tplatform_SHA1_Final\n+\n+#ifndef platform_SHA256_CTX\n+#define platform_SHA256_CTX\tSHA256_CTX\n+#define platform_SHA256_Init\tSHA256_Init\n+#define platform_SHA256_Update\tSHA256_Update\n+#define platform_SHA256_Final\tSHA256_Final\n+#endif\n+\n+#define git_SHA256_CTX\t\tplatform_SHA256_CTX\n+#define git_SHA256_Init\t\tplatform_SHA256_Init\n+#define git_SHA256_Update\tplatform_SHA256_Update\n+#define git_SHA256_Final\tplatform_SHA256_Final\n+\n+#ifdef platform_SHA256_Clone\n+#define git_SHA256_Clone\tplatform_SHA256_Clone\n+#endif\n+\n+#ifdef SHA1_MAX_BLOCK_SIZE\n+#include \"compat/sha1-chunked.h\"\n+#undef git_SHA1_Update\n+#define git_SHA1_Update\t\tgit_SHA1_Update_Chunked\n+#endif\n+\n+static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)\n+{\n+\tmemcpy(dst, src, sizeof(*dst));\n+}\n+\n+#ifndef SHA256_NEEDS_CLONE_HELPER\n+static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)\n+{\n+\tmemcpy(dst, src, sizeof(*dst));\n+}\n+#endif\n+\n+/*\n+ * Note that these constants are suitable for indexing the hash_algos array and\n+ * comparing against each other, but are otherwise arbitrary, so they should not\n+ * be exposed to the user or serialized to disk.  To know whether a\n+ * git_hash_algo struct points to some usable hash function, test the format_id\n+ * field for being non-zero.  Use the name field for user-visible situations and\n+ * the format_id field for fixed-length fields on disk.\n+ */\n+/* An unknown hash function. */\n+#define GIT_HASH_UNKNOWN 0\n+/* SHA-1 */\n+#define GIT_HASH_SHA1 1\n+/* SHA-256  */\n+#define GIT_HASH_SHA256 2\n+/* Number of algorithms supported (including unknown). */\n+#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)\n+\n+/* \"sha1\", big-endian */\n+#define GIT_SHA1_FORMAT_ID 0x73686131\n+\n+/* The length in bytes and in hex digits of an object name (SHA-1 value). */\n+#define GIT_SHA1_RAWSZ 20\n+#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)\n+/* The block size of SHA-1. */\n+#define GIT_SHA1_BLKSZ 64\n+\n+/* \"s256\", big-endian */\n+#define GIT_SHA256_FORMAT_ID 0x73323536\n+\n+/* The length in bytes and in hex digits of an object name (SHA-256 value). */\n+#define GIT_SHA256_RAWSZ 32\n+#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)\n+/* The block size of SHA-256. */\n+#define GIT_SHA256_BLKSZ 64\n+\n+/* The length in byte and in hex digits of the largest possible hash value. */\n+#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ\n+#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ\n+/* The largest possible block size for any supported hash. */\n+#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ\n+\n+struct object_id {\n+\tunsigned char hash[GIT_MAX_RAWSZ];\n+\tint algo;\t/* XXX requires 4-byte alignment */\n+};\n+\n+#define GET_OID_QUIETLY           01\n+#define GET_OID_COMMIT            02\n+#define GET_OID_COMMITTISH        04\n+#define GET_OID_TREE             010\n+#define GET_OID_TREEISH          020\n+#define GET_OID_BLOB             040\n+#define GET_OID_FOLLOW_SYMLINKS 0100\n+#define GET_OID_RECORD_PATH     0200\n+#define GET_OID_ONLY_TO_DIE    04000\n+#define GET_OID_REQUIRE_PATH  010000\n+\n+#define GET_OID_DISAMBIGUATORS \\\n+\t(GET_OID_COMMIT | GET_OID_COMMITTISH | \\\n+\tGET_OID_TREE | GET_OID_TREEISH | \\\n+\tGET_OID_BLOB)\n+\n+enum get_oid_result {\n+\tFOUND = 0,\n+\tMISSING_OBJECT = -1, /* The requested object is missing */\n+\tSHORT_NAME_AMBIGUOUS = -2,\n+\t/* The following only apply when symlinks are followed */\n+\tDANGLING_SYMLINK = -4, /*\n+\t\t\t\t* The initial symlink is there, but\n+\t\t\t\t* (transitively) points to a missing\n+\t\t\t\t* in-tree file\n+\t\t\t\t*/\n+\tSYMLINK_LOOP = -5,\n+\tNOT_DIR = -6, /*\n+\t\t       * Somewhere along the symlink chain, a path is\n+\t\t       * requested which contains a file as a\n+\t\t       * non-final element.\n+\t\t       */\n+};\n+\n+/* A suitably aligned type for stack allocations of hash contexts. */\n+union git_hash_ctx {\n+\tgit_SHA_CTX sha1;\n+\tgit_SHA256_CTX sha256;\n+};\n+typedef union git_hash_ctx git_hash_ctx;\n+\n+typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);\n+typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);\n+typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);\n+typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);\n+typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);\n+\n+struct git_hash_algo {\n+\t/*\n+\t * The name of the algorithm, as appears in the config file and in\n+\t * messages.\n+\t */\n+\tconst char *name;\n+\n+\t/* A four-byte version identifier, used in pack indices. */\n+\tuint32_t format_id;\n+\n+\t/* The length of the hash in binary. */\n+\tsize_t rawsz;\n+\n+\t/* The length of the hash in hex characters. */\n+\tsize_t hexsz;\n+\n+\t/* The block size of the hash. */\n+\tsize_t blksz;\n+\n+\t/* The hash initialization function. */\n+\tgit_hash_init_fn init_fn;\n+\n+\t/* The hash context cloning function. */\n+\tgit_hash_clone_fn clone_fn;\n+\n+\t/* The hash update function. */\n+\tgit_hash_update_fn update_fn;\n+\n+\t/* The hash finalization function. */\n+\tgit_hash_final_fn final_fn;\n+\n+\t/* The hash finalization function for object IDs. */\n+\tgit_hash_final_oid_fn final_oid_fn;\n+\n+\t/* The OID of the empty tree. */\n+\tconst struct object_id *empty_tree;\n+\n+\t/* The OID of the empty blob. */\n+\tconst struct object_id *empty_blob;\n+\n+\t/* The all-zeros OID. */\n+\tconst struct object_id *null_oid;\n+};\n+extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];\n+\n+/*\n+ * Return a GIT_HASH_* constant based on the name.  Returns GIT_HASH_UNKNOWN if\n+ * the name doesn't match a known algorithm.\n+ */\n+int hash_algo_by_name(const char *name);\n+/* Identical, except based on the format ID. */\n+int hash_algo_by_id(uint32_t format_id);\n+/* Identical, except based on the length. */\n+int hash_algo_by_length(int len);\n+/* Identical, except for a pointer to struct git_hash_algo. */\n+static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n+{\n+\treturn p - hash_algos;\n+}\n+\n+const struct object_id *null_oid(void);\n+\n+static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n+{\n+\t/*\n+\t * Teach the compiler that there are only two possibilities of hash size\n+\t * here, so that it can optimize for this case as much as possible.\n+\t */\n+\tif (algop->rawsz == GIT_MAX_RAWSZ)\n+\t\treturn memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n+\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n+}\n+\n+static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n+{\n+\t/*\n+\t * We write this here instead of deferring to hashcmp so that the\n+\t * compiler can properly inline it and avoid calling memcmp.\n+\t */\n+\tif (algop->rawsz == GIT_MAX_RAWSZ)\n+\t\treturn !memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n+\treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n+}\n+\n+static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n+{\n+\tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n+\tdst->algo = src->algo;\n+}\n+\n+static inline struct object_id *oiddup(const struct object_id *src)\n+{\n+\tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n+\toidcpy(dst, src);\n+\treturn dst;\n+}\n+\n+static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n+{\n+\toid->algo = hash_algo_by_ptr(algop);\n+}\n+\n+const char *empty_tree_oid_hex(void);\n+const char *empty_blob_oid_hex(void);\n+\n+#endif\ndiff --git a/hash-lookup.c b/hash-lookup.c\nindex b98ed5e11e8..bb54dfde9c7 100644\n--- a/hash-lookup.c\n+++ b/hash-lookup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"hash.h\"\n #include \"hash-lookup.h\"\n \n static uint32_t take2(const struct object_id *oid, size_t ofs)\ndiff --git a/hash.h b/hash.h\nindex d39f73618cb..615ae0691d0 100644\n--- a/hash.h\n+++ b/hash.h\n@@ -1,250 +1,11 @@\n #ifndef HASH_H\n #define HASH_H\n \n+#include \"hash-ll.h\"\n #include \"repository.h\"\n \n-#if defined(SHA1_APPLE)\n-#include <CommonCrypto/CommonDigest.h>\n-#elif defined(SHA1_OPENSSL)\n-#include <openssl/sha.h>\n-#elif defined(SHA1_DC)\n-#include \"sha1dc_git.h\"\n-#else /* SHA1_BLK */\n-#include \"block-sha1/sha1.h\"\n-#endif\n-\n-#if defined(SHA256_NETTLE)\n-#include \"sha256/nettle.h\"\n-#elif defined(SHA256_GCRYPT)\n-#define SHA256_NEEDS_CLONE_HELPER\n-#include \"sha256/gcrypt.h\"\n-#elif defined(SHA256_OPENSSL)\n-#include <openssl/sha.h>\n-#else\n-#include \"sha256/block/sha256.h\"\n-#endif\n-\n-#ifndef platform_SHA_CTX\n-/*\n- * platform's underlying implementation of SHA-1; could be OpenSSL,\n- * blk_SHA, Apple CommonCrypto, etc...  Note that the relevant\n- * SHA-1 header may have already defined platform_SHA_CTX for our\n- * own implementations like block-sha1, so we list\n- * the default for OpenSSL compatible SHA-1 implementations here.\n- */\n-#define platform_SHA_CTX\tSHA_CTX\n-#define platform_SHA1_Init\tSHA1_Init\n-#define platform_SHA1_Update\tSHA1_Update\n-#define platform_SHA1_Final    \tSHA1_Final\n-#endif\n-\n-#define git_SHA_CTX\t\tplatform_SHA_CTX\n-#define git_SHA1_Init\t\tplatform_SHA1_Init\n-#define git_SHA1_Update\t\tplatform_SHA1_Update\n-#define git_SHA1_Final\t\tplatform_SHA1_Final\n-\n-#ifndef platform_SHA256_CTX\n-#define platform_SHA256_CTX\tSHA256_CTX\n-#define platform_SHA256_Init\tSHA256_Init\n-#define platform_SHA256_Update\tSHA256_Update\n-#define platform_SHA256_Final\tSHA256_Final\n-#endif\n-\n-#define git_SHA256_CTX\t\tplatform_SHA256_CTX\n-#define git_SHA256_Init\t\tplatform_SHA256_Init\n-#define git_SHA256_Update\tplatform_SHA256_Update\n-#define git_SHA256_Final\tplatform_SHA256_Final\n-\n-#ifdef platform_SHA256_Clone\n-#define git_SHA256_Clone\tplatform_SHA256_Clone\n-#endif\n-\n-#ifdef SHA1_MAX_BLOCK_SIZE\n-#include \"compat/sha1-chunked.h\"\n-#undef git_SHA1_Update\n-#define git_SHA1_Update\t\tgit_SHA1_Update_Chunked\n-#endif\n-\n-static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)\n-{\n-\tmemcpy(dst, src, sizeof(*dst));\n-}\n-\n-#ifndef SHA256_NEEDS_CLONE_HELPER\n-static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)\n-{\n-\tmemcpy(dst, src, sizeof(*dst));\n-}\n-#endif\n-\n-/*\n- * Note that these constants are suitable for indexing the hash_algos array and\n- * comparing against each other, but are otherwise arbitrary, so they should not\n- * be exposed to the user or serialized to disk.  To know whether a\n- * git_hash_algo struct points to some usable hash function, test the format_id\n- * field for being non-zero.  Use the name field for user-visible situations and\n- * the format_id field for fixed-length fields on disk.\n- */\n-/* An unknown hash function. */\n-#define GIT_HASH_UNKNOWN 0\n-/* SHA-1 */\n-#define GIT_HASH_SHA1 1\n-/* SHA-256  */\n-#define GIT_HASH_SHA256 2\n-/* Number of algorithms supported (including unknown). */\n-#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)\n-\n-/* \"sha1\", big-endian */\n-#define GIT_SHA1_FORMAT_ID 0x73686131\n-\n-/* The length in bytes and in hex digits of an object name (SHA-1 value). */\n-#define GIT_SHA1_RAWSZ 20\n-#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)\n-/* The block size of SHA-1. */\n-#define GIT_SHA1_BLKSZ 64\n-\n-/* \"s256\", big-endian */\n-#define GIT_SHA256_FORMAT_ID 0x73323536\n-\n-/* The length in bytes and in hex digits of an object name (SHA-256 value). */\n-#define GIT_SHA256_RAWSZ 32\n-#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)\n-/* The block size of SHA-256. */\n-#define GIT_SHA256_BLKSZ 64\n-\n-/* The length in byte and in hex digits of the largest possible hash value. */\n-#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ\n-#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ\n-/* The largest possible block size for any supported hash. */\n-#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ\n-\n-struct object_id {\n-\tunsigned char hash[GIT_MAX_RAWSZ];\n-\tint algo;\t/* XXX requires 4-byte alignment */\n-};\n-\n-#define GET_OID_QUIETLY           01\n-#define GET_OID_COMMIT            02\n-#define GET_OID_COMMITTISH        04\n-#define GET_OID_TREE             010\n-#define GET_OID_TREEISH          020\n-#define GET_OID_BLOB             040\n-#define GET_OID_FOLLOW_SYMLINKS 0100\n-#define GET_OID_RECORD_PATH     0200\n-#define GET_OID_ONLY_TO_DIE    04000\n-#define GET_OID_REQUIRE_PATH  010000\n-\n-#define GET_OID_DISAMBIGUATORS \\\n-\t(GET_OID_COMMIT | GET_OID_COMMITTISH | \\\n-\tGET_OID_TREE | GET_OID_TREEISH | \\\n-\tGET_OID_BLOB)\n-\n-enum get_oid_result {\n-\tFOUND = 0,\n-\tMISSING_OBJECT = -1, /* The requested object is missing */\n-\tSHORT_NAME_AMBIGUOUS = -2,\n-\t/* The following only apply when symlinks are followed */\n-\tDANGLING_SYMLINK = -4, /*\n-\t\t\t\t* The initial symlink is there, but\n-\t\t\t\t* (transitively) points to a missing\n-\t\t\t\t* in-tree file\n-\t\t\t\t*/\n-\tSYMLINK_LOOP = -5,\n-\tNOT_DIR = -6, /*\n-\t\t       * Somewhere along the symlink chain, a path is\n-\t\t       * requested which contains a file as a\n-\t\t       * non-final element.\n-\t\t       */\n-};\n-\n-/* A suitably aligned type for stack allocations of hash contexts. */\n-union git_hash_ctx {\n-\tgit_SHA_CTX sha1;\n-\tgit_SHA256_CTX sha256;\n-};\n-typedef union git_hash_ctx git_hash_ctx;\n-\n-typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);\n-typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);\n-typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);\n-typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);\n-typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);\n-\n-struct git_hash_algo {\n-\t/*\n-\t * The name of the algorithm, as appears in the config file and in\n-\t * messages.\n-\t */\n-\tconst char *name;\n-\n-\t/* A four-byte version identifier, used in pack indices. */\n-\tuint32_t format_id;\n-\n-\t/* The length of the hash in binary. */\n-\tsize_t rawsz;\n-\n-\t/* The length of the hash in hex characters. */\n-\tsize_t hexsz;\n-\n-\t/* The block size of the hash. */\n-\tsize_t blksz;\n-\n-\t/* The hash initialization function. */\n-\tgit_hash_init_fn init_fn;\n-\n-\t/* The hash context cloning function. */\n-\tgit_hash_clone_fn clone_fn;\n-\n-\t/* The hash update function. */\n-\tgit_hash_update_fn update_fn;\n-\n-\t/* The hash finalization function. */\n-\tgit_hash_final_fn final_fn;\n-\n-\t/* The hash finalization function for object IDs. */\n-\tgit_hash_final_oid_fn final_oid_fn;\n-\n-\t/* The OID of the empty tree. */\n-\tconst struct object_id *empty_tree;\n-\n-\t/* The OID of the empty blob. */\n-\tconst struct object_id *empty_blob;\n-\n-\t/* The all-zeros OID. */\n-\tconst struct object_id *null_oid;\n-};\n-extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];\n-\n-/*\n- * Return a GIT_HASH_* constant based on the name.  Returns GIT_HASH_UNKNOWN if\n- * the name doesn't match a known algorithm.\n- */\n-int hash_algo_by_name(const char *name);\n-/* Identical, except based on the format ID. */\n-int hash_algo_by_id(uint32_t format_id);\n-/* Identical, except based on the length. */\n-int hash_algo_by_length(int len);\n-/* Identical, except for a pointer to struct git_hash_algo. */\n-static inline int hash_algo_by_ptr(const struct git_hash_algo *p)\n-{\n-\treturn p - hash_algos;\n-}\n-\n #define the_hash_algo the_repository->hash_algo\n \n-const struct object_id *null_oid(void);\n-\n-static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n-{\n-\t/*\n-\t * Teach the compiler that there are only two possibilities of hash size\n-\t * here, so that it can optimize for this case as much as possible.\n-\t */\n-\tif (algop->rawsz == GIT_MAX_RAWSZ)\n-\t\treturn memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n-\treturn memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n-}\n-\n static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)\n {\n \treturn hashcmp_algop(sha1, sha2, the_hash_algo);\n@@ -260,17 +21,6 @@ static inline int oidcmp(const struct object_id *oid1, const struct object_id *o\n \treturn hashcmp_algop(oid1->hash, oid2->hash, algop);\n }\n \n-static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)\n-{\n-\t/*\n-\t * We write this here instead of deferring to hashcmp so that the\n-\t * compiler can properly inline it and avoid calling memcmp.\n-\t */\n-\tif (algop->rawsz == GIT_MAX_RAWSZ)\n-\t\treturn !memcmp(sha1, sha2, GIT_MAX_RAWSZ);\n-\treturn !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);\n-}\n-\n static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)\n {\n \treturn hasheq_algop(sha1, sha2, the_hash_algo);\n@@ -296,12 +46,6 @@ static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)\n \tmemcpy(sha_dst, sha_src, the_hash_algo->rawsz);\n }\n \n-static inline void oidcpy(struct object_id *dst, const struct object_id *src)\n-{\n-\tmemcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);\n-\tdst->algo = src->algo;\n-}\n-\n /* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */\n static inline void oidcpy_with_padding(struct object_id *dst,\n \t\t\t\t       const struct object_id *src)\n@@ -318,13 +62,6 @@ static inline void oidcpy_with_padding(struct object_id *dst,\n \tdst->algo = src->algo;\n }\n \n-static inline struct object_id *oiddup(const struct object_id *src)\n-{\n-\tstruct object_id *dst = xmalloc(sizeof(struct object_id));\n-\toidcpy(dst, src);\n-\treturn dst;\n-}\n-\n static inline void hashclr(unsigned char *hash)\n {\n \tmemset(hash, 0, the_hash_algo->rawsz);\n@@ -362,12 +99,4 @@ static inline int is_empty_tree_oid(const struct object_id *oid)\n \treturn oideq(oid, the_hash_algo->empty_tree);\n }\n \n-static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)\n-{\n-\toid->algo = hash_algo_by_ptr(algop);\n-}\n-\n-const char *empty_tree_oid_hex(void);\n-const char *empty_blob_oid_hex(void);\n-\n #endif\ndiff --git a/hashmap.h b/hashmap.h\nindex 7251687d730..9234b94477b 100644\n--- a/hashmap.h\n+++ b/hashmap.h\n@@ -1,7 +1,7 @@\n #ifndef HASHMAP_H\n #define HASHMAP_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n /*\n  * Generic implementation of hash-based key-value mappings.\ndiff --git a/hex.c b/hex.c\nindex 0a1bddc1284..7bb440e7940 100644\n--- a/hex.c\n+++ b/hex.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n \n const signed char hexval_table[256] = {\ndiff --git a/hex.h b/hex.h\nindex e2abfc56fae..7df4b3c460e 100644\n--- a/hex.h\n+++ b/hex.h\n@@ -1,7 +1,7 @@\n #ifndef HEX_H\n #define HEX_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n extern const signed char hexval_table[256];\n static inline unsigned int hexval(unsigned char c)\ndiff --git a/hook.c b/hook.c\nindex 76e322f5804..3ca5e60895d 100644\n--- a/hook.c\n+++ b/hook.c\n@@ -2,6 +2,7 @@\n #include \"advice.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"path.h\"\n #include \"run-command.h\"\n #include \"config.h\"\n #include \"strbuf.h\"\ndiff --git a/khash.h b/khash.h\nindex 85362718c56..56241e6a5c9 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -27,6 +27,7 @@\n #define __AC_KHASH_H\n \n #include \"hashmap.h\"\n+#include \"hash.h\"\n \n #define AC_VERSION_KHASH_H \"0.2.8\"\n \ndiff --git a/ls-refs.c b/ls-refs.c\nindex b9f3e08ec3d..f385938b64c 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c\nindex c00dfbab1cd..2c47c5a6237 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n \ndiff --git a/merge-ort.h b/merge-ort.h\nindex a994c9a5fcd..ce56ec1a780 100644\n--- a/merge-ort.h\n+++ b/merge-ort.h\n@@ -2,7 +2,7 @@\n #define MERGE_ORT_H\n \n #include \"merge-recursive.h\"\n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct commit;\n struct tree;\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex f4b78eb47dd..5cb2b1d2046 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -4,6 +4,7 @@\n #include \"../fetch-negotiator.h\"\n #include \"../prio-queue.h\"\n #include \"../refs.h\"\n+#include \"../repository.h\"\n #include \"../tag.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex c7d6ab39bc5..97e7e1ae725 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -5,6 +5,7 @@\n #include \"../hex.h\"\n #include \"../prio-queue.h\"\n #include \"../refs.h\"\n+#include \"../repository.h\"\n #include \"../tag.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/object-file.h b/object-file.h\nindex e0cfc3a5db8..d6414610f80 100644\n--- a/object-file.h\n+++ b/object-file.h\n@@ -4,6 +4,8 @@\n #include \"git-zlib.h\"\n #include \"object.h\"\n \n+struct index_state;\n+\n /*\n  * Set this to 0 to prevent oid_object_info_extended() from fetching missing\n  * blobs. This has a difference only if extensions.partialClone is set.\ndiff --git a/object.h b/object.h\nindex 96e52e24fb1..5871615feea 100644\n--- a/object.h\n+++ b/object.h\n@@ -1,9 +1,10 @@\n #ifndef OBJECT_H\n #define OBJECT_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct buffer_slab;\n+struct repository;\n \n struct parsed_object_pool {\n \tstruct object **obj_hash;\ndiff --git a/oidmap.c b/oidmap.c\nindex 8c1a139c974..8b1bc4dec94 100644\n--- a/oidmap.c\n+++ b/oidmap.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"hash.h\"\n #include \"oidmap.h\"\n \n static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,\ndiff --git a/oidtree.h b/oidtree.h\nindex 77898f510a1..55c83513fdd 100644\n--- a/oidtree.h\n+++ b/oidtree.h\n@@ -2,7 +2,7 @@\n #define OIDTREE_H\n \n #include \"cbtree.h\"\n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"mem-pool.h\"\n \n struct oidtree {\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 7f0569cc930..69d569f3525 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"entry.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"parallel-checkout.h\"\n #include \"pkt-line.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex ec335a214e2..1e57b6c667d 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -6,6 +6,7 @@\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"symlinks.h\"\ndiff --git a/progress.c b/progress.c\nindex 72d5e0c73c1..f695798acac 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -12,6 +12,7 @@\n #include \"git-compat-util.h\"\n #include \"pager.h\"\n #include \"progress.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\ndiff --git a/protocol-caps.c b/protocol-caps.c\nindex 874bc815b4f..3fe0bc61c3f 100644\n--- a/protocol-caps.c\n+++ b/protocol-caps.c\n@@ -4,7 +4,7 @@\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"strvec.h\"\n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"hex.h\"\n #include \"object.h\"\n #include \"object-store.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 789f4073617..852a3313182 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"commit-slab.h\"\n #include \"config.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 1128a9af292..bca7b851c5a 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -3,6 +3,7 @@\n #include \"../copy.h\"\n #include \"../environment.h\"\n #include \"../gettext.h\"\n+#include \"../hash.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 2333ed5a1f7..704424f55c0 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -2,6 +2,7 @@\n #include \"../alloc.h\"\n #include \"../config.h\"\n #include \"../gettext.h\"\n+#include \"../hash.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\ndiff --git a/refs/ref-cache.c b/refs/ref-cache.c\nindex dc1ca49c85f..2294c4564fb 100644\n--- a/refs/ref-cache.c\n+++ b/refs/ref-cache.c\n@@ -1,6 +1,8 @@\n #include \"../git-compat-util.h\"\n #include \"../alloc.h\"\n+#include \"../hash.h\"\n #include \"../refs.h\"\n+#include \"../repository.h\"\n #include \"refs-internal.h\"\n #include \"ref-cache.h\"\n #include \"../iterator.h\"\ndiff --git a/refs/ref-cache.h b/refs/ref-cache.h\nindex cf4ad9070b9..95c76e27c83 100644\n--- a/refs/ref-cache.h\n+++ b/refs/ref-cache.h\n@@ -1,10 +1,11 @@\n #ifndef REFS_REF_CACHE_H\n #define REFS_REF_CACHE_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct ref_dir;\n struct ref_store;\n+struct repository;\n \n /*\n  * If this ref_cache is filled lazily, this function is used to load\ndiff --git a/refspec.c b/refspec.c\nindex 7b5c305514d..31b61d782c7 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"strvec.h\"\n #include \"refs.h\"\ndiff --git a/reftable/dump.c b/reftable/dump.c\nindex 155953d1b82..ce936b4e188 100644\n--- a/reftable/dump.c\n+++ b/reftable/dump.c\n@@ -7,7 +7,7 @@ https://developers.google.com/open-source/licenses/bsd\n */\n \n #include \"git-compat-util.h\"\n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n #include \"reftable-blocksource.h\"\n #include \"reftable-error.h\"\ndiff --git a/reftable/system.h b/reftable/system.h\nindex 18f9207dfee..6b74a815143 100644\n--- a/reftable/system.h\n+++ b/reftable/system.h\n@@ -13,7 +13,7 @@ https://developers.google.com/open-source/licenses/bsd\n \n #include \"git-compat-util.h\"\n #include \"strbuf.h\"\n-#include \"hash.h\" /* hash ID, sizes.*/\n+#include \"hash-ll.h\" /* hash ID, sizes.*/\n #include \"dir.h\" /* remove_dir_recursively, for tests.*/\n \n int hash_size(uint32_t id);\ndiff --git a/reset.h b/reset.h\nindex a28f81829d8..10708d8ddc0 100644\n--- a/reset.h\n+++ b/reset.h\n@@ -1,7 +1,7 @@\n #ifndef RESET_H\n #define RESET_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"repository.h\"\n \n #define GIT_REFLOG_ACTION_ENVIRONMENT \"GIT_REFLOG_ACTION\"\ndiff --git a/resolve-undo.c b/resolve-undo.c\nindex e81096e2d45..70a6db526d2 100644\n--- a/resolve-undo.c\n+++ b/resolve-undo.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"dir.h\"\n+#include \"hash.h\"\n #include \"resolve-undo.h\"\n #include \"string-list.h\"\n \ndiff --git a/resolve-undo.h b/resolve-undo.h\nindex d1ea9727712..c5deafc92fe 100644\n--- a/resolve-undo.h\n+++ b/resolve-undo.h\n@@ -6,7 +6,7 @@ struct index_state;\n struct pathspec;\n struct string_list;\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct resolve_undo_info {\n \tunsigned int mode[3];\ndiff --git a/split-index.c b/split-index.c\nindex 3fc4e91485a..40e54760b35 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n+#include \"hash.h\"\n #include \"mem-pool.h\"\n #include \"split-index.h\"\n #include \"strbuf.h\"\ndiff --git a/split-index.h b/split-index.h\nindex 1a153f47ba3..15a29cd08c9 100644\n--- a/split-index.h\n+++ b/split-index.h\n@@ -1,7 +1,7 @@\n #ifndef SPLIT_INDEX_H\n #define SPLIT_INDEX_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct index_state;\n struct strbuf;\ndiff --git a/strbuf.c b/strbuf.c\nindex 729378ec824..08eec8f1d8b 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -6,6 +6,7 @@\n #include \"hex.h\"\n #include \"object-name.h\"\n #include \"refs.h\"\n+#include \"repository.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n #include \"date.h\"\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex d2b30d644da..aabe31d724b 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -2,6 +2,7 @@\n #include \"bloom.h\"\n #include \"hex.h\"\n #include \"commit.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\ndiff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex cdaf5046f5a..9507b356e22 100644\n--- a/t/helper/test-cache-tree.c\n+++ b/t/helper/test-cache-tree.c\n@@ -6,6 +6,7 @@\n #include \"tree.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static char const * const test_cache_tree_usage[] = {\ndiff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c\nindex 715aabfbae7..4caf13c663b 100644\n--- a/t/helper/test-dump-cache-tree.c\n+++ b/t/helper/test-dump-cache-tree.c\n@@ -1,9 +1,11 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"hash.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static void dump_one(struct cache_tree *it, const char *pfx, const char *x)\ndiff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c\nindex 7e9de296db3..6dc49583375 100644\n--- a/t/helper/test-dump-fsmonitor.c\n+++ b/t/helper/test-dump-fsmonitor.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n int cmd__dump_fsmonitor(int ac, const char **av)\ndiff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c\nindex 415f55f31da..d1b99d21dcd 100644\n--- a/t/helper/test-dump-untracked-cache.c\n+++ b/t/helper/test-dump-untracked-cache.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"dir.h\"\n #include \"hex.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n static int compare_untracked(const void *a_, const void *b_)\ndiff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c\nindex 7c7fc8efc13..43707486dd4 100644\n--- a/t/helper/test-example-decorate.c\n+++ b/t/helper/test-example-decorate.c\n@@ -2,6 +2,7 @@\n #include \"git-compat-util.h\"\n #include \"object.h\"\n #include \"decorate.h\"\n+#include \"repository.h\"\n \n int cmd__example_decorate(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex a37236cd0a6..bb00e1e5d14 100644\n--- a/t/helper/test-fsmonitor-client.c\n+++ b/t/helper/test-fsmonitor-client.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor-ipc.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex f23d983c118..b83a75d19f6 100644\n--- a/t/helper/test-lazy-init-name-hash.c\n+++ b/t/helper/test-lazy-init-name-hash.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"environment.h\"\n #include \"parse-options.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"trace.h\"\n \ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex a498fece7a3..3c62e33ccdf 100644\n--- a/t/helper/test-match-trees.c\n+++ b/t/helper/test-match-trees.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"match-trees.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n \ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex de6ab77fdaa..bba4099f65f 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -2,6 +2,7 @@\n #include \"hex.h\"\n #include \"object-name.h\"\n #include \"oidmap.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n \ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex 6355c9e4b6d..2ef53d5f7a2 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n+#include \"path.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\n #include \"trace.h\"\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex a4c24d0e421..c1ae2763954 100644\n--- a/t/helper/test-read-cache.c\n+++ b/t/helper/test-read-cache.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"wrapper.h\"\n \ndiff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c\nindex 15b7688774c..444a4c02c8d 100644\n--- a/t/helper/test-scrap-cache-tree.c\n+++ b/t/helper/test-scrap-cache-tree.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"lockfile.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex c7c7fdbea98..1bacd35a53e 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -1,6 +1,8 @@\n #include \"test-tool.h\"\n #include \"config.h\"\n+#include \"hash.h\"\n #include \"object-name.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex d31f5e48ab5..ecd40ded995 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,4 +1,5 @@\n #include \"test-tool.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c\nindex 0e34581b209..cad8b0ca681 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -2,6 +2,7 @@\n #include \"test-tool-utils.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex a476df6c6cb..ab084d6034e 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -3,6 +3,7 @@\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"trace2.h\"\n \n typedef int(fn_unit_test)(int argc, const char **argv);\ndiff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c\nindex a93417ed3a9..eace08072d7 100644\n--- a/t/helper/test-write-cache.c\n+++ b/t/helper/test-write-cache.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"lockfile.h\"\n+#include \"repository.h\"\n #include \"setup.h\"\n \n int cmd__write_cache(int argc, const char **argv)\ndiff --git a/trace2.c b/trace2.c\nindex 21264df71b7..0efc4e7b958 100644\n--- a/trace2.c\n+++ b/trace2.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"json-writer.h\"\n #include \"quote.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n #include \"thread-utils.h\"\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex 9e7aab6d510..2af53e5d4de 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"json-writer.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"version.h\"\n #include \"trace2/tr2_dst.h\"\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex 8672c2c2d04..1ebfb464d54 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\n #include \"version.h\"\ndiff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c\nindex 3f2b2d53118..328e483a05e 100644\n--- a/trace2/tr2_tgt_perf.c\n+++ b/trace2/tr2_tgt_perf.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"repository.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\n #include \"version.h\"\ndiff --git a/tree-walk.h b/tree-walk.h\nindex 25fe27e3529..01a9d8eb442 100644\n--- a/tree-walk.h\n+++ b/tree-walk.h\n@@ -1,9 +1,10 @@\n #ifndef TREE_WALK_H\n #define TREE_WALK_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n \n struct index_state;\n+struct repository;\n \n #define MAX_TRAVERSE_TREES 8\n \ndiff --git a/tree.h b/tree.h\nindex 6efff003e21..0499ad01aa7 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -3,6 +3,7 @@\n \n #include \"object.h\"\n \n+struct pathspec;\n struct repository;\n struct strbuf;\n \ndiff --git a/wrapper.c b/wrapper.c\nindex e80f83498d8..5ab0460de5c 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"repository.h\"\n #include \"strbuf.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\ndiff --git a/xdiff-interface.h b/xdiff-interface.h\nindex 3750794afe9..733c364d26c 100644\n--- a/xdiff-interface.h\n+++ b/xdiff-interface.h\n@@ -1,7 +1,7 @@\n #ifndef XDIFF_INTERFACE_H\n #define XDIFF_INTERFACE_H\n \n-#include \"hash.h\"\n+#include \"hash-ll.h\"\n #include \"xdiff/xdiff.h\"\n \n /*\n-- \ngitgitgadget\n\n"},{"id":"475873","messageId":"7479e72ffd612addd9d71118647849d99c5870f8.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 19/22] commit.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:26Z","receivedAt":"2023-04-22T20:18:28Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-interactive.c    |  1 +\n archive.c            |  2 ++\n bloom.c              |  1 +\n builtin/diff-tree.c  |  1 +\n builtin/diff.c       |  1 +\n builtin/gc.c         |  1 +\n builtin/log.c        |  1 +\n builtin/merge-tree.c |  1 +\n combine-diff.c       |  1 +\n commit-graph.c       |  1 +\n commit.c             |  1 +\n commit.h             | 11 ++++-------\n dir.c                |  1 +\n fetch-pack.c         |  1 +\n fsck.c               |  1 +\n gpg-interface.c      |  1 +\n grep.c               |  1 +\n http-push.c          |  1 +\n log-tree.c           |  1 +\n merge-ort-wrappers.c |  1 +\n merge.c              |  1 +\n notes-cache.c        |  1 +\n notes-utils.c        |  1 +\n object-name.c        |  1 +\n pack-bitmap-write.c  |  1 +\n parse-options-cb.c   |  1 +\n parse-options.c      |  1 +\n read-cache.c         |  1 +\n ref-filter.c         |  1 +\n reflog.c             |  1 +\n refs/debug.c         |  1 +\n refspec.c            |  1 +\n revision.h           |  1 +\n send-pack.c          |  1 +\n wt-status.c          |  1 +\n 35 files changed, 39 insertions(+), 7 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 757a9929d41..de877ca0525 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -12,6 +12,7 @@\n #include \"dir.h\"\n #include \"run-command.h\"\n #include \"prompt.h\"\n+#include \"tree.h\"\n \n static void init_color(struct repository *r, struct add_i_state *s,\n \t\t       const char *section_and_slot, char *dst,\ndiff --git a/archive.c b/archive.c\nindex ab8966d73a5..6226e16b25e 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -6,10 +6,12 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"pretty.h\"\n #include \"setup.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\n+#include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"attr.h\"\n #include \"archive.h\"\ndiff --git a/bloom.c b/bloom.c\nindex d0730525da5..aef6b5fea2d 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -6,6 +6,7 @@\n #include \"hashmap.h\"\n #include \"commit-graph.h\"\n #include \"commit.h\"\n+#include \"commit-slab.h\"\n \n define_commit_slab(bloom_filter_slab, struct bloom_filter);\n \ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex 385c2d0230c..0b02c62b85e 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"submodule.h\"\n #include \"repository.h\"\n+#include \"tree.h\"\n \n static struct rev_info log_tree_opt;\n \ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 8f386535d61..457dee14457 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -22,6 +22,7 @@\n #include \"setup.h\"\n #include \"submodule.h\"\n #include \"oid-array.h\"\n+#include \"tree.h\"\n \n #define DIFF_NO_INDEX_EXPLICIT 1\n #define DIFF_NO_INDEX_IMPLICIT 2\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex b95154fba16..d11712b1444 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -12,6 +12,7 @@\n \n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 95de51921f8..137b84b31ef 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -44,6 +44,7 @@\n #include \"commit-reach.h\"\n #include \"range-diff.h\"\n #include \"tmp-objdir.h\"\n+#include \"tree.h\"\n #include \"write-or-die.h\"\n \n #define MAIL_DEFAULT_WRAP 72\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 6b9f006ec19..aa8040c2a6a 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -16,6 +16,7 @@\n #include \"exec-cmd.h\"\n #include \"merge-blobs.h\"\n #include \"quote.h\"\n+#include \"tree.h\"\n \n static int line_termination = '\\n';\n \ndiff --git a/combine-diff.c b/combine-diff.c\nindex f8d61965776..1e3cd7fb170 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -13,6 +13,7 @@\n #include \"xdiff/xmacros.h\"\n #include \"log-tree.h\"\n #include \"refs.h\"\n+#include \"tree.h\"\n #include \"userdiff.h\"\n #include \"oid-array.h\"\n #include \"revision.h\"\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 0c4f2266445..6f612f368ba 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -23,6 +23,7 @@\n #include \"shallow.h\"\n #include \"json-writer.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"chunk-format.h\"\n #include \"wrapper.h\"\n \ndiff --git a/commit.c b/commit.c\nindex 878b4473e4c..10676165a1d 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -26,6 +26,7 @@\n #include \"run-command.h\"\n #include \"setup.h\"\n #include \"shallow.h\"\n+#include \"tree.h\"\n #include \"hook.h\"\n \n static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);\ndiff --git a/commit.h b/commit.h\nindex 69b2f376e9d..28928833c54 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -2,13 +2,10 @@\n #define COMMIT_H\n \n #include \"object.h\"\n-#include \"tree.h\"\n-#include \"strbuf.h\"\n-#include \"decorate.h\"\n-#include \"gpg-interface.h\"\n-#include \"string-list.h\"\n-#include \"pretty.h\"\n-#include \"commit-slab.h\"\n+\n+struct signature_check;\n+struct strbuf;\n+struct tree;\n \n #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF\n #define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1)\ndiff --git a/dir.c b/dir.c\nindex ed262fa6e43..a7469df3ac7 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -27,6 +27,7 @@\n #include \"submodule-config.h\"\n #include \"symlinks.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"wrapper.h\"\n \n /*\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 677102465a1..a9745bd9faf 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/fsck.c b/fsck.c\nindex adbe8bf59e7..3261ef9ec28 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"date.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 8615dcd4b4b..49d72c2066b 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/grep.c b/grep.c\nindex d144b374894..e620e375b1d 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -4,6 +4,7 @@\n #include \"grep.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n+#include \"pretty.h\"\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"diff.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 637a4e91f7a..3f184986362 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -15,6 +15,7 @@\n #include \"setup.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n+#include \"tree.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex b5cf3d8439c..8861900b592 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -24,6 +24,7 @@\n #include \"help.h\"\n #include \"range-diff.h\"\n #include \"strmap.h\"\n+#include \"tree.h\"\n #include \"write-or-die.h\"\n \n static struct decoration name_decoration = { \"object names\" };\ndiff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c\nindex 2c47c5a6237..a5507533009 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -3,6 +3,7 @@\n #include \"hash.h\"\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n+#include \"tree.h\"\n \n #include \"commit.h\"\n \ndiff --git a/merge.c b/merge.c\nindex da7fa652c27..10aaec3a6c1 100644\n--- a/merge.c\n+++ b/merge.c\n@@ -7,6 +7,7 @@\n #include \"commit.h\"\n #include \"run-command.h\"\n #include \"resolve-undo.h\"\n+#include \"tree.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\n #include \"dir.h\"\ndiff --git a/notes-cache.c b/notes-cache.c\nindex fbcdfd0dfe5..14288caf98f 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"notes-cache.h\"\n #include \"object-store.h\"\n+#include \"pretty.h\"\n #include \"repository.h\"\n #include \"commit.h\"\n #include \"refs.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex cb88171b7bb..4a793eb347f 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -6,6 +6,7 @@\n #include \"refs.h\"\n #include \"notes-utils.h\"\n #include \"repository.h\"\n+#include \"strbuf.h\"\n \n void create_notes_commit(struct repository *r,\n \t\t\t struct notes_tree *t,\ndiff --git a/object-name.c b/object-name.c\nindex 3cd5b327293..5ccbe854b60 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -15,6 +15,7 @@\n #include \"dir.h\"\n #include \"oid-array.h\"\n #include \"packfile.h\"\n+#include \"pretty.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n #include \"setup.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex faf67c94d37..3d3fd380654 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -18,6 +18,7 @@\n #include \"commit-reach.h\"\n #include \"prio-queue.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex 26a4c7d08a9..be81158f861 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -3,6 +3,7 @@\n #include \"branch.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"date.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-name.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex b6803647d0e..f8a155ee13b 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -5,6 +5,7 @@\n #include \"commit.h\"\n #include \"color.h\"\n #include \"gettext.h\"\n+#include \"strbuf.h\"\n #include \"utf8.h\"\n \n static int disallow_abbreviated_options;\ndiff --git a/read-cache.c b/read-cache.c\nindex b3e2917ddc9..d64d93bc364 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -6,6 +6,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"date.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"hex.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 594e66ad361..84eee904ba3 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n+#include \"gpg-interface.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 9c094430884..57dc7c0d051 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -4,6 +4,7 @@\n #include \"reflog.h\"\n #include \"refs.h\"\n #include \"revision.h\"\n+#include \"tree.h\"\n #include \"worktree.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/refs/debug.c b/refs/debug.c\nindex adc34c836fc..6f11e6de46c 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"hex.h\"\n #include \"refs-internal.h\"\n+#include \"string-list.h\"\n #include \"trace.h\"\n \n static struct trace_key trace_refs = TRACE_KEY_INIT(REFS);\ndiff --git a/refspec.c b/refspec.c\nindex 31b61d782c7..57f6c2aaf9b 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -6,6 +6,7 @@\n #include \"strvec.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\n+#include \"strbuf.h\"\n \n static struct refspec_item s_tag_refspec = {\n \t.force = 0,\ndiff --git a/revision.h b/revision.h\nindex 742700504a7..6630bb2eae2 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -8,6 +8,7 @@\n #include \"pretty.h\"\n #include \"diff.h\"\n #include \"commit-slab-decl.h\"\n+#include \"decorate.h\"\n #include \"ident.h\"\n #include \"list-objects-filter-options.h\"\n \ndiff --git a/send-pack.c b/send-pack.c\nindex 351037b07bc..e68da24cc52 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"date.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex 97b9c1c0359..068b76ef6d9 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -22,6 +22,7 @@\n #include \"strbuf.h\"\n #include \"trace.h\"\n #include \"trace2.h\"\n+#include \"tree.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n #include \"lockfile.h\"\n-- \ngitgitgadget\n\n"},{"id":"475874","messageId":"67d52c6e751fae6e3325178a24eeb5f44afb3f08.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 22/22] reftable: ensure git-compat-util.h is the first (indirect) include","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:29Z","receivedAt":"2023-04-22T20:18:29Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n reftable/error.c         | 1 +\n reftable/publicbasics.c  | 2 +-\n reftable/tree.c          | 2 +-\n reftable/tree_test.c     | 1 +\n t/helper/test-reftable.c | 1 +\n 5 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/reftable/error.c b/reftable/error.c\nindex 93941f21457..0d1766735e8 100644\n--- a/reftable/error.c\n+++ b/reftable/error.c\n@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"reftable-error.h\"\n \n #include <stdio.h>\ndiff --git a/reftable/publicbasics.c b/reftable/publicbasics.c\nindex 0ad7d5c0ff2..bcb82530d6c 100644\n--- a/reftable/publicbasics.c\n+++ b/reftable/publicbasics.c\n@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"reftable-malloc.h\"\n \n #include \"basics.h\"\n-#include \"system.h\"\n \n static void *(*reftable_malloc_ptr)(size_t sz);\n static void *(*reftable_realloc_ptr)(void *, size_t);\ndiff --git a/reftable/tree.c b/reftable/tree.c\nindex b8899e060ab..a5bf8809854 100644\n--- a/reftable/tree.c\n+++ b/reftable/tree.c\n@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"tree.h\"\n \n #include \"basics.h\"\n-#include \"system.h\"\n \n struct tree_node *tree_search(void *key, struct tree_node **rootp,\n \t\t\t      int (*compare)(const void *, const void *),\ndiff --git a/reftable/tree_test.c b/reftable/tree_test.c\nindex cbff1255886..ac3a045ad4a 100644\n--- a/reftable/tree_test.c\n+++ b/reftable/tree_test.c\n@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at\n https://developers.google.com/open-source/licenses/bsd\n */\n \n+#include \"system.h\"\n #include \"tree.h\"\n \n #include \"basics.h\"\ndiff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c\nindex 1f0a28cbb64..00237ef0d9e 100644\n--- a/t/helper/test-reftable.c\n+++ b/t/helper/test-reftable.c\n@@ -1,3 +1,4 @@\n+#include \"reftable/system.h\"\n #include \"reftable/reftable-tests.h\"\n #include \"test-tool.h\"\n \n-- \ngitgitgadget\n"},{"id":"475875","messageId":"b7a96a08d1463ec51f0d8384012d812fd5f43537.1682194652.git.gitgitgadget@gmail.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"[PATCH v2 21/22] diff.h: reduce unnecessary includes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-22T20:17:28Z","receivedAt":"2023-04-22T20:18:30Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n attr.c              | 1 +\n diff.h              | 1 -\n http-push.c         | 1 +\n line-log.c          | 1 +\n pack-bitmap-write.c | 1 +\n reflog.c            | 1 +\n tree-diff.c         | 1 +\n 7 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/attr.c b/attr.c\nindex 2d8aeb8b58c..ddf2b0cbc2e 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -20,6 +20,7 @@\n #include \"object-store.h\"\n #include \"setup.h\"\n #include \"thread-utils.h\"\n+#include \"tree-walk.h\"\n \n const char git_attr__true[] = \"(builtin)true\";\n const char git_attr__false[] = \"\\0(builtin)false\";\ndiff --git a/diff.h b/diff.h\nindex 53aeb02a54b..69e574f4315 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -4,7 +4,6 @@\n #ifndef DIFF_H\n #define DIFF_H\n \n-#include \"tree-walk.h\"\n #include \"pathspec.h\"\n #include \"oidset.h\"\n #include \"strbuf.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 3f184986362..866ba243a89 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -16,6 +16,7 @@\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\ndiff --git a/line-log.c b/line-log.c\nindex 10c19daec4a..6a7ac312a43 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -18,6 +18,7 @@\n #include \"setup.h\"\n #include \"strvec.h\"\n #include \"bloom.h\"\n+#include \"tree-walk.h\"\n \n static void range_set_grow(struct range_set *rs, size_t extra)\n {\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 3d3fd380654..cdffe2ce47d 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -19,6 +19,7 @@\n #include \"prio-queue.h\"\n #include \"trace2.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/reflog.c b/reflog.c\nindex 57dc7c0d051..ee1bf5d032c 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -5,6 +5,7 @@\n #include \"refs.h\"\n #include \"revision.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n #include \"worktree.h\"\n \n /* Remember to update object flag allocation in object.h */\ndiff --git a/tree-diff.c b/tree-diff.c\nindex 9ea2dd7a6c3..20bb15f38d9 100644\n--- a/tree-diff.c\n+++ b/tree-diff.c\n@@ -5,6 +5,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"tree.h\"\n+#include \"tree-walk.h\"\n \n /*\n  * Some mode bits are also used internally for computations.\n-- \ngitgitgadget\n\n"},{"id":"475923","messageId":"1393c57f-9f3f-18da-8f02-badfdc62f02d@github.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/22] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-04-24T15:19:47Z","receivedAt":"2023-04-24T15:19:58Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/22/2023 4:17 PM, Elijah Newren via GitGitGadget wrote:\n> Changes since v1:\n> \n>  * dropped the 3rd patch (it was pulled into the series this one depends\n>    upon to fix an issue in it)\n>  * redid the old patch 14 (new patch 13); moved the parts of hash.h not\n>    depending on repository.h into hash-ll.h so that other headers and files\n>    could depend upon just that part. (Are people happy with the hash-ll.h\n>    name or have alternate suggestions?)\n\nThank you for this change. I looked at patch 13 and was pleased to see\nseveral uses of hash-ll.h (more than I expected). I'm also happy with the\nname.\n\nv2 LGTM.\n\nThanks,\n-Stolee\n"},{"id":"475959","messageId":"kl6ly1mh865x.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59603","inReplyTo":"d95f97f5e90da40b285aa8fd678efcff0ae11033.1682194651.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-04-24T18:51:54Z","receivedAt":"2023-04-24T18:52:45Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n>                                 Move the parts of hash.h that do not\n> depend upon repository.h into a new file hash-ll.h (the \"low level\"\n> parts of hash.h), and adjust other files to use this new header where\n> the convenience inline functions aren't needed.\n\nSuggestion: To maintain this property, it might be helpful to capture\nthe rules of hash-ll.h vs hash.h in a top-level comment.\n\n> diff --git a/hash-ll.h b/hash-ll.h\n> new file mode 100644\n> index 00000000000..80509251370\n> --- /dev/null\n> +++ b/hash-ll.h\n> +const struct object_id *null_oid(void);\n> [...]\n> +const char *empty_tree_oid_hex(void);\n> +const char *empty_blob_oid_hex(void);\n\nhash-ll.h doesn't depend on repository.h, but these functions' bodies\nuse the_hash_algo. Does it matter?\n\nMoving the functions to hash.h requires changing 8 files to #include\n\"hash.h\", all of which seem to be because they were getting hash-ll.h\nindirectly via object-name.h.\n"},{"id":"475965","messageId":"xmqq354pdps0.fsf@gitster.g","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/22] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-24T19:49:19Z","receivedAt":"2023-04-24T19:49:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Changes since v1:\n>\n>  * dropped the 3rd patch (it was pulled into the series this one depends\n>    upon to fix an issue in it)\n\nThanks.\n\n>  * redid the old patch 14 (new patch 13); moved the parts of hash.h not\n>    depending on repository.h into hash-ll.h so that other headers and files\n>    could depend upon just that part. (Are people happy with the hash-ll.h\n>    name or have alternate suggestions?)\n\nWe have precedence of abbreviating low-level to ll in ll-merge.c already.\n"},{"id":"475966","messageId":"xmqqwn21cb2v.fsf@gitster.g","threadId":"59603","inReplyTo":"d95f97f5e90da40b285aa8fd678efcff0ae11033.1682194651.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-24T19:52:08Z","receivedAt":"2023-04-24T19:53:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This allows hash.h and object.h to be fairly small, minimal headers.  It\n> also exposes a lot of hidden dependencies on both path.h (which was\n> brought in by repository.h) and repository.h (which was previously\n> implicitly brought in by object.h), so also adjust other files to be\n> more explicit about what they depend upon.\n\nYeah, <hash.h> becomes pleasantly small.\n\nWill queue.\n"},{"id":"476084","messageId":"CABPp-BEWS75TrsfUQUP9t4_2B4FTDbM2FamqTgvVj8WpxUgSYA@mail.gmail.com","threadId":"59603","inReplyTo":"kl6ly1mh865x.fsf@chooglen-macbookpro.roam.corp.google.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-26T03:54:17Z","receivedAt":"2023-04-26T03:54:35Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Apr 24, 2023 at 11:51 AM Glen Choo <chooglen@google.com> wrote:\n>\n> \"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n> >                                 Move the parts of hash.h that do not\n> > depend upon repository.h into a new file hash-ll.h (the \"low level\"\n> > parts of hash.h), and adjust other files to use this new header where\n> > the convenience inline functions aren't needed.\n>\n> Suggestion: To maintain this property, it might be helpful to capture\n> the rules of hash-ll.h vs hash.h in a top-level comment.\n>\n> > diff --git a/hash-ll.h b/hash-ll.h\n> > new file mode 100644\n> > index 00000000000..80509251370\n> > --- /dev/null\n> > +++ b/hash-ll.h\n> > +const struct object_id *null_oid(void);\n> > [...]\n> > +const char *empty_tree_oid_hex(void);\n> > +const char *empty_blob_oid_hex(void);\n>\n> hash-ll.h doesn't depend on repository.h, but these functions' bodies\n> use the_hash_algo. Does it matter?\n\nThat's a good point.  I think eventually moving these functions from\nhash-ll.h to hash.h on this basis makes sense.  But I kind of view\nthis series (and its predecessors) as focusing on cleaning up header\ndependencies, with the idea that hopefully we'd go through and do\nfurther cleanup of dependencies of C files that would likely result in\nfurther changes to some of the headers.  I suspect this isn't the only\nchange we'd need to make for that kind of consistency, which might\nlengthen this already sizable series, and I've probably missed a few\nsimilar cases in my previous series as well.\n\n> Moving the functions to hash.h requires changing 8 files to #include\n> \"hash.h\", all of which seem to be because they were getting hash-ll.h\n> indirectly via object-name.h.\n\nYeah, seems like a reasonable further change.  Are you okay with that\nbeing in a future series, or do you think it should be included in\nthis one?\n"},{"id":"476127","messageId":"kl6ledo6o7md.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59603","inReplyTo":"CABPp-BEWS75TrsfUQUP9t4_2B4FTDbM2FamqTgvVj8WpxUgSYA@mail.gmail.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-04-26T17:50:34Z","receivedAt":"2023-04-26T17:50:41Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n>> hash-ll.h doesn't depend on repository.h, but these functions' bodies\n>> use the_hash_algo. Does it matter?\n>\n> That's a good point.  I think eventually moving these functions from\n> hash-ll.h to hash.h on this basis makes sense.  But I kind of view\n> this series (and its predecessors) as focusing on cleaning up header\n> dependencies, with the idea that hopefully we'd go through and do\n> further cleanup of dependencies of C files that would likely result in\n> further changes to some of the headers.\n\nYeah, for simplicity, keeping this series header-only makes sense.\n\n>> Moving the functions to hash.h requires changing 8 files to #include\n>> \"hash.h\", all of which seem to be because they were getting hash-ll.h\n>> indirectly via object-name.h.\n>\n> Yeah, seems like a reasonable further change.  Are you okay with that\n> being in a future series, or do you think it should be included in\n> this one?\n\nLet's do this in a later series. As you mentioned, there are probably a\nlot of other clean ups that make sense, but this series is already a\ngood step forward, and keeping those clean ups out makes this easier to\nreview.\n"},{"id":"476128","messageId":"kl6lbkjao7fe.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59603","inReplyTo":"pull.1517.v2.git.1682194649.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/22] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-04-26T17:54:45Z","receivedAt":"2023-04-26T17:54:51Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This series continues to focus on splitting declarations from cache.h to\n> separate headers. This series also untangles some dependencies between\n> hash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\n> up a few other headers. At the end of this series the number of cache.h\n> includes drops from 189 down to 149.\n\nI looked over all of the patches briefly and didn't spot any issues,\nthough not deeply enough for a Reviewed-by.\n\nFWIW I am quite happy with the direction of this series. I find the\nresult much easier to understand compared to the cache.h status quo.\n"},{"id":"476129","messageId":"xmqqsfcmse74.fsf@gitster.g","threadId":"59603","inReplyTo":"kl6lbkjao7fe.fsf@chooglen-macbookpro.roam.corp.google.com","subject":"Re: [PATCH v2 00/22] Header cleanups (more splitting of cache.h and simplifying a few other deps)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-26T18:14:55Z","receivedAt":"2023-04-26T18:15:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Glen Choo <chooglen@google.com> writes:\n\n> \"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n>> This series continues to focus on splitting declarations from cache.h to\n>> separate headers. This series also untangles some dependencies between\n>> hash.h and repository.h, and between read-cache.c and tree.[ch], and cleans\n>> up a few other headers. At the end of this series the number of cache.h\n>> includes drops from 189 down to 149.\n>\n> I looked over all of the patches briefly and didn't spot any issues,\n> though not deeply enough for a Reviewed-by.\n>\n> FWIW I am quite happy with the direction of this series. I find the\n> result much easier to understand compared to the cache.h status quo.\n\nAnything that shrinks the kitchen-sinks would be good ;-)\n\nThanks.\n"},{"id":"476350","messageId":"230501.86zg6ohuw7.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"7b55f82e62ecf761b804432c8d08dffabbb7605f.1682194651.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T16:33:58Z","receivedAt":"2023-05-01T16:35:50Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> S_DIFFTREE_IFXMIN_NEQ is *only* used in tree-diff.c, so there is no\n> point exposing it in cache.h.  Move it to tree-diff.c.\n>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  cache.h     | 15 ---------------\n>  tree-diff.c | 13 +++++++++++++\n>  2 files changed, 13 insertions(+), 15 deletions(-)\n>\n> diff --git a/cache.h b/cache.h\n> index ad741e70bc2..7a46f300d9b 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -10,21 +10,6 @@\n>  #include \"object.h\"\n>  #include \"statinfo.h\"\n>  \n> -/*\n> - * Some mode bits are also used internally for computations.\n> - *\n> - * They *must* not overlap with any valid modes, and they *must* not be emitted\n> - * to outside world - i.e. appear on disk or network. In other words, it's just\n> - * temporary fields, which we internally use, but they have to stay in-house.\n> - *\n> - * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n> - *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n> - */\n> -\n> -/* used internally in tree-diff */\n> -#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n> -\n> -\n>  /*\n>   * Basic data structures for the directory cache\n>   */\n> diff --git a/tree-diff.c b/tree-diff.c\n> index 69031d7cbae..a76e6dae619 100644\n> --- a/tree-diff.c\n> +++ b/tree-diff.c\n> @@ -6,6 +6,19 @@\n>  #include \"diffcore.h\"\n>  #include \"tree.h\"\n>  \n> +/*\n> + * Some mode bits are also used internally for computations.\n> + *\n> + * They *must* not overlap with any valid modes, and they *must* not be emitted\n> + * to outside world - i.e. appear on disk or network. In other words, it's just\n> + * temporary fields, which we internally use, but they have to stay in-house.\n> + *\n> + * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n> + *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n> + */\n> +\n> +#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n> +\n>  /*\n>   * internal mode marker, saying a tree entry != entry of tp[imin]\n>   * (see ll_diff_tree_paths for what it means there)\n\nAs it's only used in tree-diff.c, should this change not be instead\nchanging how we define S_IFXMIN_NEQ itself, and combining the two\ncomments seen here (the latter only partially, in the context).\n\nNot that this makes things worse or anything...\n"},{"id":"476352","messageId":"xmqqzg6o579h.fsf@gitster.g","threadId":"59603","inReplyTo":"230501.86zg6ohuw7.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-05-01T16:46:50Z","receivedAt":"2023-05-01T16:46:54Z","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>> +#define S_DIFFTREE_IFXMIN_NEQ\t0x80000000\n>> +\n>>  /*\n>>   * internal mode marker, saying a tree entry != entry of tp[imin]\n>>   * (see ll_diff_tree_paths for what it means there)\n>\n> As it's only used in tree-diff.c, should this change not be instead\n> changing how we define S_IFXMIN_NEQ itself, and combining the two\n> comments seen here (the latter only partially, in the context).\n\nYup, the end result should look cleaner with this extra bit of\ntweak.  Thanks for carefully reading the patch.\n\n"},{"id":"476353","messageId":"230501.86v8hchuay.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"960b5438ce494a29cc93501cdf4ba4745740f374.1682194652.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 16/22] treewide: remove cache.h inclusion due to previous changes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T16:44:36Z","receivedAt":"2023-05-01T16:48:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\nThe \"Subject\" says \"due to previous changes\", but...\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  archive-zip.c                 | 2 +-\n>  bundle-uri.c                  | 2 +-\n>  color.c                       | 2 +-\n>  combine-diff.c                | 2 +-\n>  common-main.c                 | 2 +-\n>  config.c                      | 2 +-\n>  copy.c                        | 2 +-\n>  credential.c                  | 2 +-\n>  daemon.c                      | 2 +-\n>  date.c                        | 2 +-\n>  diagnose.c                    | 2 +-\n>  environment.c                 | 2 +-\n>  ll-merge.c                    | 2 +-\n>  match-trees.c                 | 2 +-\n>  midx.c                        | 2 +-\n>  object-file.c                 | 2 +-\n>  packfile.c                    | 2 +-\n>  pkt-line.c                    | 2 +-\n>  range-diff.c                  | 2 +-\n>  ref-filter.c                  | 2 +-\n>  t/helper/test-match-trees.c   | 1 -\n>  t/helper/test-mergesort.c     | 1 -\n>  t/helper/test-oid-array.c     | 1 -\n>  t/helper/test-oidtree.c       | 1 -\n>  t/helper/test-parse-options.c | 1 -\n>  t/helper/test-read-midx.c     | 1 -\n>  t/helper/test-string-list.c   | 1 -\n>  tree-diff.c                   | 2 +-\n>  tree-walk.c                   | 2 +-\n>  tree.c                        | 2 +-\n>  wrapper.c                     | 3 ++-\n>  31 files changed, 25 insertions(+), 31 deletions(-)\n>\n> diff --git a/archive-zip.c b/archive-zip.c\n> index ef538a90df4..d0d065a312e 100644\n> --- a/archive-zip.c\n> +++ b/archive-zip.c\n> @@ -1,7 +1,7 @@\n>  /*\n>   * Copyright (c) 2006 Rene Scharfe\n>   */\n> -#include \"cache.h\"\n> +#include \"git-compat-util.h\"\n>  #include \"config.h\"\n>  #include \"archive.h\"\n>  #include \"gettext.h\"\n\nI tried making this change before this series was applied, and\neverything compiled...\n\n> diff --git a/bundle-uri.c b/bundle-uri.c\n> index 6d44662ee1f..ec1552bbca2 100644\n> --- a/bundle-uri.c\n> +++ b/bundle-uri.c\n> @@ -1,4 +1,4 @@\n> -#include \"cache.h\"\n> +#include \"git-compat-util.h\"\n>  #include \"bundle-uri.h\"\n>  #include \"bundle.h\"\n>  #include \"copy.h\"\n\nThat's not the case here, but this could instead be squashed into the\n05/22 in this series, i.e. as soon as we add this copy.h, we don't need\ncache.h anymore.\n\n> diff --git a/color.c b/color.c\n> index f8a25ca807b..83abb11eda0 100644\n> --- a/color.c\n> +++ b/color.c\n> @@ -1,4 +1,4 @@\n> -#include \"cache.h\"\n> +#include \"git-compat-util.h\"\n>  #include \"config.h\"\n>  #include \"color.h\"\n>  #include \"editor.h\"\n\nI did not look further, but all of the rest of these look like they'd be\nbetter off squashed into the respective \"split this out\" commit. I don't\nthink keeping the \"move declarations for ...\" as \"move-only\" commits is\nworth it, as opposed to getting rid of this one, and making those\natomic.\n"},{"id":"476354","messageId":"230501.86r0s0hu7a.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"b459b60de89750d0226c7c4f1c7c28de249b475b.1682194652.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 17/22] cache.h: remove unnecessary headers","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T16:49:29Z","receivedAt":"2023-05-01T16:50:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  cache.h                              | 2 --\n>  compat/fsmonitor/fsm-ipc-darwin.c    | 1 +\n>  compat/fsmonitor/fsm-listen-darwin.c | 1 +\n>  3 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/cache.h b/cache.h\n> index 591c67b0595..bdedb87e83b 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -4,8 +4,6 @@\n>  #include \"git-compat-util.h\"\n>  #include \"strbuf.h\"\n>  #include \"hashmap.h\"\n> -#include \"gettext.h\"\n> -#include \"string-list.h\"\n>  #include \"pathspec.h\"\n>  #include \"object.h\"\n>  #include \"statinfo.h\"\n> diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\n> index e62f093cc19..bc68dca0cae 100644\n> --- a/compat/fsmonitor/fsm-ipc-darwin.c\n> +++ b/compat/fsmonitor/fsm-ipc-darwin.c\n> @@ -1,5 +1,6 @@\n>  #include \"cache.h\"\n>  #include \"config.h\"\n> +#include \"gettext.h\"\n>  #include \"hex.h\"\n>  #include \"repository.h\"\n>  #include \"strbuf.h\"\n> diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\n> index 5eb6402ab82..18c0e3913dc 100644\n> --- a/compat/fsmonitor/fsm-listen-darwin.c\n> +++ b/compat/fsmonitor/fsm-listen-darwin.c\n> @@ -29,6 +29,7 @@\n>  #include \"fsmonitor--daemon.h\"\n>  #include \"fsmonitor-path-utils.h\"\n>  #include \"gettext.h\"\n> +#include \"string-list.h\"\n>  \n>  struct fsm_listen_data\n>  {\n\nIf I rebase this topic to make this the first commit everything\ncompiles, i.e. nothing here relies on what came before.\n\nGiven the extensive earlier moves I think it would be better to first\nremove unnecessary includes from cache.h, before starting to split it\nup.\n"},{"id":"476355","messageId":"230501.86mt2ohtt0.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"7479e72ffd612addd9d71118647849d99c5870f8.1682194652.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 19/22] commit.h: reduce unnecessary includes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T16:52:52Z","receivedAt":"2023-05-01T17:06:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n\nRe earlier comments: If I rebase to make this the first commit\neverything compiles, i.e. nothing here relied on the earlier split-offs\nof cache.h into other headers.\n\nYou need to make a choice of whether to first split out cache.h, and\nthen do commits like these, or the other way around.\n\nI'm not sure whether it's better to do it the other way around. If you\ndo that it's clear e.g. add-interactive.c's implicit dependency on\ntree.h via commit.h has nothing to do with what would be the subsequent\nsplit-up of cache.h.\n\nOr maybe this is fine. I'm just trying to get some picture of what\ndepends on what in this series...\n"},{"id":"476358","messageId":"230501.86ildcht9c.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"7705cbc2733a52cbaa53adc3dffab58f41eb4105.1682194652.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 20/22] object-store.h: reduce unnecessary includes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T17:00:57Z","receivedAt":"2023-05-01T17:15:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  object-file.c      | 1 +\n>  object-name.c      | 1 +\n>  object-store.h     | 8 ++++----\n>  submodule-config.c | 1 +\n>  4 files changed, 7 insertions(+), 4 deletions(-)\n>\n> diff --git a/object-file.c b/object-file.c\n> index 8e0df7360ae..921a717d8a5 100644\n> --- a/object-file.c\n> +++ b/object-file.c\n> @@ -38,6 +38,7 @@\n>  #include \"packfile.h\"\n>  #include \"object-file.h\"\n>  #include \"object-store.h\"\n> +#include \"oidtree.h\"\n>  #include \"promisor-remote.h\"\n>  #include \"setup.h\"\n>  #include \"submodule.h\"\n> diff --git a/object-name.c b/object-name.c\n> index 5ccbe854b60..88d839f70bc 100644\n> --- a/object-name.c\n> +++ b/object-name.c\n> @@ -14,6 +14,7 @@\n>  #include \"remote.h\"\n>  #include \"dir.h\"\n>  #include \"oid-array.h\"\n> +#include \"oidtree.h\"\n>  #include \"packfile.h\"\n>  #include \"pretty.h\"\n>  #include \"object-store.h\"\n> diff --git a/object-store.h b/object-store.h\n> index f9d225783ae..23ea86d3702 100644\n> --- a/object-store.h\n> +++ b/object-store.h\n> @@ -2,16 +2,16 @@\n>  #define OBJECT_STORE_H\n>  \n>  #include \"object.h\"\n> -#include \"oidmap.h\"\n>  #include \"list.h\"\n> -#include \"oid-array.h\"\n\nIt seems to me that this should be split up, there does seem to be an\nunnecessary include here, as the subject claims, at least the\n\"oid-array.h include in object-store.h seems to qualify.\n\nMaybe the same applies to thread-utils.h below?\n\n> -#include \"strbuf.h\"\n>  #include \"thread-utils.h\"\n>  #include \"khash.h\"\n>  #include \"dir.h\"\n> -#include \"oidtree.h\"\n>  #include \"oidset.h\"\n>  \n> +struct oidmap;\n> +struct oidtree;\n> +struct strbuf;\n\nBut as this shows at least three of these weren't unnecessary, you're\njust replacing them with forward-decls.\n\nI think that's probably sensible, but I think it should at least be\ndiscussed.\n\nIt's also not clear why we want to just stop at forward-declaring\nstructs, maybe replacing the dir.h include with:\n\n\tint fspatheq(const char *a, const char *b);\n\tunsigned int fspathhash(const char *str);\n\nWould be too verbose, but if we did that we'd spot that\ne.g. match-trees.c is relying on this header to get its \"struct strbuf\"\ndefinition.\n\nI'm perfectly fine to leave that can of worms for some later date\nthough...\n"},{"id":"476360","messageId":"230501.86edo0ht7a.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"b7a96a08d1463ec51f0d8384012d812fd5f43537.1682194652.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 21/22] diff.h: reduce unnecessary includes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T17:11:22Z","receivedAt":"2023-05-01T17:16:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  attr.c              | 1 +\n>  diff.h              | 1 -\n>  http-push.c         | 1 +\n>  line-log.c          | 1 +\n>  pack-bitmap-write.c | 1 +\n>  reflog.c            | 1 +\n>  tree-diff.c         | 1 +\n>  7 files changed, 6 insertions(+), 1 deletion(-)\n>\n> diff --git a/attr.c b/attr.c\n> index 2d8aeb8b58c..ddf2b0cbc2e 100644\n> --- a/attr.c\n> +++ b/attr.c\n> @@ -20,6 +20,7 @@\n>  #include \"object-store.h\"\n>  #include \"setup.h\"\n>  #include \"thread-utils.h\"\n> +#include \"tree-walk.h\"\n>  \n>  const char git_attr__true[] = \"(builtin)true\";\n>  const char git_attr__false[] = \"\\0(builtin)false\";\n> diff --git a/diff.h b/diff.h\n> index 53aeb02a54b..69e574f4315 100644\n> --- a/diff.h\n> +++ b/diff.h\n> @@ -4,7 +4,6 @@\n>  #ifndef DIFF_H\n>  #define DIFF_H\n>  \n> -#include \"tree-walk.h\"\n>  #include \"pathspec.h\"\n>  #include \"oidset.h\"\n>  #include \"strbuf.h\"\n> diff --git a/http-push.c b/http-push.c\n> index 3f184986362..866ba243a89 100644\n> --- a/http-push.c\n> +++ b/http-push.c\n> @@ -16,6 +16,7 @@\n>  #include \"sigchain.h\"\n>  #include \"strvec.h\"\n>  #include \"tree.h\"\n> +#include \"tree-walk.h\"\n>  #include \"packfile.h\"\n>  #include \"object-store.h\"\n>  #include \"commit-reach.h\"\n> diff --git a/line-log.c b/line-log.c\n> index 10c19daec4a..6a7ac312a43 100644\n> --- a/line-log.c\n> +++ b/line-log.c\n> @@ -18,6 +18,7 @@\n>  #include \"setup.h\"\n>  #include \"strvec.h\"\n>  #include \"bloom.h\"\n> +#include \"tree-walk.h\"\n>  \n>  static void range_set_grow(struct range_set *rs, size_t extra)\n>  {\n> diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\n> index 3d3fd380654..cdffe2ce47d 100644\n> --- a/pack-bitmap-write.c\n> +++ b/pack-bitmap-write.c\n> @@ -19,6 +19,7 @@\n>  #include \"prio-queue.h\"\n>  #include \"trace2.h\"\n>  #include \"tree.h\"\n> +#include \"tree-walk.h\"\n>  \n>  struct bitmapped_commit {\n>  \tstruct commit *commit;\n> diff --git a/reflog.c b/reflog.c\n> index 57dc7c0d051..ee1bf5d032c 100644\n> --- a/reflog.c\n> +++ b/reflog.c\n> @@ -5,6 +5,7 @@\n>  #include \"refs.h\"\n>  #include \"revision.h\"\n>  #include \"tree.h\"\n> +#include \"tree-walk.h\"\n>  #include \"worktree.h\"\n>  \n>  /* Remember to update object flag allocation in object.h */\n> diff --git a/tree-diff.c b/tree-diff.c\n> index 9ea2dd7a6c3..20bb15f38d9 100644\n> --- a/tree-diff.c\n> +++ b/tree-diff.c\n> @@ -5,6 +5,7 @@\n>  #include \"diff.h\"\n>  #include \"diffcore.h\"\n>  #include \"tree.h\"\n> +#include \"tree-walk.h\"\n>  \n>  /*\n>   * Some mode bits are also used internally for computations.\n\nThis, unlike the preceding 20/22 really does seem to strictly match its\n$subject, i.e. diff.h didn't need tree-walk.h, but some stuff using it\nneeded it, so we're moving the include to those users themselves.\n"},{"id":"476363","messageId":"230501.86a5yohsme.gmgdl@evledraar.gmail.com","threadId":"59603","inReplyTo":"d95f97f5e90da40b285aa8fd678efcff0ae11033.1682194651.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-05-01T17:17:11Z","receivedAt":"2023-05-01T17:24:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n\n> From: Elijah Newren <newren@gmail.com>\n>\n> [...]\n> diff --git a/checkout.h b/checkout.h\n> index 1917f3b3230..3c514a5ab4f 100644\n> --- a/checkout.h\n> +++ b/checkout.h\n> @@ -1,7 +1,7 @@\n>  #ifndef CHECKOUT_H\n>  #define CHECKOUT_H\n>  \n> -#include \"hash.h\"\n> +#include \"hash-ll.h\"\n\nThe end-state of this topic is oddly inconsistent in when it uses\nincludes, and when it uses forward declarations.\n\nAs I note in a reply to 20/22 you're adding forward declares there, I\nthink that's fine, but if you opdet for that why not do that here. The\nbody of this header only defines one function, which takes a pointer to\na \"struct object_id\".\n\nWhereas above you did this change:\n\n> diff --git a/apply.h b/apply.h\n> index b9f18ce87d1..7cd38b1443c 100644\n> --- a/apply.h\n> +++ b/apply.h\n> @@ -1,7 +1,7 @@\n>  #ifndef APPLY_H\n>  #define APPLY_H\n>  \n> -#include \"hash.h\"\n> +#include \"hash-ll.h\"\n>  #include \"lockfile.h\"\n>  #include \"string-list.h\"\n>  #include \"strmap.h\"\n\nThere we really should include it, as we're not dealing with a pointer\nto the \"struct object_id\", but the struct itself, so we need its\ndefinition, and don't want to find it implicitly.\n\n> diff --git a/chunk-format.h b/chunk-format.h\n> index 025c38f938e..c7794e84add 100644\n> --- a/chunk-format.h\n> +++ b/chunk-format.h\n> @@ -1,7 +1,7 @@\n>  #ifndef CHUNK_FORMAT_H\n>  #define CHUNK_FORMAT_H\n>  \n> -#include \"hash.h\"\n> +#include \"hash-ll.h\"\n>  \n>  struct hashfile;\n>  struct chunkfile;\n\nThen we have this, where we seemingly could avoid the include as well,\nand just add a:\n\n\tstruct git_hash_algo;\n\nAnyway, I'm not saying one is better than the other, I'm just wondering\nwhy you're picking one, but not the other.\n\nIs it because you know that hash-ll.h doesn't bring in other headers, so\nits inclusion is OK, whereas later in e.g. 20/22 you avoid including\nstrbuf.h, because you know that'll bring in string-list.h?\n\nIf that's the case maybe we should just move\nstrbuf_add_separated_string_list() into some \"used by merge-ort.c and\nmerge-recursive.c\" file, remove the string-list.h includion from\nstrbuf.h, and then include \"strbuf.h\" without fearing the side-effects\nelsewhere?\n"},{"id":"476396","messageId":"CABPp-BEPy4R1R1X1o1oMs6sEECVjEoLeRXripEi7k8ZO-CrbuA@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86zg6ohuw7.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T01:06:00Z","receivedAt":"2023-05-02T01:07:45Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 9:35 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n[...]\n> > --- a/tree-diff.c\n> > +++ b/tree-diff.c\n> > @@ -6,6 +6,19 @@\n> >  #include \"diffcore.h\"\n> >  #include \"tree.h\"\n> >\n> > +/*\n> > + * Some mode bits are also used internally for computations.\n> > + *\n> > + * They *must* not overlap with any valid modes, and they *must* not be emitted\n> > + * to outside world - i.e. appear on disk or network. In other words, it's just\n> > + * temporary fields, which we internally use, but they have to stay in-house.\n> > + *\n> > + * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n> > + *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n> > + */\n> > +\n> > +#define S_DIFFTREE_IFXMIN_NEQ        0x80000000\n> > +\n> >  /*\n> >   * internal mode marker, saying a tree entry != entry of tp[imin]\n> >   * (see ll_diff_tree_paths for what it means there)\n>\n> As it's only used in tree-diff.c, should this change not be instead\n> changing how we define S_IFXMIN_NEQ itself, and combining the two\n> comments seen here (the latter only partially, in the context).\n>\n> Not that this makes things worse or anything...\n\nHmm, that makes sense; I'll make the tweak.  Thanks for the suggestion.\n"},{"id":"476397","messageId":"CABPp-BEoCtmSwicpukd8SQZaL7ffTAW6su0mys3tXapr1UufEw@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86v8hchuay.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 16/22] treewide: remove cache.h inclusion due to previous changes","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T01:25:00Z","receivedAt":"2023-05-02T01:25:22Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 9:48 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n>\n> The \"Subject\" says \"due to previous changes\", but...\n>\n> > From: Elijah Newren <newren@gmail.com>\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n> > ---\n> >  archive-zip.c                 | 2 +-\n> >  bundle-uri.c                  | 2 +-\n> >  color.c                       | 2 +-\n> >  combine-diff.c                | 2 +-\n> >  common-main.c                 | 2 +-\n> >  config.c                      | 2 +-\n> >  copy.c                        | 2 +-\n> >  credential.c                  | 2 +-\n> >  daemon.c                      | 2 +-\n> >  date.c                        | 2 +-\n> >  diagnose.c                    | 2 +-\n> >  environment.c                 | 2 +-\n> >  ll-merge.c                    | 2 +-\n> >  match-trees.c                 | 2 +-\n> >  midx.c                        | 2 +-\n> >  object-file.c                 | 2 +-\n> >  packfile.c                    | 2 +-\n> >  pkt-line.c                    | 2 +-\n> >  range-diff.c                  | 2 +-\n> >  ref-filter.c                  | 2 +-\n> >  t/helper/test-match-trees.c   | 1 -\n> >  t/helper/test-mergesort.c     | 1 -\n> >  t/helper/test-oid-array.c     | 1 -\n> >  t/helper/test-oidtree.c       | 1 -\n> >  t/helper/test-parse-options.c | 1 -\n> >  t/helper/test-read-midx.c     | 1 -\n> >  t/helper/test-string-list.c   | 1 -\n> >  tree-diff.c                   | 2 +-\n> >  tree-walk.c                   | 2 +-\n> >  tree.c                        | 2 +-\n> >  wrapper.c                     | 3 ++-\n> >  31 files changed, 25 insertions(+), 31 deletions(-)\n> >\n> > diff --git a/archive-zip.c b/archive-zip.c\n> > index ef538a90df4..d0d065a312e 100644\n> > --- a/archive-zip.c\n> > +++ b/archive-zip.c\n> > @@ -1,7 +1,7 @@\n> >  /*\n> >   * Copyright (c) 2006 Rene Scharfe\n> >   */\n> > -#include \"cache.h\"\n> > +#include \"git-compat-util.h\"\n> >  #include \"config.h\"\n> >  #include \"archive.h\"\n> >  #include \"gettext.h\"\n>\n> I tried making this change before this series was applied, and\n> everything compiled...\n\nYeah, this actually could have been done as part of b7b189cd5ae\n(\"treewide: reduce includes of cache.h in other headers\", 2023-04-11),\nwhich was from the series before this one.\n\n> > diff --git a/bundle-uri.c b/bundle-uri.c\n> > index 6d44662ee1f..ec1552bbca2 100644\n> > --- a/bundle-uri.c\n> > +++ b/bundle-uri.c\n> > @@ -1,4 +1,4 @@\n> > -#include \"cache.h\"\n> > +#include \"git-compat-util.h\"\n> >  #include \"bundle-uri.h\"\n> >  #include \"bundle.h\"\n> >  #include \"copy.h\"\n>\n> That's not the case here, but this could instead be squashed into the\n> 05/22 in this series, i.e. as soon as we add this copy.h, we don't need\n> cache.h anymore.\n>\n> > diff --git a/color.c b/color.c\n> > index f8a25ca807b..83abb11eda0 100644\n> > --- a/color.c\n> > +++ b/color.c\n> > @@ -1,4 +1,4 @@\n> > -#include \"cache.h\"\n> > +#include \"git-compat-util.h\"\n> >  #include \"config.h\"\n> >  #include \"color.h\"\n> >  #include \"editor.h\"\n>\n> I did not look further, but all of the rest of these look like they'd be\n> better off squashed into the respective \"split this out\" commit. I don't\n> think keeping the \"move declarations for ...\" as \"move-only\" commits is\n> worth it, as opposed to getting rid of this one, and making those\n> atomic.\n\nSo, while that could be done, I found it harder to review my own\nchanges personally, and thought others would as well.  If you're\nlooking through several dozen files for a single change (add one new\nheader), it's easy to fly through and be confident you didn't miss\nanything, but when there are sometimes two changes (also replace\ncache.h with git-compat-util.h, or just outright remove it if\ngit-compat-util.h is already included), then that slows review down\ndramatically.\n\nIn the previous series, I addressed this by splitting each patch into\ntwo -- (1) move declarations to new header and add new relevant\ninclude, (2) remove the cache.h includes that was allowed by that\nchange.  See patches 7-18 at\nhttps://lore.kernel.org/git/pull.1509.git.1680361837.gitgitgadget@gmail.com/#r\n.\n\nBut having half a dozen commits labelled \"treewide: remove cache.h\ninclusion due to header changes in previous patch\", seemed like a bit\nof a pain too.  So I instead batched them up and did them all at once.\nI could revert back to how I did it in the previous series, but I\nthink I'd want to keep the commits that are adding a new header\nseparate from the ones that remove includes of cache.h.\n"},{"id":"476398","messageId":"CABPp-BEjYwVKVXzjmC00rFtiXOPCz6QihCS+RfR_BB8wbFJdZQ@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86r0s0hu7a.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 17/22] cache.h: remove unnecessary headers","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T01:43:00Z","receivedAt":"2023-05-02T01:44:39Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 9:50 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n>\n> > From: Elijah Newren <newren@gmail.com>\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n> > ---\n> >  cache.h                              | 2 --\n> >  compat/fsmonitor/fsm-ipc-darwin.c    | 1 +\n> >  compat/fsmonitor/fsm-listen-darwin.c | 1 +\n> >  3 files changed, 2 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/cache.h b/cache.h\n> > index 591c67b0595..bdedb87e83b 100644\n> > --- a/cache.h\n> > +++ b/cache.h\n> > @@ -4,8 +4,6 @@\n> >  #include \"git-compat-util.h\"\n> >  #include \"strbuf.h\"\n> >  #include \"hashmap.h\"\n> > -#include \"gettext.h\"\n> > -#include \"string-list.h\"\n> >  #include \"pathspec.h\"\n> >  #include \"object.h\"\n> >  #include \"statinfo.h\"\n> > diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c\n> > index e62f093cc19..bc68dca0cae 100644\n> > --- a/compat/fsmonitor/fsm-ipc-darwin.c\n> > +++ b/compat/fsmonitor/fsm-ipc-darwin.c\n> > @@ -1,5 +1,6 @@\n> >  #include \"cache.h\"\n> >  #include \"config.h\"\n> > +#include \"gettext.h\"\n> >  #include \"hex.h\"\n> >  #include \"repository.h\"\n> >  #include \"strbuf.h\"\n> > diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\n> > index 5eb6402ab82..18c0e3913dc 100644\n> > --- a/compat/fsmonitor/fsm-listen-darwin.c\n> > +++ b/compat/fsmonitor/fsm-listen-darwin.c\n> > @@ -29,6 +29,7 @@\n> >  #include \"fsmonitor--daemon.h\"\n> >  #include \"fsmonitor-path-utils.h\"\n> >  #include \"gettext.h\"\n> > +#include \"string-list.h\"\n> >\n> >  struct fsm_listen_data\n> >  {\n>\n> If I rebase this topic to make this the first commit everything\n> compiles, i.e. nothing here relies on what came before.\n>\n> Given the extensive earlier moves I think it would be better to first\n> remove unnecessary includes from cache.h, before starting to split it\n> up.\n\nInteresting.  I originally had this patch earlier as you proposed, but\nin writing the cover letter found it made it simpler to explain the\nhigh level overview by moving it.  It's really nice to be able to say,\n\"this series continues to focus on splitting declarations from cache.h\nto separate headers...and then makes other cleanups I found while\ndoing that\", which naturally suggested the opposite ordering from what\nI originally had.\n"},{"id":"476400","messageId":"CABPp-BGOAd=CY2vrd-GjFzk-889MukKX1nbwwi5+9F+UC0aWuw@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86mt2ohtt0.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 19/22] commit.h: reduce unnecessary includes","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T01:53:00Z","receivedAt":"2023-05-02T01:54:51Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 9:59 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n>\n> > From: Elijah Newren <newren@gmail.com>\n>\n> Re earlier comments: If I rebase to make this the first commit\n> everything compiles, i.e. nothing here relied on the earlier split-offs\n> of cache.h into other headers.\n>\n> You need to make a choice of whether to first split out cache.h, and\n> then do commits like these, or the other way around.\n>\n> I'm not sure whether it's better to do it the other way around. If you\n> do that it's clear e.g. add-interactive.c's implicit dependency on\n> tree.h via commit.h has nothing to do with what would be the subsequent\n> split-up of cache.h.\n>\n> Or maybe this is fine. I'm just trying to get some picture of what\n> depends on what in this series...\n\nYes, there is some freedom about the ordering of patches, and I had to\nmake a choice.\n\nI found a number of the cleanups like this one for commit.h\ninterspersed with the other changes, but I intentionally grouped them\nat the end to get a good high level overview, namely:\n\n(A) Continue splitting declarations from cache.h to separate headers\n(B) Do other header cleanups found during that work\n\nI could have reversed the order, but since the series was motivated\nand organized around (A), it made more sense to me to put those\npatches first.\n\nBesides, the last time I moved a few miscellaneous cleanup patches to\nthe front of the series, someone else responded thinking the purpose\nand motivation was about those first few patches[1], so I wanted to\navoid a repeat of that problem.  ;-)\n\n[1] https://lore.kernel.org/git/CABPp-BFZBWTG1VF6N8teVMYxoUdOeciKGwPq1g-G1K5--My5uQ@mail.gmail.com/\n"},{"id":"476401","messageId":"CABPp-BF42SuEObGqcVH0oQLYscrwoScg0TLuQRY7ZnNAhYTV8w@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86ildcht9c.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 20/22] object-store.h: reduce unnecessary includes","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T02:28:00Z","receivedAt":"2023-05-02T02:28:39Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 10:10 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n>\n> > From: Elijah Newren <newren@gmail.com>\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n> > ---\n> >  object-file.c      | 1 +\n> >  object-name.c      | 1 +\n> >  object-store.h     | 8 ++++----\n> >  submodule-config.c | 1 +\n> >  4 files changed, 7 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/object-file.c b/object-file.c\n> > index 8e0df7360ae..921a717d8a5 100644\n> > --- a/object-file.c\n> > +++ b/object-file.c\n> > @@ -38,6 +38,7 @@\n> >  #include \"packfile.h\"\n> >  #include \"object-file.h\"\n> >  #include \"object-store.h\"\n> > +#include \"oidtree.h\"\n> >  #include \"promisor-remote.h\"\n> >  #include \"setup.h\"\n> >  #include \"submodule.h\"\n> > diff --git a/object-name.c b/object-name.c\n> > index 5ccbe854b60..88d839f70bc 100644\n> > --- a/object-name.c\n> > +++ b/object-name.c\n> > @@ -14,6 +14,7 @@\n> >  #include \"remote.h\"\n> >  #include \"dir.h\"\n> >  #include \"oid-array.h\"\n> > +#include \"oidtree.h\"\n> >  #include \"packfile.h\"\n> >  #include \"pretty.h\"\n> >  #include \"object-store.h\"\n> > diff --git a/object-store.h b/object-store.h\n> > index f9d225783ae..23ea86d3702 100644\n> > --- a/object-store.h\n> > +++ b/object-store.h\n> > @@ -2,16 +2,16 @@\n> >  #define OBJECT_STORE_H\n> >\n> >  #include \"object.h\"\n> > -#include \"oidmap.h\"\n> >  #include \"list.h\"\n> > -#include \"oid-array.h\"\n>\n> It seems to me that this should be split up, there does seem to be an\n> unnecessary include here, as the subject claims, at least the\n> \"oid-array.h include in object-store.h seems to qualify.\n>\n> Maybe the same applies to thread-utils.h below?\n\nRemoving the thread-utils.h inclusion from object-store.h will break\ncompilation on non-linux platforms; that header is needed for the\ndefinition of pthread_mutex_t used later in the file.\n\n> > -#include \"strbuf.h\"\n> >  #include \"thread-utils.h\"\n> >  #include \"khash.h\"\n> >  #include \"dir.h\"\n> > -#include \"oidtree.h\"\n> >  #include \"oidset.h\"\n> >\n> > +struct oidmap;\n> > +struct oidtree;\n> > +struct strbuf;\n>\n> But as this shows at least three of these weren't unnecessary, you're\n> just replacing them with forward-decls.\n\nSomething was necessary, yes, but an #include statement certainly\nwasn't.  Here, nothing would need to be recompiled if those other\nheaders changed, so the include is unnecessary.\n\n> I think that's probably sensible, but I think it should at least be\n> discussed.\n\nWe have now discussed it.  :-)\n\nDid you want a simple call-out in the commit message, e.g. \"Replace\nthe includes with simple forward declarations of the relevant\nstructs.\" ?\n\n> It's also not clear why we want to just stop at forward-declaring\n> structs, maybe replacing the dir.h include with:\n>\n>         int fspatheq(const char *a, const char *b);\n>         unsigned int fspathhash(const char *str);\n\nI don't like the idea of having to update function signatures in 3 or\nmore places when we need to make changes.  In contrast, forward\ndeclarations of structs aren't susceptible to the same need to\nupdate while making other changes.\n\nWe have hundreds of forward declarations of structs in the code;\neveryone seems to be fine with them.\n\nWhenever we've had duplicate declarations of functions, it's been\ntreated as a code smell that we've gotten rid of when possible.  In\nfact, in v2.40.0, by my search we only had two of these --\nxdl_emit_diff() and read_in_full().  And we've since gotten rid of one\nof those (namely, read_in_full()).\n\n> Would be too verbose, but if we did that we'd spot that\n> e.g. match-trees.c is relying on this header to get its \"struct strbuf\"\n> definition.\n>\n> I'm perfectly fine to leave that can of worms for some later date\n> though...\n\nThat's a good find; I also found it separately later in some follow-on\npatches so I'll also vote for leaving that can of worms for a later\ndate.  :-)\n\n\nAnd thanks for carefully reading through this series!\n"},{"id":"476402","messageId":"CABPp-BHv93VsAZ8=jzDPcNXOyZ1W4Fhf14gusvEp_i9XYE-Xhg@mail.gmail.com","threadId":"59603","inReplyTo":"230501.86a5yohsme.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T02:53:00Z","receivedAt":"2023-05-02T02:54:25Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 10:24 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n>\n> > From: Elijah Newren <newren@gmail.com>\n> >\n> > [...]\n> > diff --git a/checkout.h b/checkout.h\n> > index 1917f3b3230..3c514a5ab4f 100644\n> > --- a/checkout.h\n> > +++ b/checkout.h\n> > @@ -1,7 +1,7 @@\n> >  #ifndef CHECKOUT_H\n> >  #define CHECKOUT_H\n> >\n> > -#include \"hash.h\"\n> > +#include \"hash-ll.h\"\n>\n> The end-state of this topic is oddly inconsistent in when it uses\n> includes, and when it uses forward declarations.\n>\n> As I note in a reply to 20/22 you're adding forward declares there, I\n> think that's fine, but if you opdet for that why not do that here. The\n> body of this header only defines one function, which takes a pointer to\n> a \"struct object_id\".\n>\n> Whereas above you did this change:\n>\n> > diff --git a/apply.h b/apply.h\n> > index b9f18ce87d1..7cd38b1443c 100644\n> > --- a/apply.h\n> > +++ b/apply.h\n> > @@ -1,7 +1,7 @@\n> >  #ifndef APPLY_H\n> >  #define APPLY_H\n> >\n> > -#include \"hash.h\"\n> > +#include \"hash-ll.h\"\n> >  #include \"lockfile.h\"\n> >  #include \"string-list.h\"\n> >  #include \"strmap.h\"\n>\n> There we really should include it, as we're not dealing with a pointer\n> to the \"struct object_id\", but the struct itself, so we need its\n> definition, and don't want to find it implicitly.\n>\n> > diff --git a/chunk-format.h b/chunk-format.h\n> > index 025c38f938e..c7794e84add 100644\n> > --- a/chunk-format.h\n> > +++ b/chunk-format.h\n> > @@ -1,7 +1,7 @@\n> >  #ifndef CHUNK_FORMAT_H\n> >  #define CHUNK_FORMAT_H\n> >\n> > -#include \"hash.h\"\n> > +#include \"hash-ll.h\"\n> >\n> >  struct hashfile;\n> >  struct chunkfile;\n>\n> Then we have this, where we seemingly could avoid the include as well,\n> and just add a:\n>\n>         struct git_hash_algo;\n>\n> Anyway, I'm not saying one is better than the other, I'm just wondering\n> why you're picking one, but not the other.\n\nBasically, just because I updated all the includes through:\n   $ git grep include..hash.h | xargs sed -i s/hash.h/hash-ll.h/\nand then tried to compile and fixed up the files that had errors\n(usually by making it include hash.h rather than hash-ll.h).  Every\nonce in a while I might have noticed that a simpler forward-declare\nwas sufficient but I didn't always look for it.\n\nAnyway, thanks for looking closely and pointing this one out!\nSwitching this to a forward declaration is another nice cleanup to add\n(though perhaps to a future series, as this one is long enough).\n\n> Is it because you know that hash-ll.h doesn't bring in other headers, so\n> its inclusion is OK, whereas later in e.g. 20/22 you avoid including\n> strbuf.h, because you know that'll bring in string-list.h?\n\nNo, it's more \"we gotta start somewhere, and stop well short of\ncomplete for the series to be reviewable\".\n\nIt's really easy to look at pieces of this series and notice all kinds\nof additional cleanups that are possible:\n  * Emily pointed out that if we're moving a global to a new header,\nwhy not update the code to just delete the global?\n  * Calvin pointed out that git-compat-util.h had become a dumping\nground too and needed cleaning.\n  * Glen pointed out that some of my reasons for splitting between\nhash-ll.h and hash.h would suggest, based on function definitions,\nthat 2 of the declarations should move back to hash.h.\n  * You've pointed out multiple good additional cleanups in your review so far\n  * I had an ongoing list of dozens of types of changes to make while\nworking on this and prior series.\n\nAnyone who looks at this series is going to spot additional \"what\nabout this?\" things.  They're all great.  But I picked some cleanups\nto make, and carried those through.  Because of how I did those\ncleanups (note my grep & sed command above, followed by\nrecompile/edit/repeat cycle), I noticed some additional cleanups that\nare likely different than what someone else reviewing them will\nnotice.  Some of the additional cleanups I noticed are in this series,\nbut most are delayed for some future series.\n\n> If that's the case maybe we should just move\n> strbuf_add_separated_string_list() into some \"used by merge-ort.c and\n> merge-recursive.c\" file, remove the string-list.h includion from\n> strbuf.h, and then include \"strbuf.h\" without fearing the side-effects\n> elsewhere?\n\nOoh, nice catch.  If that function is only used by those two files, it\nshould be moved to merge-recursive.h (merge-ort.c includes that\ncurrently).  However, Calvin is doing a bunch of work refactoring\nstrbuf.[ch], and I told him I'd avoid touching it to reduce conflicts\nwith his in-progress work.  So, I'll let him tackle this one in his\nseries.\n"},{"id":"476409","messageId":"CABPp-BHymt9COEjnTRTbg_vHa4s6-CL7Bh+9q0PfoiE0SRcRrg@mail.gmail.com","threadId":"59603","inReplyTo":"CABPp-BEPy4R1R1X1o1oMs6sEECVjEoLeRXripEi7k8ZO-CrbuA@mail.gmail.com","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T05:00:14Z","receivedAt":"2023-05-02T05:00:34Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 1, 2023 at 6:06 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> On Mon, May 1, 2023 at 9:35 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> >\n> > On Sat, Apr 22 2023, Elijah Newren via GitGitGadget wrote:\n> [...]\n> > > --- a/tree-diff.c\n> > > +++ b/tree-diff.c\n> > > @@ -6,6 +6,19 @@\n> > >  #include \"diffcore.h\"\n> > >  #include \"tree.h\"\n> > >\n> > > +/*\n> > > + * Some mode bits are also used internally for computations.\n> > > + *\n> > > + * They *must* not overlap with any valid modes, and they *must* not be emitted\n> > > + * to outside world - i.e. appear on disk or network. In other words, it's just\n> > > + * temporary fields, which we internally use, but they have to stay in-house.\n> > > + *\n> > > + * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git\n> > > + *   codebase mode is `unsigned int` which is assumed to be at least 32 bits )\n> > > + */\n> > > +\n> > > +#define S_DIFFTREE_IFXMIN_NEQ        0x80000000\n> > > +\n> > >  /*\n> > >   * internal mode marker, saying a tree entry != entry of tp[imin]\n> > >   * (see ll_diff_tree_paths for what it means there)\n> >\n> > As it's only used in tree-diff.c, should this change not be instead\n> > changing how we define S_IFXMIN_NEQ itself, and combining the two\n> > comments seen here (the latter only partially, in the context).\n> >\n> > Not that this makes things worse or anything...\n>\n> Hmm, that makes sense; I'll make the tweak.  Thanks for the suggestion.\n\nAlthough maybe I'll have to do it in a follow-on series?  Junio merged\nthe series to next today, so...I guess I'll just add it to my \"header\ncleanups\" notes.\n"},{"id":"476428","messageId":"xmqqr0ry20d1.fsf@gitster.g","threadId":"59603","inReplyTo":"CABPp-BHymt9COEjnTRTbg_vHa4s6-CL7Bh+9q0PfoiE0SRcRrg@mail.gmail.com","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-05-02T15:56:26Z","receivedAt":"2023-05-02T15:56:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> Although maybe I'll have to do it in a follow-on series?  Junio merged\n> the series to next today, so...I guess I'll just add it to my \"header\n> cleanups\" notes.\n\nI am not Ævar, but it is so small a thing that is local to a single\nfile, we can wait until the dust settles to avoid distraction.\n"},{"id":"476430","messageId":"CABPp-BHUQQi6A3uvDBuefYkC3puyP7zjtKJ6kXWyCOj+yWGb=w@mail.gmail.com","threadId":"59603","inReplyTo":"xmqqr0ry20d1.fsf@gitster.g","subject":"Re: [PATCH v2 12/22] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-05-02T15:59:40Z","receivedAt":"2023-05-02T16:00:00Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, May 2, 2023 at 8:56 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Elijah Newren <newren@gmail.com> writes:\n>\n> > Although maybe I'll have to do it in a follow-on series?  Junio merged\n> > the series to next today, so...I guess I'll just add it to my \"header\n> > cleanups\" notes.\n>\n> I am not Ævar, but it is so small a thing that is local to a single\n> file, we can wait until the dust settles to avoid distraction.\n\nYup, sounds good to me.  :-)\n\nI've got it on my todo list for continued cleanups.\n"}]}