{"thread":{"id":"59412","subject":"[PATCH 00/16] Header cleanups","startedAt":"2023-03-19T06:28:16Z","lastAt":"2023-03-21T21:58:25Z","messageCount":37,"participants":["Elijah Newren via GitGitGadget","Ævar Arnfjörð Bjarmason","Elijah Newren","Jonathan Tan"],"isPatch":true,"patchVersion":1,"patchTotal":16},"messages":[{"id":"473707","messageId":"pull.1493.git.1679207282.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":null,"subject":"[PATCH 00/16] Header cleanups","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:46Z","receivedAt":"2023-03-19T06:28:16Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Maintainer note: I dropped multiple changes from this series to avoid\nconflicts with other in-flight series, but two small conflicts remain. In\norder to merge with next, add the following declaration to abspath.h:\n\n    /* Likewise, but path==\"-\" always yields \"-\" */\n    char *prefix_filename_except_for_dash(const char *prefix, const char *path);\n\n\n(from cache.h) and remove the entire conflicted region in cache.h. There is\nalso a semantic conflict with seen; to fix, include abspath.h in the new\nfile compat/fsmonitor/fsm-path-utils-linux.c.\n\nThis series picks up where en/header-cleanups leaves off and does more\nheader cleanups, trying to reduce the number of files depending on cache.h.\n(There are still more that could be done, but again, this is a good chunk\nfor now.)\n\nNotes:\n\n * As I mentioned in my last series, Dscho's gitgitgadget is super helpful\n   for a series like this.\n * As with my previous series (en/header-cleanup), I used the scripts at my\n   header-cleanup-scripts branch\n   [https://github.com/newren/git/commit/db81c8d7fb554b3edf04320e218bddeb98bb6194],\n   and some tweaks thereof, repeatedly while making this series (though they\n   are prone to produce both false positive and false negatives, so if you\n   use them, only use them to generate hints about which files to look at).\n\nElijah Newren (16):\n  treewide: remove unnecessary cache.h inclusion from a few headers\n  treewide: be explicit about dependence on gettext.h\n  treewide: remove unnecessary inclusion of gettext.h\n  treewide: remove unnecessary cache.h inclusion from several sources\n  environment: move comment_line_char from cache.h\n  abspath.h: move absolute path functions from cache.h\n  cache.h: remove expand_user_path()\n  path.h: move function declarations for path.c functions from cache.h\n  wrapper.h: move declarations for wrapper.c functions from cache.h\n  treewide: remove unnecessary includes of cache.h\n  environment.h: move declarations for environment.c functions from\n    cache.h\n  treewide: remove cache.h inclusion due to environment.h changes\n  setup.h: move declarations for setup.c functions from cache.h\n  treewide: remove cache.h inclusion due to setup.h changes\n  write-or-die.h: move declarations for write-or-die.c functions from\n    cache.h\n  csum-file.h: remove unnecessary inclusion of cache.h\n\n abspath.c                                    |   4 +-\n abspath.h                                    |  30 +\n add-interactive.c                            |   1 +\n add-patch.c                                  |   2 +\n apply.c                                      |   5 +\n archive-tar.c                                |   2 +\n archive-zip.c                                |   2 +\n archive.c                                    |   4 +\n attr.c                                       |   3 +\n bisect.c                                     |   2 +\n blame.c                                      |   2 +\n branch.c                                     |   2 +\n builtin/add.c                                |   1 +\n builtin/am.c                                 |   4 +\n builtin/apply.c                              |   1 +\n builtin/archive.c                            |   1 +\n builtin/bisect.c                             |   3 +\n builtin/blame.c                              |   4 +\n builtin/branch.c                             |   3 +\n builtin/bugreport.c                          |   5 +-\n builtin/bundle.c                             |   3 +\n builtin/cat-file.c                           |   3 +\n builtin/check-attr.c                         |   4 +\n builtin/check-ignore.c                       |   2 +\n builtin/check-mailmap.c                      |   2 +\n builtin/check-ref-format.c                   |   1 +\n builtin/checkout--worker.c                   |   1 +\n builtin/checkout-index.c                     |   2 +\n builtin/checkout.c                           |   3 +\n builtin/clean.c                              |   3 +\n builtin/clone.c                              |   4 +\n builtin/column.c                             |   1 +\n builtin/commit-graph.c                       |   2 +\n builtin/commit-tree.c                        |   1 +\n builtin/commit.c                             |   2 +\n builtin/config.c                             |   5 +\n builtin/count-objects.c                      |   2 +\n builtin/credential-cache--daemon.c           |   2 +\n builtin/credential-cache.c                   |   3 +\n builtin/credential-store.c                   |   2 +\n builtin/describe.c                           |   3 +\n builtin/diagnose.c                           |   2 +\n builtin/diff-index.c                         |   1 +\n builtin/diff-tree.c                          |   1 +\n builtin/diff.c                               |   2 +\n builtin/difftool.c                           |   5 +\n builtin/fast-export.c                        |   1 +\n builtin/fast-import.c                        |   4 +\n builtin/fetch-pack.c                         |   1 +\n builtin/fetch.c                              |   2 +\n builtin/fmt-merge-msg.c                      |   2 +\n builtin/for-each-ref.c                       |   1 +\n builtin/for-each-repo.c                      |   1 +\n builtin/fsck.c                               |   1 +\n builtin/fsmonitor--daemon.c                  |   3 +\n builtin/gc.c                                 |   5 +\n builtin/get-tar-commit-id.c                  |   1 +\n builtin/grep.c                               |   3 +\n builtin/hash-object.c                        |   4 +\n builtin/help.c                               |   2 +\n builtin/hook.c                               |   1 +\n builtin/index-pack.c                         |   4 +\n builtin/init-db.c                            |   5 +\n builtin/interpret-trailers.c                 |   1 +\n builtin/log.c                                |   4 +\n builtin/ls-files.c                           |   2 +\n builtin/ls-remote.c                          |   1 +\n builtin/ls-tree.c                            |   1 +\n builtin/mailinfo.c                           |   3 +\n builtin/mailsplit.c                          |   1 +\n builtin/merge-base.c                         |   1 +\n builtin/merge-file.c                         |   3 +\n builtin/merge-recursive.c                    |   1 +\n builtin/merge-tree.c                         |   1 +\n builtin/merge.c                              |   4 +\n builtin/mktag.c                              |   1 +\n builtin/mktree.c                             |   1 +\n builtin/multi-pack-index.c                   |   3 +\n builtin/mv.c                                 |   4 +\n builtin/name-rev.c                           |   2 +\n builtin/notes.c                              |   2 +\n builtin/pack-objects.c                       |   3 +\n builtin/pack-redundant.c                     |   1 +\n builtin/pack-refs.c                          |   1 +\n builtin/patch-id.c                           |   1 +\n builtin/prune-packed.c                       |   1 +\n builtin/prune.c                              |   2 +\n builtin/pull.c                               |   1 +\n builtin/push.c                               |   2 +\n builtin/range-diff.c                         |   1 +\n builtin/read-tree.c                          |   2 +\n builtin/rebase.c                             |   4 +\n builtin/receive-pack.c                       |   4 +\n builtin/reflog.c                             |   1 +\n builtin/remote.c                             |   1 +\n builtin/repack.c                             |   2 +\n builtin/replace.c                            |   2 +\n builtin/rerere.c                             |   2 +\n builtin/reset.c                              |   3 +\n builtin/rev-list.c                           |   2 +\n builtin/rev-parse.c                          |   4 +\n builtin/revert.c                             |   1 +\n builtin/rm.c                                 |   2 +\n builtin/send-pack.c                          |   1 +\n builtin/shortlog.c                           |   3 +\n builtin/show-branch.c                        |   2 +\n builtin/show-index.c                         |   1 +\n builtin/show-ref.c                           |   1 +\n builtin/sparse-checkout.c                    |   3 +\n builtin/stash.c                              |   4 +\n builtin/stripspace.c                         |   3 +\n builtin/submodule--helper.c                  |   4 +\n builtin/symbolic-ref.c                       |   1 +\n builtin/tag.c                                |   3 +\n builtin/unpack-file.c                        |   1 +\n builtin/unpack-objects.c                     |   2 +\n builtin/update-index.c                       |   4 +\n builtin/update-ref.c                         |   1 +\n builtin/update-server-info.c                 |   1 +\n builtin/upload-pack.c                        |   1 +\n builtin/verify-commit.c                      |   1 +\n builtin/verify-pack.c                        |   1 +\n builtin/verify-tag.c                         |   1 +\n builtin/worktree.c                           |   4 +\n builtin/write-tree.c                         |   2 +\n bulk-checkin.c                               |   4 +-\n bulk-checkin.h                               |   2 +-\n bundle-uri.c                                 |   2 +\n bundle.c                                     |   3 +\n bundle.h                                     |   1 -\n cache-tree.c                                 |   3 +-\n cache.h                                      | 568 -------------------\n chdir-notify.c                               |   1 +\n chunk-format.c                               |   2 +\n color.c                                      |   1 +\n combine-diff.c                               |   1 +\n commit-graph.c                               |   4 +-\n commit.c                                     |   3 +\n common-main.c                                |   2 +\n compat/disk.h                                |   2 +\n compat/fsmonitor/fsm-health-win32.c          |   1 +\n compat/fsmonitor/fsm-listen-darwin.c         |   1 +\n compat/fsmonitor/fsm-listen-win32.c          |   1 +\n compat/fsmonitor/fsm-path-utils-darwin.c     |   1 +\n compat/fsmonitor/fsm-path-utils-win32.c      |   1 +\n compat/linux/procinfo.c                      |   2 +-\n compat/mingw.c                               |   4 +\n compat/precompose_utf8.c                     |   2 +\n compat/simple-ipc/ipc-shared.c               |   2 +-\n compat/simple-ipc/ipc-unix-socket.c          |   1 +\n compat/simple-ipc/ipc-win32.c                |   2 +\n compat/terminal.c                            |   4 +-\n config.c                                     |   7 +-\n connect.c                                    |   2 +\n connected.c                                  |   3 +-\n convert.c                                    |   2 +\n copy.c                                       |   1 +\n credential.c                                 |   2 +\n csum-file.c                                  |   3 +-\n csum-file.h                                  |   2 +-\n daemon.c                                     |   4 +\n date.c                                       |   1 +\n delta-islands.c                              |   3 +-\n diagnose.c                                   |   2 +\n diff-lib.c                                   |   1 +\n diff-no-index.c                              |   2 +\n diff.c                                       |   5 +\n dir.c                                        |   5 +\n editor.c                                     |   3 +\n entry.c                                      |   3 +\n environment.c                                |   5 +\n environment.h                                | 220 +++++++\n exec-cmd.c                                   |   3 +\n fetch-pack.c                                 |   5 +-\n fmt-merge-msg.c                              |   3 +-\n fsck.c                                       |   2 +-\n fsmonitor-ipc.c                              |   1 +\n fsmonitor.c                                  |   1 +\n gettext.c                                    |   4 +-\n git.c                                        |   3 +\n gpg-interface.c                              |   6 +-\n grep.c                                       |   3 +-\n http-backend.c                               |   5 +-\n http-fetch.c                                 |   2 +\n http-push.c                                  |   2 +\n imap-send.c                                  |   3 +\n line-log.c                                   |   2 +-\n list-objects-filter-options.h                |   1 +\n list-objects-filter.c                        |   1 +\n list-objects.c                               |   1 +\n ll-merge.c                                   |   1 +\n lockfile.c                                   |   4 +-\n log-tree.c                                   |   2 +\n ls-refs.c                                    |   4 +-\n mailmap.c                                    |   2 +\n merge-ort-wrappers.c                         |   1 +\n merge-ort.c                                  |   2 +\n merge-recursive.c                            |   3 +\n merge.c                                      |   1 +\n midx.c                                       |   4 +-\n name-hash.c                                  |   2 +\n negotiator/default.c                         |   2 +-\n negotiator/skipping.c                        |   2 +-\n notes-cache.c                                |   2 +-\n notes-merge.c                                |   2 +\n notes-utils.c                                |   4 +-\n notes.c                                      |   1 +\n object-file.c                                |   7 +-\n object-name.c                                |   3 +\n object.c                                     |   1 +\n pack-bitmap-write.c                          |   5 +-\n pack-bitmap.c                                |   3 +-\n pack-check.c                                 |   1 +\n pack-mtimes.c                                |   3 +-\n pack-revindex.c                              |   1 +\n pack-write.c                                 |   2 +\n pack.h                                       |   2 +\n packfile.c                                   |   5 +-\n packfile.h                                   |   4 +-\n parallel-checkout.c                          |   2 +\n parse-options-cb.c                           |   2 +\n parse-options.c                              |   3 +-\n parse-options.h                              |   2 +\n patch-ids.c                                  |   2 +-\n path.c                                       |   6 +-\n path.h                                       |  62 +-\n pathspec.c                                   |   4 +\n pkt-line.c                                   |   3 +\n preload-index.c                              |   2 +\n pretty.c                                     |   2 +\n progress.c                                   |   1 -\n promisor-remote.c                            |   1 +\n prompt.c                                     |   3 +-\n protocol.c                                   |   1 +\n prune-packed.c                               |   2 +\n range-diff.c                                 |   2 +\n reachable.c                                  |   3 +-\n read-cache.c                                 |   3 +\n rebase-interactive.c                         |   3 +\n ref-filter.c                                 |   4 +-\n ref-filter.h                                 |   1 +\n reflog.c                                     |   3 +-\n refs.c                                       |   6 +-\n refs.h                                       |   1 -\n refs/files-backend.c                         |   7 +-\n refs/iterator.c                              |   2 +-\n refs/packed-backend.c                        |   4 +-\n refspec.c                                    |   1 +\n remote-curl.c                                |   4 +\n remote.c                                     |   6 +-\n replace-object.c                             |   3 +-\n repository.c                                 |   2 +\n rerere.c                                     |   3 +\n rerere.h                                     |   1 +\n reset.c                                      |   1 +\n revision.c                                   |   3 +\n run-command.c                                |   2 +\n scalar.c                                     |   2 +\n send-pack.c                                  |   4 +-\n sequencer.c                                  |   4 +\n server-info.c                                |   4 +-\n setup.c                                      |   4 +\n setup.h                                      | 168 ++++++\n shallow.c                                    |   3 +-\n sideband.c                                   |   2 +\n sparse-index.c                               |   2 +\n split-index.c                                |   1 +\n strbuf.c                                     |   6 +-\n streaming.c                                  |   2 +\n streaming.h                                  |   4 +-\n submodule-config.c                           |   2 +\n submodule.c                                  |   6 +-\n symlinks.c                                   |   2 +\n t/helper/test-advise.c                       |   2 +-\n t/helper/test-bitmap.c                       |   3 +-\n t/helper/test-bloom.c                        |   4 +-\n t/helper/test-bundle-uri.c                   |   1 +\n t/helper/test-cache-tree.c                   |   2 +\n t/helper/test-config.c                       |   2 +-\n t/helper/test-delta.c                        |   2 +-\n t/helper/test-dump-cache-tree.c              |   2 +-\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-split-index.c             |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-fast-rebase.c                  |   5 +-\n t/helper/test-fsmonitor-client.c             |   2 +\n t/helper/test-hash.c                         |   1 -\n t/helper/test-lazy-init-name-hash.c          |   2 +\n t/helper/test-match-trees.c                  |   1 +\n t/helper/test-oid-array.c                    |   1 +\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   1 +\n t/helper/test-pack-mtimes.c                  |   2 +-\n t/helper/test-parse-pathspec-file.c          |   1 -\n t/helper/test-partial-clone.c                |   4 +-\n t/helper/test-path-utils.c                   |   3 +\n t/helper/test-pkt-line.c                     |   3 +-\n t/helper/test-proc-receive.c                 |   4 +-\n t/helper/test-progress.c                     |   1 -\n t/helper/test-reach.c                        |   3 +\n t/helper/test-read-cache.c                   |   2 +\n t/helper/test-read-graph.c                   |   2 +-\n t/helper/test-read-midx.c                    |   1 +\n t/helper/test-ref-store.c                    |   2 +-\n t/helper/test-repository.c                   |   3 +-\n t/helper/test-revision-walking.c             |   2 +-\n t/helper/test-run-command.c                  |   1 -\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-serve-v2.c                     |   3 +-\n t/helper/test-submodule-config.c             |   1 +\n t/helper/test-submodule-nested-repo-config.c |   2 +-\n t/helper/test-submodule.c                    |   2 +-\n t/helper/test-subprocess.c                   |   2 +-\n t/helper/test-trace2.c                       |   2 +-\n t/helper/test-userdiff.c                     |   2 +-\n t/helper/test-write-cache.c                  |   1 +\n tag.c                                        |   2 +\n tempfile.c                                   |   4 +-\n tmp-objdir.c                                 |   2 +\n trace.c                                      |   4 +\n trace2/tr2_cfg.c                             |   4 +-\n trace2/tr2_cmd_name.c                        |   3 +-\n trace2/tr2_dst.c                             |   4 +-\n trace2/tr2_sid.c                             |   3 +-\n trailer.c                                    |   4 +-\n transport-helper.c                           |   3 +\n transport.c                                  |   4 +-\n transport.h                                  |   1 -\n tree-walk.c                                  |   1 +\n unpack-trees.c                               |   3 +\n upload-pack.c                                |   3 +\n usage.c                                      |   4 +-\n walker.c                                     |   1 +\n worktree.c                                   |   5 +\n wrapper.c                                    |   3 +\n wrapper.h                                    |  36 ++\n write-or-die.c                               |   4 +-\n write-or-die.h                               |  78 +++\n wt-status.c                                  |   3 +\n xdiff-interface.c                            |   2 +-\n 340 files changed, 1308 insertions(+), 666 deletions(-)\n create mode 100644 abspath.h\n create mode 100644 setup.h\n create mode 100644 wrapper.h\n create mode 100644 write-or-die.h\n\n\nbase-commit: 950264636c68591989456e3ba0a5442f93152c1a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1493%2Fnewren%2Fheader-cleanup-2-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1493/newren/header-cleanup-2-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1493\n-- \ngitgitgadget\n"},{"id":"473708","messageId":"a31269a26b31fec345f4207e4ee9da56da326e0c.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 03/16] treewide: remove unnecessary inclusion of gettext.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:49Z","receivedAt":"2023-03-19T06:28:24Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nLooking at things from the opposite angle of the last patch, we had a\nfew files that were including gettext.h and perhaps needed it at some\npoint in history, but no longer require it.  Remove the include.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n progress.c                          | 1 -\n t/helper/test-parse-pathspec-file.c | 1 -\n t/helper/test-progress.c            | 1 -\n t/helper/test-run-command.c         | 1 -\n 4 files changed, 4 deletions(-)\n\ndiff --git a/progress.c b/progress.c\nindex 9b33a2df325..44c784d75f1 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -10,7 +10,6 @@\n \n #define GIT_TEST_PROGRESS_ONLY\n #include \"cache.h\"\n-#include \"gettext.h\"\n #include \"progress.h\"\n #include \"strbuf.h\"\n #include \"trace.h\"\ndiff --git a/t/helper/test-parse-pathspec-file.c b/t/helper/test-parse-pathspec-file.c\nindex b3e08cef4b3..b704690d845 100644\n--- a/t/helper/test-parse-pathspec-file.c\n+++ b/t/helper/test-parse-pathspec-file.c\n@@ -1,7 +1,6 @@\n #include \"test-tool.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n-#include \"gettext.h\"\n \n int cmd__parse_pathspec_file(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-progress.c b/t/helper/test-progress.c\nindex 6cc9735b601..66acb6a06c9 100644\n--- a/t/helper/test-progress.c\n+++ b/t/helper/test-progress.c\n@@ -19,7 +19,6 @@\n  */\n #define GIT_TEST_PROGRESS_ONLY\n #include \"test-tool.h\"\n-#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"progress.h\"\n #include \"strbuf.h\"\ndiff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c\nindex b0d041ec5ff..c0ed8722c87 100644\n--- a/t/helper/test-run-command.c\n+++ b/t/helper/test-run-command.c\n@@ -16,7 +16,6 @@\n #include \"string-list.h\"\n #include \"thread-utils.h\"\n #include \"wildmatch.h\"\n-#include \"gettext.h\"\n \n static int number_callbacks;\n static int parallel_next(struct child_process *cp,\n-- \ngitgitgadget\n\n"},{"id":"473709","messageId":"43457e44b4eaac190ddcafaf95cbc5422df82700.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 05/16] environment: move comment_line_char from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:51Z","receivedAt":"2023-03-19T06:28:24Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThis is one step towards making strbuf.c not depend upon cache.h.\nAdditional steps will follow in subsequent commits.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-patch.c      | 1 +\n builtin/branch.c | 1 +\n builtin/commit.c | 1 +\n builtin/merge.c  | 1 +\n builtin/tag.c    | 1 +\n cache.h          | 7 -------\n commit.c         | 1 +\n environment.h    | 7 +++++++\n fmt-merge-msg.c  | 1 +\n sequencer.c      | 1 +\n strbuf.c         | 1 +\n trailer.c        | 1 +\n wt-status.c      | 1 +\n 13 files changed, 18 insertions(+), 7 deletions(-)\n\ndiff --git a/add-patch.c b/add-patch.c\nindex 7fe6b66d866..780fb30607b 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"add-interactive.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a67a8334d5c..56dbee97d20 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 25575435ad7..42bf20f589c 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -12,6 +12,7 @@\n #include \"cache-tree.h\"\n #include \"color.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex a90ae5d2ddc..2c9da4b23d1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 4f9047783a5..78b3e44e993 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/cache.h b/cache.h\nindex 0221bc6d5c9..4b4c2e17557 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -956,13 +956,6 @@ extern int sparse_expect_files_outside_of_patterns;\n  */\n int use_optional_locks(void);\n \n-/*\n- * The character that begins a commented line in user-editable file\n- * that is subject to stripspace.\n- */\n-extern char comment_line_char;\n-extern int auto_comment_line_char;\n-\n enum log_refs_config {\n \tLOG_REFS_UNSET = -1,\n \tLOG_REFS_NONE = 0,\ndiff --git a/commit.c b/commit.c\nindex 3fdfb325117..f88fc5e1a2c 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -2,6 +2,7 @@\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"commit-graph.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/environment.h b/environment.h\nindex d438b5c8f3a..a26931556af 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -3,6 +3,13 @@\n \n #include \"strvec.h\"\n \n+/*\n+ * The character that begins a commented line in user-editable file\n+ * that is subject to stripspace.\n+ */\n+extern char comment_line_char;\n+extern int auto_comment_line_char;\n+\n /*\n  * Wrapper of getenv() that returns a strdup value. This value is kept\n  * in argv to be freed later.\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex c870cb95b9d..bc4e61c5b1a 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"diff.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex bc7e72d5fef..0fe00b0bcec 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex 15209777d5a..b9cd593b147 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/trailer.c b/trailer.c\nindex 9eb1b761190..6a5091a3c46 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex d15f2b0e7e8..106e46480a1 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n-- \ngitgitgadget\n\n"},{"id":"473711","messageId":"88959aba6f1d877b791650016349a18e4503170e.1679207283.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 01/16] treewide: remove unnecessary cache.h inclusion from a few headers","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:47Z","receivedAt":"2023-03-19T06:28:24Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nEver since a64215b6cd (\"object.h: stop depending on cache.h; make\ncache.h depend on object.h\", 2023-02-24), we have a few headers that\ncould have replaced their include of cache.h with an include of\nobject.h.  Make that change now.\n\nSome C files had to start including cache.h after this change (or some\nsmaller header it had brought in), because the C files were depending\non things from cache.h but were only formerly implicitly getting\ncache.h through one of these headers being modified in this patch.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n bulk-checkin.h              | 2 +-\n bundle.h                    | 1 -\n cache-tree.c                | 2 +-\n config.c                    | 2 +-\n fmt-merge-msg.c             | 2 +-\n fsck.c                      | 2 +-\n http-backend.c              | 2 +-\n pack-mtimes.c               | 2 +-\n packfile.h                  | 4 +++-\n prune-packed.c              | 2 +-\n ref-filter.c                | 2 +-\n refs.c                      | 2 +-\n refs.h                      | 1 -\n refs/packed-backend.c       | 2 +-\n refspec.c                   | 1 +\n remote.c                    | 2 +-\n server-info.c               | 2 +-\n shallow.c                   | 2 +-\n strbuf.c                    | 2 +-\n streaming.h                 | 4 +++-\n submodule.c                 | 2 +-\n t/helper/test-bundle-uri.c  | 1 +\n t/helper/test-fast-rebase.c | 2 +-\n t/helper/test-pack-mtimes.c | 2 +-\n t/helper/test-reach.c       | 1 +\n transport.c                 | 2 +-\n transport.h                 | 1 -\n worktree.c                  | 2 +-\n 28 files changed, 29 insertions(+), 25 deletions(-)\n\ndiff --git a/bulk-checkin.h b/bulk-checkin.h\nindex 8281b9cb159..48fe9a6e917 100644\n--- a/bulk-checkin.h\n+++ b/bulk-checkin.h\n@@ -4,7 +4,7 @@\n #ifndef BULK_CHECKIN_H\n #define BULK_CHECKIN_H\n \n-#include \"cache.h\"\n+#include \"object.h\"\n \n void prepare_loose_object_bulk_checkin(void);\n void fsync_loose_object_bulk_checkin(int fd, const char *filename);\ndiff --git a/bundle.h b/bundle.h\nindex 9f2bd733a6a..021adbdcbb3 100644\n--- a/bundle.h\n+++ b/bundle.h\n@@ -2,7 +2,6 @@\n #define BUNDLE_H\n \n #include \"strvec.h\"\n-#include \"cache.h\"\n #include \"string-list.h\"\n #include \"list-objects-filter-options.h\"\n \ndiff --git a/cache-tree.c b/cache-tree.c\nindex 9d46ecef091..6f899beb041 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/config.c b/config.c\nindex d0aff55fa66..983c45fc37b 100644\n--- a/config.c\n+++ b/config.c\n@@ -5,7 +5,7 @@\n  * Copyright (C) Johannes Schindelin, 2005\n  *\n  */\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"date.h\"\n #include \"branch.h\"\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex 24cc44bdbc9..c870cb95b9d 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"refs.h\"\ndiff --git a/fsck.c b/fsck.c\nindex 871c0a9a252..70e12497878 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex 9cfc6f25414..7e7c19e66b3 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/pack-mtimes.c b/pack-mtimes.c\nindex 0f9785fc5e4..cd92fc1d86c 100644\n--- a/pack-mtimes.c\n+++ b/pack-mtimes.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"pack-mtimes.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/packfile.h b/packfile.h\nindex a3f6723857b..648be62bf22 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -1,11 +1,13 @@\n #ifndef PACKFILE_H\n #define PACKFILE_H\n \n-#include \"cache.h\"\n+#include \"object.h\"\n #include \"oidset.h\"\n \n /* in object-store.h */\n struct packed_git;\n+struct pack_entry;\n+struct pack_window;\n struct object_info;\n \n /*\ndiff --git a/prune-packed.c b/prune-packed.c\nindex d2813f6a405..e02f466c2ee 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"progress.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex ed802778da7..38141bce8db 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/refs.c b/refs.c\nindex 53240bcc07b..4e5cc73fb10 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -2,7 +2,7 @@\n  * The backend-independent part of the reference module.\n  */\n \n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hashmap.h\"\ndiff --git a/refs.h b/refs.h\nindex 935cdd1ece3..5741b69d0d1 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -1,7 +1,6 @@\n #ifndef REFS_H\n #define REFS_H\n \n-#include \"cache.h\"\n #include \"commit.h\"\n \n struct object_id;\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex b665d0f7d9b..6f975185995 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1,4 +1,4 @@\n-#include \"../git-compat-util.h\"\n+#include \"../cache.h\"\n #include \"../alloc.h\"\n #include \"../config.h\"\n #include \"../hex.h\"\ndiff --git a/refspec.c b/refspec.c\nindex 28d90911aa5..7b5c305514d 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strvec.h\"\n #include \"refs.h\"\ndiff --git a/remote.c b/remote.c\nindex b04e5da3383..2daddb85cb7 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/server-info.c b/server-info.c\nindex 40436892023..78643377057 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n #include \"hex.h\"\ndiff --git a/shallow.c b/shallow.c\nindex 1cbb05ba0e4..c5433a4fd30 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex 1c57ac6574f..8800830ebf8 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/streaming.h b/streaming.h\nindex 5e4e6acfd0d..bd27f59e576 100644\n--- a/streaming.h\n+++ b/streaming.h\n@@ -3,10 +3,12 @@\n  */\n #ifndef STREAMING_H\n #define STREAMING_H 1\n-#include \"cache.h\"\n+\n+#include \"object.h\"\n \n /* opaque */\n struct git_istream;\n+struct stream_filter;\n \n struct git_istream *open_istream(struct repository *, const struct object_id *,\n \t\t\t\t enum object_type *, unsigned long *,\ndiff --git a/submodule.c b/submodule.c\nindex 2a057c35b74..0baf97cf770 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-bundle-uri.c b/t/helper/test-bundle-uri.c\nindex b18e7603103..475058592d1 100644\n--- a/t/helper/test-bundle-uri.c\n+++ b/t/helper/test-bundle-uri.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"parse-options.h\"\n #include \"bundle-uri.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"transport.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex b1edb92a032..1e975df9041 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -12,7 +12,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n-\n+#include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n #include \"hex.h\"\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex f68b3761b68..0e53dee9e57 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -1,5 +1,5 @@\n-#include \"git-compat-util.h\"\n #include \"test-tool.h\"\n+#include \"cache.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex de8f26639d4..05d56267a9f 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -1,4 +1,5 @@\n #include \"test-tool.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n #include \"commit-reach.h\"\ndiff --git a/transport.c b/transport.c\nindex 906dbad5a08..80059124c0a 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/transport.h b/transport.h\nindex 85150f504fb..6393cd9823c 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -1,7 +1,6 @@\n #ifndef TRANSPORT_H\n #define TRANSPORT_H\n \n-#include \"cache.h\"\n #include \"run-command.h\"\n #include \"remote.h\"\n #include \"list-objects-filter-options.h\"\ndiff --git a/worktree.c b/worktree.c\nindex c99939a4d1f..9f8f3484ebd 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n-- \ngitgitgadget\n\n"},{"id":"473710","messageId":"3c193bef1d017efb8e1c7b1dd7d753a7a5c9e352.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 04/16] treewide: remove unnecessary cache.h inclusion from several sources","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:50Z","receivedAt":"2023-03-19T06:28:26Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nA number of files were apparently including cache.h solely to get\ngettext.h.  By making those files explicitly include gettext.h, we can\nalready drop the include of cache.h in these files.  Remove those now\nunnecessary includes.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/linux/procinfo.c        | 2 +-\n compat/simple-ipc/ipc-shared.c | 2 +-\n connected.c                    | 2 +-\n grep.c                         | 2 +-\n negotiator/default.c           | 2 +-\n negotiator/skipping.c          | 2 +-\n notes-cache.c                  | 2 +-\n patch-ids.c                    | 2 +-\n reflog.c                       | 2 +-\n refs/iterator.c                | 2 +-\n replace-object.c               | 2 +-\n t/helper/test-hash.c           | 1 -\n xdiff-interface.c              | 2 +-\n 13 files changed, 12 insertions(+), 13 deletions(-)\n\ndiff --git a/compat/linux/procinfo.c b/compat/linux/procinfo.c\nindex bc2f9382a17..4bb2d66227b 100644\n--- a/compat/linux/procinfo.c\n+++ b/compat/linux/procinfo.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n \n #include \"strbuf.h\"\n #include \"strvec.h\"\ndiff --git a/compat/simple-ipc/ipc-shared.c b/compat/simple-ipc/ipc-shared.c\nindex 1b9d359ab68..e5e1dda8ccd 100644\n--- a/compat/simple-ipc/ipc-shared.c\n+++ b/compat/simple-ipc/ipc-shared.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/connected.c b/connected.c\nindex a4c0aece757..669bc4e8d69 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/grep.c b/grep.c\nindex febb076a7e6..bb8796a829f 100644\n--- a/grep.c\n+++ b/grep.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 \"grep.h\"\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex b7e79feaf04..5dd553a1fe3 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"default.h\"\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex 264acf8bbea..4157c4d72f5 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"skipping.h\"\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\ndiff --git a/notes-cache.c b/notes-cache.c\nindex 9dfd251a815..01a918c925e 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"notes-cache.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/patch-ids.c b/patch-ids.c\nindex a4473a88fa2..19af7bee984 100644\n--- a/patch-ids.c\n+++ b/patch-ids.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"hash-lookup.h\"\ndiff --git a/reflog.c b/reflog.c\nindex d1c39374318..4e121e449d1 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"reflog.h\"\ndiff --git a/refs/iterator.c b/refs/iterator.c\nindex c9fd0bcaf90..6b680f610ef 100644\n--- a/refs/iterator.c\n+++ b/refs/iterator.c\n@@ -3,7 +3,7 @@\n  * documentation about the design and use of reference iterators.\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"refs.h\"\n #include \"refs/refs-internal.h\"\n #include \"iterator.h\"\ndiff --git a/replace-object.c b/replace-object.c\nindex 9e30e0362ba..e98825d5852 100644\n--- a/replace-object.c\n+++ b/replace-object.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\ndiff --git a/t/helper/test-hash.c b/t/helper/test-hash.c\nindex 016248106a7..45d829c908f 100644\n--- a/t/helper/test-hash.c\n+++ b/t/helper/test-hash.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n \n int cmd_hash_impl(int ac, const char **av, int algo)\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 5baf6ceb947..356356afe71 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n-- \ngitgitgadget\n\n"},{"id":"473712","messageId":"a0fc4aa2470af2480945b20e905287c872472a1f.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 07/16] cache.h: remove expand_user_path()","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:53Z","receivedAt":"2023-03-19T06:28: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\nexpand_user_path() was renamed to interpolate_path() back in mid-2021,\nbut reinstated with a #define and a NEEDSWORK comment that we would\neventually want to get rid of it.  Do so now.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h         | 2 --\n gpg-interface.c | 2 +-\n 2 files changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 260203c7a62..978aa01712b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1142,8 +1142,6 @@ enum scld_error safe_create_leading_directories_no_share(char *path);\n \n int mkdir_in_gitdir(const char *path);\n char *interpolate_path(const char *path, int real_home);\n-/* NEEDSWORK: remove this synonym once in-flight topics have migrated */\n-#define expand_user_path interpolate_path\n const char *enter_repo(const char *path, int strict);\n const char *remove_leading_path(const char *in, const char *prefix);\n const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 632265691e5..f9c5b6c3f53 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1049,7 +1049,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,\n \t\tssh_signing_key_file = strbuf_detach(&key_file->filename, NULL);\n \t} else {\n \t\t/* We assume a file */\n-\t\tssh_signing_key_file = expand_user_path(signing_key, 1);\n+\t\tssh_signing_key_file = interpolate_path(signing_key, 1);\n \t}\n \n \tbuffer_file = mks_tempfile_t(\".git_signing_buffer_tmpXXXXXX\");\n-- \ngitgitgadget\n\n"},{"id":"473713","messageId":"a0bbd2c9b480f7b876fe7ceb0f2bde983793556c.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 06/16] abspath.h: move absolute path functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:52Z","receivedAt":"2023-03-19T06:28: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\nThis is another step towards letting us remove the include of cache.h in\nstrbuf.c.  It does mean that we also need to add includes of abspath.h\nin a number of C files.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n abspath.c                          |  4 +++-\n abspath.h                          | 30 ++++++++++++++++++++++++++++++\n apply.c                            |  1 +\n archive.c                          |  1 +\n builtin/am.c                       |  1 +\n builtin/bugreport.c                |  1 +\n builtin/bundle.c                   |  1 +\n builtin/clean.c                    |  1 +\n builtin/clone.c                    |  1 +\n builtin/config.c                   |  1 +\n builtin/credential-cache--daemon.c |  1 +\n builtin/diagnose.c                 |  1 +\n builtin/difftool.c                 |  1 +\n builtin/fast-import.c              |  1 +\n builtin/fsmonitor--daemon.c        |  1 +\n builtin/gc.c                       |  1 +\n builtin/hash-object.c              |  1 +\n builtin/init-db.c                  |  1 +\n builtin/log.c                      |  1 +\n builtin/mailinfo.c                 |  1 +\n builtin/merge-file.c               |  1 +\n builtin/merge.c                    |  1 +\n builtin/multi-pack-index.c         |  1 +\n builtin/mv.c                       |  1 +\n builtin/rebase.c                   |  1 +\n builtin/receive-pack.c             |  1 +\n builtin/rev-parse.c                |  1 +\n builtin/stash.c                    |  1 +\n builtin/submodule--helper.c        |  1 +\n builtin/worktree.c                 |  1 +\n cache.h                            | 24 ------------------------\n chdir-notify.c                     |  1 +\n compat/disk.h                      |  1 +\n compat/mingw.c                     |  1 +\n compat/simple-ipc/ipc-win32.c      |  1 +\n config.c                           |  1 +\n credential.c                       |  1 +\n daemon.c                           |  1 +\n diff-no-index.c                    |  1 +\n diff.c                             |  1 +\n dir.c                              |  1 +\n editor.c                           |  1 +\n environment.c                      |  1 +\n exec-cmd.c                         |  1 +\n gettext.c                          |  1 +\n lockfile.c                         |  1 +\n midx.c                             |  1 +\n object-file.c                      |  1 +\n parse-options.c                    |  1 +\n path.c                             |  1 +\n pathspec.c                         |  1 +\n remote.c                           |  1 +\n repository.c                       |  1 +\n rerere.c                           |  1 +\n scalar.c                           |  1 +\n sequencer.c                        |  1 +\n setup.c                            |  1 +\n strbuf.c                           |  1 +\n submodule.c                        |  1 +\n t/helper/test-path-utils.c         |  1 +\n tmp-objdir.c                       |  1 +\n trace.c                            |  1 +\n trace2/tr2_dst.c                   |  1 +\n worktree.c                         |  1 +\n wrapper.c                          |  1 +\n 65 files changed, 95 insertions(+), 25 deletions(-)\n create mode 100644 abspath.h\n\ndiff --git a/abspath.c b/abspath.c\nindex 39e06b58486..f72f332e5aa 100644\n--- a/abspath.c\n+++ b/abspath.c\n@@ -1,4 +1,6 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"abspath.h\"\n+#include \"strbuf.h\"\n \n /*\n  * Do not use this for inspecting *tracked* content.  When path is a\ndiff --git a/abspath.h b/abspath.h\nnew file mode 100644\nindex 00000000000..118546db5f8\n--- /dev/null\n+++ b/abspath.h\n@@ -0,0 +1,30 @@\n+#ifndef ABSPATH_H\n+#define ABSPATH_H\n+\n+int is_directory(const char *);\n+char *strbuf_realpath(struct strbuf *resolved, const char *path,\n+\t\t      int die_on_error);\n+char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,\n+\t\t\t\tint die_on_error);\n+char *real_pathdup(const char *path, int die_on_error);\n+const char *absolute_path(const char *path);\n+char *absolute_pathdup(const char *path);\n+\n+/*\n+ * Concatenate \"prefix\" (if len is non-zero) and \"path\", with no\n+ * connecting characters (so \"prefix\" should end with a \"/\").\n+ * Unlike prefix_path, this should be used if the named file does\n+ * not have to interact with index entry; i.e. name of a random file\n+ * on the filesystem.\n+ *\n+ * The return value is always a newly allocated string (even if the\n+ * prefix was empty).\n+ */\n+char *prefix_filename(const char *prefix, const char *path);\n+\n+static inline int is_absolute_path(const char *path)\n+{\n+\treturn is_dir_sep(path[0]) || has_dos_drive_prefix(path);\n+}\n+\n+#endif /* ABSPATH_H */\ndiff --git a/apply.c b/apply.c\nindex e0bdd43a68e..e5e11b85793 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"object-store.h\"\ndiff --git a/archive.c b/archive.c\nindex 2c3da1cff30..c3c45a5ebe9 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex cc1fdf4f75d..14347ecf9aa 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex b61cfa9464f..b5dfad4e12a 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 4c5ac5e0849..8ea1232dbce 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 46c51029ab4..fdcf62c5dfe 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -8,6 +8,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex d605fcafa0f..b94324ea02c 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -10,6 +10,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 33b17b40b41..42e6b8d3481 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 0f00ba4d741..62c09a271d6 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/diagnose.c b/builtin/diagnose.c\nindex 5b12d1fb963..0f8b64994c4 100644\n--- a/builtin/diagnose.c\n+++ b/builtin/diagnose.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"diagnose.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex f7380dd1cc7..ed06db12085 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -13,6 +13,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f3635c7aefd..7307c4657f2 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 215e3813d7d..4efb1417344 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 32cabad7cf6..ef063fc828c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -11,6 +11,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex f233eda7590..7651a7a5f56 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -5,6 +5,7 @@\n  * Copyright (C) Junio C Hamano, 2005\n  */\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex e182bc7e839..6f724f694f4 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 7b107d254df..639d8e90951 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -5,6 +5,7 @@\n  *\t\t 2006 Junio Hamano\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex e8bb011cfb4..e14f7c0abce 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -3,6 +3,7 @@\n  * email to figure out authorship and subject\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex ae45f523b95..c0096ee0810 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 2c9da4b23d1..38243e55c5f 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -8,6 +8,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex e6757a44470..579bc2cac0c 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex c02dddb72b5..0a49bf21b0f 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex a2c68b8ff7b..a3f8be88882 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -6,6 +6,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex d1b6bd6eef4..5fab0aed533 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 5a932a861b4..a4c0878bc91 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 65817d0b763..52fa892f7eb 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1,5 +1,6 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex a4bdd44daa3..ff1fd8c87ab 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,5 +1,6 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex ed89b7e9725..ed614ffddcb 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n #include \"builtin.h\"\ndiff --git a/cache.h b/cache.h\nindex 4b4c2e17557..260203c7a62 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -598,18 +598,6 @@ const char *setup_git_directory(void);\n char *prefix_path(const char *prefix, int len, const char *path);\n char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n \n-/*\n- * Concatenate \"prefix\" (if len is non-zero) and \"path\", with no\n- * connecting characters (so \"prefix\" should end with a \"/\").\n- * Unlike prefix_path, this should be used if the named file does\n- * not have to interact with index entry; i.e. name of a random file\n- * on the filesystem.\n- *\n- * The return value is always a newly allocated string (even if the\n- * prefix was empty).\n- */\n-char *prefix_filename(const char *prefix, const char *path);\n-\n int check_filename(const char *prefix, const char *name);\n void verify_filename(const char *prefix,\n \t\t     const char *name,\n@@ -1157,18 +1145,6 @@ char *interpolate_path(const char *path, int real_home);\n /* NEEDSWORK: remove this synonym once in-flight topics have migrated */\n #define expand_user_path interpolate_path\n const char *enter_repo(const char *path, int strict);\n-static inline int is_absolute_path(const char *path)\n-{\n-\treturn is_dir_sep(path[0]) || has_dos_drive_prefix(path);\n-}\n-int is_directory(const char *);\n-char *strbuf_realpath(struct strbuf *resolved, const char *path,\n-\t\t      int die_on_error);\n-char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,\n-\t\t\t\tint die_on_error);\n-char *real_pathdup(const char *path, int die_on_error);\n-const char *absolute_path(const char *path);\n-char *absolute_pathdup(const char *path);\n const char *remove_leading_path(const char *in, const char *prefix);\n const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\ndiff --git a/chdir-notify.c b/chdir-notify.c\nindex 5f7f2c2ac23..929ec01b3a2 100644\n--- a/chdir-notify.c\n+++ b/chdir-notify.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"list.h\"\n #include \"strbuf.h\"\ndiff --git a/compat/disk.h b/compat/disk.h\nindex a04a8d294af..6c979c27d89 100644\n--- a/compat/disk.h\n+++ b/compat/disk.h\n@@ -2,6 +2,7 @@\n #define COMPAT_DISK_H\n \n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n \n static int get_disk_info(struct strbuf *out)\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex a9e5570288c..cbcd03aea9b 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -7,6 +7,7 @@\n #include \"../strbuf.h\"\n #include \"../run-command.h\"\n #include \"../cache.h\"\n+#include \"../abspath.h\"\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\ndiff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c\nindex f011e5cead8..997f6144344 100644\n--- a/compat/simple-ipc/ipc-win32.c\n+++ b/compat/simple-ipc/ipc-win32.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\ndiff --git a/config.c b/config.c\nindex f30a6d8e686..6815919ec30 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"date.h\"\n #include \"branch.h\"\ndiff --git a/credential.c b/credential.c\nindex 5244f3c12c0..e6417bf8804 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"credential.h\"\n #include \"gettext.h\"\ndiff --git a/daemon.c b/daemon.c\nindex 8908e7f8d2a..bb795ca3ca9 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"pkt-line.h\"\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 287a113badd..934a24bee58 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"color.h\"\n #include \"commit.h\"\n #include \"blob.h\"\ndiff --git a/diff.c b/diff.c\nindex 00746f2f86e..1b0be99c065 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2,6 +2,7 @@\n  * Copyright (C) 2005 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/dir.c b/dir.c\nindex 46f1bb6e5b7..c72481c60ee 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -6,6 +6,7 @@\n  *\t\t Junio Hamano, 2005-2006\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/editor.c b/editor.c\nindex 58e790548d2..2d3e6be64e4 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/environment.c b/environment.c\nindex 82a1fc17d0b..c69571f0b29 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"branch.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 282d95af081..042d9247a5b 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\ndiff --git a/gettext.c b/gettext.c\nindex f139008d0a3..3e7b3baabc6 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex ab6490a391d..673c21d17a9 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\n \ndiff --git a/midx.c b/midx.c\nindex e132ef250e4..b111665dcab 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"csum-file.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 39660d49dbc..bee41b30474 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex 815c392aaec..99fa0440b5d 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\ndiff --git a/path.c b/path.c\nindex 3f2702cbe49..3976c0d7ace 100644\n--- a/path.c\n+++ b/path.c\n@@ -2,6 +2,7 @@\n  * Utilities for paths and pathnames\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 868b4d280ca..53763e272f5 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/remote.c b/remote.c\nindex edb1e07497c..2bae247a0a4 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/repository.c b/repository.c\nindex 937fa974b38..4412f633224 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -4,6 +4,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"config.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 9428cbca7b2..c3258e13902 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/scalar.c b/scalar.c\nindex ca19b95ce46..fe61a3ebdd7 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"config.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 0fe00b0bcec..f5fe0df2689 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\ndiff --git a/setup.c b/setup.c\nindex 8a4ccee4c2c..8f385d9f29b 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex b9cd593b147..9633e37b62f 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 8b551e53274..13ff333f68c 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex f69709d674f..d3d00dc34fa 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/tmp-objdir.c b/tmp-objdir.c\nindex 2a2012eb6d0..fff15cb6b5c 100644\n--- a/tmp-objdir.c\n+++ b/tmp-objdir.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"tmp-objdir.h\"\n+#include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"dir.h\"\n #include \"sigchain.h\"\ndiff --git a/trace.c b/trace.c\nindex efa4e2d8e08..2b41c683fc8 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -22,6 +22,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"quote.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\ndiff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c\nindex 8a21dd29725..273260e1f18 100644\n--- a/trace2/tr2_dst.c\n+++ b/trace2/tr2_dst.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"sigchain.h\"\n #include \"trace2/tr2_dst.h\"\n #include \"trace2/tr2_sid.h\"\ndiff --git a/worktree.c b/worktree.c\nindex 530dd5fbc44..d87141f694e 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 0d4ceba6fc5..df1fa6286d0 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -2,6 +2,7 @@\n  * Various trivial helper wrappers around standard functions\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n \n-- \ngitgitgadget\n\n"},{"id":"473714","messageId":"0f48e561b797a7c8f5ab4ae5c0d4296d7d05ef44.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 08/16] path.h: move function declarations for path.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:54Z","receivedAt":"2023-03-19T06:28:35Z","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 | 59 ------------------------------------------------------\n path.h  | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 61 insertions(+), 60 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 978aa01712b..705c41992bc 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1105,7 +1105,6 @@ enum sharedrepo {\n \tPERM_EVERYBODY      = 0664\n };\n int git_config_perm(const char *var, const char *value);\n-int adjust_shared_perm(const char *path);\n \n /*\n  * Create the directory containing the named path, using care to be\n@@ -1141,54 +1140,6 @@ enum scld_error safe_create_leading_directories_const(const char *path);\n enum scld_error safe_create_leading_directories_no_share(char *path);\n \n int mkdir_in_gitdir(const char *path);\n-char *interpolate_path(const char *path, int real_home);\n-const char *enter_repo(const char *path, int strict);\n-const char *remove_leading_path(const char *in, const char *prefix);\n-const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n-int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\n-int normalize_path_copy(char *dst, const char *src);\n-int longest_ancestor_length(const char *path, struct string_list *prefixes);\n-char *strip_path_suffix(const char *path, const char *suffix);\n-int daemon_avoid_alias(const char *path);\n-\n-/*\n- * These functions match their is_hfs_dotgit() counterparts; see utf8.h for\n- * details.\n- */\n-int is_ntfs_dotgit(const char *name);\n-int is_ntfs_dotgitmodules(const char *name);\n-int is_ntfs_dotgitignore(const char *name);\n-int is_ntfs_dotgitattributes(const char *name);\n-int is_ntfs_dotmailmap(const char *name);\n-\n-/*\n- * Returns true iff \"str\" could be confused as a command-line option when\n- * passed to a sub-program like \"ssh\". Note that this has nothing to do with\n- * shell-quoting, which should be handled separately; we're assuming here that\n- * the string makes it verbatim to the sub-program.\n- */\n-int looks_like_command_line_option(const char *str);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CONFIG_HOME/$subdir/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n- * \"$HOME/.config/$subdir/$filename\". Return NULL upon error.\n- */\n-char *xdg_config_home_for(const char *subdir, const char *filename);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CONFIG_HOME/git/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n- * \"$HOME/.config/git/$filename\". Return NULL upon error.\n- */\n-char *xdg_config_home(const char *filename);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CACHE_HOME/git/$filename\" if $XDG_CACHE_HOME is non-empty, otherwise\n- * \"$HOME/.cache/git/$filename\". Return NULL upon error.\n- */\n-char *xdg_cache_home(const char *filename);\n \n int git_open_cloexec(const char *name, int flags);\n #define git_open(name) git_open_cloexec(name, O_RDONLY)\n@@ -1355,8 +1306,6 @@ int repo_interpret_branch_name(struct repository *r,\n #define interpret_branch_name(str, len, buf, options) \\\n \trepo_interpret_branch_name(the_repository, str, len, buf, options)\n \n-int validate_headref(const char *ref);\n-\n 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@@ -1616,14 +1565,6 @@ void stat_validity_update(struct stat_validity *sv, int fd);\n \n int versioncmp(const char *s1, const char *s2);\n \n-/*\n- * Create a directory and (if share is nonzero) adjust its permissions\n- * according to the shared_repository setting. Only use this for\n- * directories under $GIT_DIR.  Don't use it for working tree\n- * directories.\n- */\n-void safe_create_dir(const char *dir, int share);\n-\n /*\n  * Should we print an ellipsis after an abbreviated SHA-1 value\n  * when doing diff-raw output or indicating a detached HEAD?\ndiff --git a/path.h b/path.h\nindex 0a59c85a62e..60e83a49a98 100644\n--- a/path.h\n+++ b/path.h\n@@ -3,6 +3,7 @@\n \n struct repository;\n struct strbuf;\n+struct string_list;\n \n /*\n  * The result to all functions which return statically allocated memory may be\n@@ -179,7 +180,66 @@ const char *git_path_auto_merge(struct repository *r);\n const char *git_path_fetch_head(struct repository *r);\n const char *git_path_shallow(struct repository *r);\n \n-\n int ends_with_path_components(const char *path, const char *components);\n+int validate_headref(const char *ref);\n+\n+int adjust_shared_perm(const char *path);\n+\n+char *interpolate_path(const char *path, int real_home);\n+const char *enter_repo(const char *path, int strict);\n+const char *remove_leading_path(const char *in, const char *prefix);\n+const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n+int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\n+int normalize_path_copy(char *dst, const char *src);\n+int longest_ancestor_length(const char *path, struct string_list *prefixes);\n+char *strip_path_suffix(const char *path, const char *suffix);\n+int daemon_avoid_alias(const char *path);\n+\n+/*\n+ * These functions match their is_hfs_dotgit() counterparts; see utf8.h for\n+ * details.\n+ */\n+int is_ntfs_dotgit(const char *name);\n+int is_ntfs_dotgitmodules(const char *name);\n+int is_ntfs_dotgitignore(const char *name);\n+int is_ntfs_dotgitattributes(const char *name);\n+int is_ntfs_dotmailmap(const char *name);\n+\n+/*\n+ * Returns true iff \"str\" could be confused as a command-line option when\n+ * passed to a sub-program like \"ssh\". Note that this has nothing to do with\n+ * shell-quoting, which should be handled separately; we're assuming here that\n+ * the string makes it verbatim to the sub-program.\n+ */\n+int looks_like_command_line_option(const char *str);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CONFIG_HOME/$subdir/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n+ * \"$HOME/.config/$subdir/$filename\". Return NULL upon error.\n+ */\n+char *xdg_config_home_for(const char *subdir, const char *filename);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CONFIG_HOME/git/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n+ * \"$HOME/.config/git/$filename\". Return NULL upon error.\n+ */\n+char *xdg_config_home(const char *filename);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CACHE_HOME/git/$filename\" if $XDG_CACHE_HOME is non-empty, otherwise\n+ * \"$HOME/.cache/git/$filename\". Return NULL upon error.\n+ */\n+char *xdg_cache_home(const char *filename);\n+\n+/*\n+ * Create a directory and (if share is nonzero) adjust its permissions\n+ * according to the shared_repository setting. Only use this for\n+ * directories under $GIT_DIR.  Don't use it for working tree\n+ * directories.\n+ */\n+void safe_create_dir(const char *dir, int share);\n \n #endif /* PATH_H */\n-- \ngitgitgadget\n\n"},{"id":"473716","messageId":"b771199fae3e32b8c28ff16ac7245de6119ca6c6.1679207283.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 02/16] treewide: be explicit about dependence on gettext.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:48Z","receivedAt":"2023-03-19T06:28:38Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nDozens of files made use of gettext functions, without explicitly\nincluding gettext.h.  This made it more difficult to find which files\ncould remove a dependence on cache.h.  Make C files explicitly include\ngettext.h if they are using it.\n\nHowever, while compat/fsmonitor/fsm-ipc-darwin.c should also gain an\ninclude of gettext.h, it was left out to avoid conflicting with an\nin-flight topic.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-interactive.c                        | 1 +\n add-patch.c                              | 1 +\n apply.c                                  | 1 +\n archive-tar.c                            | 1 +\n archive-zip.c                            | 1 +\n archive.c                                | 1 +\n attr.c                                   | 1 +\n bisect.c                                 | 1 +\n blame.c                                  | 1 +\n branch.c                                 | 1 +\n builtin/add.c                            | 1 +\n builtin/am.c                             | 1 +\n builtin/apply.c                          | 1 +\n builtin/archive.c                        | 1 +\n builtin/bisect.c                         | 1 +\n builtin/blame.c                          | 1 +\n builtin/branch.c                         | 1 +\n builtin/bugreport.c                      | 1 +\n builtin/bundle.c                         | 1 +\n builtin/cat-file.c                       | 1 +\n builtin/check-attr.c                     | 1 +\n builtin/check-ignore.c                   | 1 +\n builtin/check-mailmap.c                  | 1 +\n builtin/checkout--worker.c               | 1 +\n builtin/checkout-index.c                 | 1 +\n builtin/checkout.c                       | 1 +\n builtin/clean.c                          | 1 +\n builtin/clone.c                          | 1 +\n builtin/column.c                         | 1 +\n builtin/commit-graph.c                   | 1 +\n builtin/commit-tree.c                    | 1 +\n builtin/commit.c                         | 1 +\n builtin/config.c                         | 1 +\n builtin/count-objects.c                  | 1 +\n builtin/credential-cache--daemon.c       | 1 +\n builtin/credential-cache.c               | 1 +\n builtin/credential-store.c               | 1 +\n builtin/describe.c                       | 1 +\n builtin/diagnose.c                       | 1 +\n builtin/diff-tree.c                      | 1 +\n builtin/diff.c                           | 1 +\n builtin/difftool.c                       | 1 +\n builtin/fast-export.c                    | 1 +\n builtin/fast-import.c                    | 1 +\n builtin/fetch-pack.c                     | 1 +\n builtin/fetch.c                          | 1 +\n builtin/fmt-merge-msg.c                  | 1 +\n builtin/for-each-ref.c                   | 1 +\n builtin/for-each-repo.c                  | 1 +\n builtin/fsck.c                           | 1 +\n builtin/fsmonitor--daemon.c              | 1 +\n builtin/gc.c                             | 1 +\n builtin/grep.c                           | 1 +\n builtin/hash-object.c                    | 1 +\n builtin/help.c                           | 1 +\n builtin/hook.c                           | 1 +\n builtin/index-pack.c                     | 1 +\n builtin/init-db.c                        | 1 +\n builtin/interpret-trailers.c             | 1 +\n builtin/log.c                            | 1 +\n builtin/ls-files.c                       | 1 +\n builtin/ls-remote.c                      | 1 +\n builtin/ls-tree.c                        | 1 +\n builtin/mailinfo.c                       | 1 +\n builtin/mailsplit.c                      | 1 +\n builtin/merge-base.c                     | 1 +\n builtin/merge-file.c                     | 1 +\n builtin/merge-recursive.c                | 1 +\n builtin/merge-tree.c                     | 1 +\n builtin/merge.c                          | 1 +\n builtin/mktag.c                          | 1 +\n builtin/mktree.c                         | 1 +\n builtin/multi-pack-index.c               | 1 +\n builtin/mv.c                             | 1 +\n builtin/name-rev.c                       | 1 +\n builtin/notes.c                          | 1 +\n builtin/pack-objects.c                   | 1 +\n builtin/pack-redundant.c                 | 1 +\n builtin/pack-refs.c                      | 1 +\n builtin/patch-id.c                       | 1 +\n builtin/prune-packed.c                   | 1 +\n builtin/prune.c                          | 1 +\n builtin/pull.c                           | 1 +\n builtin/push.c                           | 1 +\n builtin/range-diff.c                     | 1 +\n builtin/read-tree.c                      | 1 +\n builtin/rebase.c                         | 1 +\n builtin/receive-pack.c                   | 1 +\n builtin/reflog.c                         | 1 +\n builtin/remote.c                         | 1 +\n builtin/repack.c                         | 1 +\n builtin/replace.c                        | 1 +\n builtin/rerere.c                         | 1 +\n builtin/reset.c                          | 1 +\n builtin/rev-list.c                       | 1 +\n builtin/rev-parse.c                      | 1 +\n builtin/revert.c                         | 1 +\n builtin/rm.c                             | 1 +\n builtin/shortlog.c                       | 1 +\n builtin/show-branch.c                    | 1 +\n builtin/show-index.c                     | 1 +\n builtin/show-ref.c                       | 1 +\n builtin/sparse-checkout.c                | 1 +\n builtin/stash.c                          | 1 +\n builtin/stripspace.c                     | 1 +\n builtin/submodule--helper.c              | 1 +\n builtin/symbolic-ref.c                   | 1 +\n builtin/tag.c                            | 1 +\n builtin/unpack-objects.c                 | 1 +\n builtin/update-index.c                   | 1 +\n builtin/update-ref.c                     | 1 +\n builtin/update-server-info.c             | 1 +\n builtin/upload-pack.c                    | 1 +\n builtin/verify-commit.c                  | 1 +\n builtin/verify-pack.c                    | 1 +\n builtin/verify-tag.c                     | 1 +\n builtin/worktree.c                       | 1 +\n builtin/write-tree.c                     | 1 +\n bulk-checkin.c                           | 1 +\n bundle-uri.c                             | 1 +\n bundle.c                                 | 1 +\n chunk-format.c                           | 1 +\n color.c                                  | 1 +\n commit-graph.c                           | 1 +\n commit.c                                 | 1 +\n common-main.c                            | 1 +\n compat/disk.h                            | 1 +\n compat/fsmonitor/fsm-health-win32.c      | 1 +\n compat/fsmonitor/fsm-listen-darwin.c     | 1 +\n compat/fsmonitor/fsm-listen-win32.c      | 1 +\n compat/fsmonitor/fsm-path-utils-darwin.c | 1 +\n compat/fsmonitor/fsm-path-utils-win32.c  | 1 +\n compat/mingw.c                           | 1 +\n compat/precompose_utf8.c                 | 1 +\n compat/simple-ipc/ipc-unix-socket.c      | 1 +\n compat/simple-ipc/ipc-win32.c            | 1 +\n compat/terminal.c                        | 1 +\n config.c                                 | 1 +\n connect.c                                | 1 +\n connected.c                              | 1 +\n convert.c                                | 1 +\n credential.c                             | 1 +\n date.c                                   | 1 +\n delta-islands.c                          | 1 +\n diagnose.c                               | 1 +\n diff-lib.c                               | 1 +\n diff-no-index.c                          | 1 +\n diff.c                                   | 1 +\n dir.c                                    | 1 +\n editor.c                                 | 1 +\n entry.c                                  | 1 +\n environment.c                            | 1 +\n exec-cmd.c                               | 1 +\n fetch-pack.c                             | 1 +\n fsmonitor-ipc.c                          | 1 +\n git.c                                    | 1 +\n gpg-interface.c                          | 1 +\n grep.c                                   | 1 +\n http-fetch.c                             | 1 +\n imap-send.c                              | 1 +\n list-objects-filter-options.h            | 1 +\n list-objects-filter.c                    | 1 +\n list-objects.c                           | 1 +\n lockfile.c                               | 1 +\n ls-refs.c                                | 1 +\n merge-ort-wrappers.c                     | 1 +\n merge-ort.c                              | 1 +\n merge-recursive.c                        | 1 +\n merge.c                                  | 1 +\n midx.c                                   | 1 +\n name-hash.c                              | 1 +\n notes-merge.c                            | 1 +\n notes-utils.c                            | 1 +\n object-file.c                            | 1 +\n object-name.c                            | 1 +\n object.c                                 | 1 +\n pack-bitmap-write.c                      | 1 +\n pack-bitmap.c                            | 1 +\n pack-mtimes.c                            | 1 +\n pack-revindex.c                          | 1 +\n pack-write.c                             | 1 +\n packfile.c                               | 1 +\n parallel-checkout.c                      | 1 +\n parse-options-cb.c                       | 1 +\n parse-options.c                          | 1 +\n parse-options.h                          | 2 ++\n path.c                                   | 1 +\n pathspec.c                               | 1 +\n pkt-line.c                               | 1 +\n preload-index.c                          | 1 +\n pretty.c                                 | 1 +\n promisor-remote.c                        | 1 +\n prune-packed.c                           | 1 +\n range-diff.c                             | 1 +\n reachable.c                              | 1 +\n read-cache.c                             | 1 +\n rebase-interactive.c                     | 1 +\n ref-filter.c                             | 1 +\n ref-filter.h                             | 1 +\n reflog.c                                 | 1 +\n refs.c                                   | 1 +\n refs/files-backend.c                     | 1 +\n refs/packed-backend.c                    | 1 +\n remote-curl.c                            | 1 +\n remote.c                                 | 1 +\n replace-object.c                         | 1 +\n rerere.c                                 | 1 +\n rerere.h                                 | 1 +\n reset.c                                  | 1 +\n revision.c                               | 1 +\n run-command.c                            | 1 +\n send-pack.c                              | 1 +\n sequencer.c                              | 1 +\n setup.c                                  | 1 +\n sideband.c                               | 1 +\n sparse-index.c                           | 1 +\n split-index.c                            | 1 +\n strbuf.c                                 | 1 +\n submodule-config.c                       | 1 +\n submodule.c                              | 1 +\n symlinks.c                               | 1 +\n t/helper/test-cache-tree.c               | 1 +\n t/helper/test-fast-rebase.c              | 1 +\n t/helper/test-reach.c                    | 1 +\n t/helper/test-serve-v2.c                 | 1 +\n trailer.c                                | 1 +\n transport-helper.c                       | 1 +\n tree-walk.c                              | 1 +\n unpack-trees.c                           | 1 +\n upload-pack.c                            | 1 +\n usage.c                                  | 2 +-\n walker.c                                 | 1 +\n worktree.c                               | 1 +\n wrapper.c                                | 1 +\n wt-status.c                              | 1 +\n 235 files changed, 236 insertions(+), 1 deletion(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex ae25ec50bce..b750543bd87 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -3,6 +3,7 @@\n #include \"color.h\"\n #include \"config.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"refs.h\"\ndiff --git a/add-patch.c b/add-patch.c\nindex c6e451c136c..7fe6b66d866 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"add-interactive.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\n #include \"strvec.h\"\ndiff --git a/apply.c b/apply.c\nindex 8776ab939ad..e0bdd43a68e 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -15,6 +15,7 @@\n #include \"delta.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"xdiff-interface.h\"\n #include \"ll-merge.h\"\ndiff --git a/archive-tar.c b/archive-tar.c\nindex ee27fa0b39b..16ee133bbf5 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tar.h\"\n #include \"archive.h\"\ndiff --git a/archive-zip.c b/archive-zip.c\nindex c5d1f72eb80..c02dc33e406 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"archive.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"utf8.h\"\ndiff --git a/archive.c b/archive.c\nindex 1c2ca78e52a..2c3da1cff30 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/attr.c b/attr.c\nindex 657ee52229e..48e2d646187 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"quote.h\"\n #include \"revision.h\"\ndiff --git a/bisect.c b/bisect.c\nindex 1409150c5c3..5a3a8182d83 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"refs.h\"\ndiff --git a/blame.c b/blame.c\nindex e45d8a3bf92..b7cd849bb6b 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -5,6 +5,7 @@\n #include \"mergesort.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"blame.h\"\ndiff --git a/branch.c b/branch.c\nindex 5aaf073dce1..fced5342d5d 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"branch.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 61dd386d109..f12054d9be1 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"exec-cmd.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5e6b237c424..cc1fdf4f75d 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -8,6 +8,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"dir.h\"\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 555219de40f..fe72c0ec3eb 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"apply.h\"\n \ndiff --git a/builtin/archive.c b/builtin/archive.c\nindex f094390ee01..e40e61b355c 100644\n--- a/builtin/archive.c\n+++ b/builtin/archive.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"archive.h\"\n+#include \"gettext.h\"\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex e8ee4a4dc8d..c2e614c2890 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"bisect.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fdd9f0c0fc7..21f6b523a6d 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -10,6 +10,7 @@\n #include \"config.h\"\n #include \"color.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex f63fd45edb9..a67a8334d5c 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -11,6 +11,7 @@\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"remote.h\"\n #include \"parse-options.h\"\n #include \"branch.h\"\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex 5bc254be80f..b61cfa9464f 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n #include \"help.h\"\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex acceef62001..4c5ac5e0849 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 9e7e03ade41..9f1bf8f0e96 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex d7a40e674ca..ad27255e2cb 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"attr.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex ab776061c7c..a45d001e353 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex 96db3ddb4bb..fa86fd9423d 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"mailmap.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex 0a7d762573c..2120dd1d300 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"gettext.h\"\n #include \"parallel-checkout.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex cf6fba97ba7..828c0363f8a 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -8,6 +8,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 21a4335abb0..3c7ff60b923 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"hook.h\"\n #include \"ll-merge.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 10aaa8c603f..46c51029ab4 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 462c286274c..d605fcafa0f 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -11,6 +11,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/column.c b/builtin/column.c\nindex 158fdf53d9f..de623a16c2d 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex d3be7f3b318..311e0106810 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex e805da5bb1c..0ef55d83d49 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex f71ed41bf59..25575435ad7 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -16,6 +16,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"wt-status.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 49d832d4093..33b17b40b41 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex bb21bc43e42..48edc86c240 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 6e509d02c37..0f00ba4d741 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n #ifndef NO_UNIX_SOCKETS\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 78c02ad5319..25f2f71c216 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n #ifndef NO_UNIX_SOCKETS\ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex 62a4f3c2653..da32cfd89e2 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"credential.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 5b5930f5c8c..fcacdf8a693 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\ndiff --git a/builtin/diagnose.c b/builtin/diagnose.c\nindex d52015c67a4..5b12d1fb963 100644\n--- a/builtin/diagnose.c\n+++ b/builtin/diagnose.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"diagnose.h\"\n \ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex a393efa4f08..385c2d0230c 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"log-tree.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 26f1e532c66..20bdb6e6cec 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -11,6 +11,7 @@\n #include \"color.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"diff.h\"\n #include \"diff-merges.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 01681d0fb88..f7380dd1cc7 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -17,6 +17,7 @@\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"strvec.h\"\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 78493c6d2bf..9ab2e34ef05 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -6,6 +6,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f7548ff4a35..f3635c7aefd 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex 702c9a3397e..60e5a10ffc5 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"fetch-pack.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex bf627e04128..c266b6ab4dd 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 8d8fd393f89..0f9855b680e 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"fmt-merge-msg.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 6f62f40d126..7a8ff5902cf 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c\nindex 6aeac371488..27425c2fc9e 100644\n--- a/builtin/for-each-repo.c\n+++ b/builtin/for-each-repo.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex c4a633c0329..1375e32d2a1 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex cae804a1908..215e3813d7d 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex c58fe8c936c..32cabad7cf6 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -32,6 +32,7 @@\n #include \"refs.h\"\n #include \"remote.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hook.h\"\n \n #define FAILED_RUN \"failed to run %s\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex c590fcb19dd..3c9c6b38031 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex 1848768b97c..f233eda7590 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -6,6 +6,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 53f2812dfb1..3fde5c4fd35 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -5,6 +5,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n #include \"config-list.h\"\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex f95b7965c58..88051795c7f 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hook.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex b451755f405..bae5b054039 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"delta.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex dcaaf102eaf..e182bc7e839 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex e58627c72a9..107ac28f0e8 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"trailer.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b62e629ba88..7b107d254df 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -7,6 +7,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex a03b559ecaa..09deb752ab3 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -11,6 +11,7 @@\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex 2dfbd8ed9b9..11d9424804a 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n #include \"ref-filter.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 64d8e54318c..b4835f1d4cc 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex 01d16ef9e5a..e8bb011cfb4 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -4,6 +4,7 @@\n  */\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\n #include \"mailinfo.h\"\ndiff --git a/builtin/mailsplit.c b/builtin/mailsplit.c\nindex 73509f651bd..b08069ce60a 100644\n--- a/builtin/mailsplit.c\n+++ b/builtin/mailsplit.c\n@@ -6,6 +6,7 @@\n  */\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex be8f3b221c9..e0995f3219f 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"diff.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex c923bbf2abb..ae45f523b95 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex b9acbf5d342..a49fab9bcb1 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"merge-recursive.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex e7825181648..89b807388a4 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -3,6 +3,7 @@\n #include \"tree-walk.h\"\n #include \"xdiff-interface.h\"\n #include \"help.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"commit.h\"\n #include \"commit-reach.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 19c31d4ff48..a90ae5d2ddc 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 42c2457c705..e93aee72258 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"tag.h\"\ndiff --git a/builtin/mktree.c b/builtin/mktree.c\nindex 848c7b47476..09a7bd5c5c2 100644\n--- a/builtin/mktree.c\n+++ b/builtin/mktree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"quote.h\"\n #include \"tree.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 9a18a82b057..e6757a44470 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\n #include \"trace2.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 81290503775..c02dddb72b5 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 723ba616a88..6977a5f580b 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 75ce7f3f574..8e9be33ddbb 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"notes.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 545b8bddc8e..1ca800c7c50 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex 82115c5808c..3451971b564 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -7,6 +7,7 @@\n */\n \n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"packfile.h\"\ndiff --git a/builtin/pack-refs.c b/builtin/pack-refs.c\nindex 27c2ca06acb..9833815fb30 100644\n--- a/builtin/pack-refs.c\n+++ b/builtin/pack-refs.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\n #include \"repository.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 338b15cd7b0..9d5585d3a72 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/prune-packed.c b/builtin/prune-packed.c\nindex da3273a268b..ca3578e1588 100644\n--- a/builtin/prune-packed.c\n+++ b/builtin/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"prune-packed.h\"\n \ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 119a253a2ad..ff62a0adb8f 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 56f679d94a0..1a1a89af055 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 12a402aea3d..2d76fa68376 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex aecfae12d3a..97724fd0ed7 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"range-diff.h\"\n #include \"config.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 11759c415f3..ec66008d07e 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -7,6 +7,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex dd31d5ab91e..a2c68b8ff7b 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -6,6 +6,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex fe68c79ee31..d1b6bd6eef4 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 270681dcdf4..0879d4d2246 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"reachable.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 729f6f3643a..2074d6be28c 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"transport.h\"\n #include \"remote.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 87f73c8923a..771ca01527d 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 71d8e949e35..cf85e590d9f 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 94ffb8c21ab..24c78755723 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 58f567afd3e..6487cf694f5 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -10,6 +10,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"tag.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 85e522dff8a..f2f6a0d3e67 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"list-objects.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex e1fa9c6348c..5a932a861b4 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -8,6 +8,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"quote.h\"\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 62986a7b1b0..dd6587a99d8 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -4,6 +4,7 @@\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"rerere.h\"\n #include \"dir.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex dc198f79082..5982c3d8122 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -11,6 +11,7 @@\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"cache-tree.h\"\n+#include \"gettext.h\"\n #include \"tree-walk.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 27a87167e19..d8c4379ea16 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"revision.h\"\n #include \"utf8.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 8342b68aef7..8d569629726 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pretty.h\"\n #include \"refs.h\"\ndiff --git a/builtin/show-index.c b/builtin/show-index.c\nindex 98ec40ddf46..d4bbbbcd6ce 100644\n--- a/builtin/show-index.c\n+++ b/builtin/show-index.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 1f28d7fe4b9..a5df7587d51 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 8d5ae6f2a60..3976d8e86b8 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"repository.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 6a12fed2713..65817d0b763 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 1e34cf2bebd..d8e61459333 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d05d1a84623..a4bdd44daa3 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"cache.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex e00768a8b7e..10198a74fae 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 7cdcd4293d6..4f9047783a5 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 1908dcfcffb..f7c4b531076 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"object.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 11dc1352716..ef78b2d28e1 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex a84e7b47a20..fdf51495b51 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex d2239c9ef4d..e7bff27ae40 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n static const char * const update_server_info_usage[] = {\ndiff --git a/builtin/upload-pack.c b/builtin/upload-pack.c\nindex 7a3c68720f1..beb9dd08610 100644\n--- a/builtin/upload-pack.c\n+++ b/builtin/upload-pack.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"pkt-line.h\"\n #include \"parse-options.h\"\n #include \"protocol.h\"\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 7aedf10e856..22e5afc069e 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex 27d6f75fd8a..190fd695409 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5c00b0b0f77..850e1a11c7b 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 80d05e246d8..ed89b7e9725 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"strvec.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 7ad0d059453..7eec4e3cbd1 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex d64cd5c52d0..778ca1e0f4f 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"repository.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 177c1810402..2cc7d159bd6 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 \"gettext.h\"\n #include \"object-store.h\"\n #include \"refs.h\"\n #include \"run-command.h\"\ndiff --git a/bundle.c b/bundle.c\nindex 99d7de97f6c..f5b3643b17e 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"lockfile.h\"\n #include \"bundle.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/chunk-format.c b/chunk-format.c\nindex f65e9a1e429..6d1071729df 100644\n--- a/chunk-format.c\n+++ b/chunk-format.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"chunk-format.h\"\n #include \"csum-file.h\"\n+#include \"gettext.h\"\n \n /*\n  * When writing a chunk-based file format, collect the chunks in\ndiff --git a/color.c b/color.c\nindex 6b577ce0a75..672dcbb73a6 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 5e6098ff356..8f21a0a0c20 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\ndiff --git a/commit.c b/commit.c\nindex 7b63d3b0e1c..3fdfb325117 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -2,6 +2,7 @@\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"commit-graph.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/common-main.c b/common-main.c\nindex 0a22861f1ce..184d1534d2d 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"attr.h\"\n \n /*\ndiff --git a/compat/disk.h b/compat/disk.h\nindex 50a32e3d8a4..a04a8d294af 100644\n--- a/compat/disk.h\n+++ b/compat/disk.h\n@@ -2,6 +2,7 @@\n #define COMPAT_DISK_H\n \n #include \"git-compat-util.h\"\n+#include \"gettext.h\"\n \n static int get_disk_info(struct strbuf *out)\n {\ndiff --git a/compat/fsmonitor/fsm-health-win32.c b/compat/fsmonitor/fsm-health-win32.c\nindex 2ea08c1d4e8..fe11bdd9ce6 100644\n--- a/compat/fsmonitor/fsm-health-win32.c\n+++ b/compat/fsmonitor/fsm-health-win32.c\n@@ -3,6 +3,7 @@\n #include \"fsmonitor.h\"\n #include \"fsm-health.h\"\n #include \"fsmonitor--daemon.h\"\n+#include \"gettext.h\"\n \n /*\n  * Every minute wake up and test our health.\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 97a55a6f0a4..5eb6402ab82 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -28,6 +28,7 @@\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n \n struct fsm_listen_data\n {\ndiff --git a/compat/fsmonitor/fsm-listen-win32.c b/compat/fsmonitor/fsm-listen-win32.c\nindex 03df8d951b8..7b07b74ba5b 100644\n--- a/compat/fsmonitor/fsm-listen-win32.c\n+++ b/compat/fsmonitor/fsm-listen-win32.c\n@@ -3,6 +3,7 @@\n #include \"fsmonitor.h\"\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\n+#include \"gettext.h\"\n \n /*\n  * The documentation of ReadDirectoryChangesW() states that the maximum\ndiff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/compat/fsmonitor/fsm-path-utils-darwin.c\nindex ce5a8febe09..45eb4a9b9e7 100644\n--- a/compat/fsmonitor/fsm-path-utils-darwin.c\n+++ b/compat/fsmonitor/fsm-path-utils-darwin.c\n@@ -1,5 +1,6 @@\n #include \"fsmonitor.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n #include <dirent.h>\n #include <errno.h>\n #include <fcntl.h>\ndiff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/compat/fsmonitor/fsm-path-utils-win32.c\nindex 0d95bbb416f..4024baafb97 100644\n--- a/compat/fsmonitor/fsm-path-utils-win32.c\n+++ b/compat/fsmonitor/fsm-path-utils-win32.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n \n /*\n  * Check remote working directory protocol.\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 3afbde78944..a9e5570288c 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #define SECURITY_WIN32\n #include <sspi.h>\n \ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex cce1d57a464..56d36cdf22a 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\n \ndiff --git a/compat/simple-ipc/ipc-unix-socket.c b/compat/simple-ipc/ipc-unix-socket.c\nindex 28a79289d4f..152db60a311 100644\n--- a/compat/simple-ipc/ipc-unix-socket.c\n+++ b/compat/simple-ipc/ipc-unix-socket.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c\nindex 20ea7b65e0b..f011e5cead8 100644\n--- a/compat/simple-ipc/ipc-win32.c\n+++ b/compat/simple-ipc/ipc-win32.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex ea490a7ced4..afebe6b2496 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"compat/terminal.h\"\n+#include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\ndiff --git a/config.c b/config.c\nindex 983c45fc37b..f30a6d8e686 100644\n--- a/config.c\n+++ b/config.c\n@@ -11,6 +11,7 @@\n #include \"branch.h\"\n #include \"config.h\"\n #include \"environment.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"repository.h\"\n #include \"lockfile.h\"\ndiff --git a/connect.c b/connect.c\nindex 134069574a2..1dab0d79c48 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"quote.h\"\ndiff --git a/connected.c b/connected.c\nindex 39cb1e1074d..a4c0aece757 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"run-command.h\"\ndiff --git a/convert.c b/convert.c\nindex 349c7e4af15..2bd54244b55 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\ndiff --git a/credential.c b/credential.c\nindex ea40a2a410b..5244f3c12c0 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"credential.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"url.h\"\ndiff --git a/date.c b/date.c\nindex 6f45eeb3568..1fb2cd1b538 100644\n--- a/date.c\n+++ b/date.c\n@@ -6,6 +6,7 @@\n \n #include \"cache.h\"\n #include \"date.h\"\n+#include \"gettext.h\"\n \n /*\n  * This is like mktime, but without normalization of tm_wday and tm_yday.\ndiff --git a/delta-islands.c b/delta-islands.c\nindex fe12c93005b..1222b6a6cd1 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -4,6 +4,7 @@\n #include \"object.h\"\n #include \"blob.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"tree.h\"\ndiff --git a/diagnose.c b/diagnose.c\nindex 5b398f0cffc..169a55407fd 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -4,6 +4,7 @@\n #include \"archive.h\"\n #include \"dir.h\"\n #include \"help.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strvec.h\"\n #include \"object-store.h\"\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 70b3578b907..a7e04009873 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -6,6 +6,7 @@\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"cache-tree.h\"\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex a3cf358baf0..287a113badd 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -11,6 +11,7 @@\n #include \"tag.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"log-tree.h\"\n #include \"parse-options.h\"\ndiff --git a/diff.c b/diff.c\nindex 00d47281a1d..00746f2f86e 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\n #include \"diff.h\"\ndiff --git a/dir.c b/dir.c\nindex d5bb199f4b4..46f1bb6e5b7 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -9,6 +9,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\n #include \"refs.h\"\ndiff --git a/editor.c b/editor.c\nindex 008c04fe2f6..58e790548d2 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\ndiff --git a/entry.c b/entry.c\nindex c97cfa833bb..acb76a61aca 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -2,6 +2,7 @@\n #include \"blob.h\"\n #include \"object-store.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"submodule.h\"\ndiff --git a/environment.c b/environment.c\nindex 89d89110e41..82a1fc17d0b 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"environment.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"refs.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 0232bbc9905..282d95af081 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"strvec.h\"\n \ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 4ddabb4ec76..359dce6afed 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\ndiff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c\nindex 19d772f0f3a..866828e2992 100644\n--- a/fsmonitor-ipc.c\n+++ b/fsmonitor-ipc.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"fsmonitor.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"fsmonitor-ipc.h\"\n #include \"run-command.h\"\ndiff --git a/git.c b/git.c\nindex ae2134f29a8..22ce4f14b65 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"help.h\"\n #include \"run-command.h\"\n #include \"alias.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 855970bb939..632265691e5 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"dir.h\"\ndiff --git a/grep.c b/grep.c\nindex 68e9328dfd4..febb076a7e6 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"grep.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 8db35b9767d..454933351b2 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"http.h\"\n #include \"walker.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex 93e9018439c..c65a27219c6 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -25,6 +25,7 @@\n #include \"config.h\"\n #include \"credential.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\ndiff --git a/list-objects-filter-options.h b/list-objects-filter-options.h\nindex ef03b45132e..65c6119e9d3 100644\n--- a/list-objects-filter-options.h\n+++ b/list-objects-filter-options.h\n@@ -1,6 +1,7 @@\n #ifndef LIST_OBJECTS_FILTER_OPTIONS_H\n #define LIST_OBJECTS_FILTER_OPTIONS_H\n \n+#include \"gettext.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/list-objects-filter.c b/list-objects-filter.c\nindex 5d7b3316608..298ca08711e 100644\n--- a/list-objects-filter.c\n+++ b/list-objects-filter.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"commit.h\"\ndiff --git a/list-objects.c b/list-objects.c\nindex ab5745bbfe4..3906ac442dd 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"tag.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"blob.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex cc9a4b84283..ab6490a391d 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n \n /*\ndiff --git a/ls-refs.c b/ls-refs.c\nindex 8091b0cca8c..ae38889bf04 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.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 748924a69ba..c00dfbab1cd 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n \ndiff --git a/merge-ort.c b/merge-ort.c\nindex 4c5be8ed910..a26cad5f910 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -26,6 +26,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"entry.h\"\n #include \"ll-merge.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 89731f40908..0b0255ebc80 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -17,6 +17,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"ll-merge.h\"\n #include \"lockfile.h\"\ndiff --git a/merge.c b/merge.c\nindex 2c8b8456842..da7fa652c27 100644\n--- a/merge.c\n+++ b/merge.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\ndiff --git a/midx.c b/midx.c\nindex 47989f7ea70..e132ef250e4 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"csum-file.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"packfile.h\"\ndiff --git a/name-hash.c b/name-hash.c\nindex cd009c7c8ae..bb9eae55aca 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2008 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"sparse-index.h\"\ndiff --git a/notes-merge.c b/notes-merge.c\nindex 5b1a9ff13f7..c8d0020b1a2 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex d7d18e30f5a..da08e2e8e5c 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\n #include \"repository.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 8fab8dbe80b..39660d49dbc 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -9,6 +9,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"string-list.h\"\n #include \"lockfile.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 69db1ec498a..2c927bbded3 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"commit.h\"\ndiff --git a/object.c b/object.c\nindex 609fed1b73d..45c9721b8c8 100644\n--- a/object.c\n+++ b/object.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object.h\"\n #include \"replace-object.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 891d9d2772e..7dc7f0ba55e 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex ca7c81b5c9f..241ac9166c1 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"tag.h\"\ndiff --git a/pack-mtimes.c b/pack-mtimes.c\nindex cd92fc1d86c..afed6321906 100644\n--- a/pack-mtimes.c\n+++ b/pack-mtimes.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"pack-mtimes.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/pack-revindex.c b/pack-revindex.c\nindex 08dc1601679..03c7e81f9da 100644\n--- a/pack-revindex.c\n+++ b/pack-revindex.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"pack-revindex.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/pack-write.c b/pack-write.c\nindex 041e573bc16..87156f89d2b 100644\n--- a/pack-write.c\n+++ b/pack-write.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/packfile.c b/packfile.c\nindex fc2d7c2190a..b1718b93d4b 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"list.h\"\n #include \"pack.h\"\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 2455aa356db..38c4dc665d5 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parallel-checkout.h\"\n #include \"pkt-line.h\"\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex d346dbe2100..fbf4b010195 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\n #include \"oid-array.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex fd4743293fc..815c392aaec 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -4,6 +4,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n \n static int disallow_abbreviated_options;\ndiff --git a/parse-options.h b/parse-options.h\nindex 50d852f2991..d57868eff93 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -1,6 +1,8 @@\n #ifndef PARSE_OPTIONS_H\n #define PARSE_OPTIONS_H\n \n+#include \"gettext.h\"\n+\n /**\n  * Refer to Documentation/technical/api-parse-options.txt for the API doc.\n  */\ndiff --git a/path.c b/path.c\nindex 632a051809a..3f2702cbe49 100644\n--- a/path.c\n+++ b/path.c\n@@ -2,6 +2,7 @@\n  * Utilities for paths and pathnames\n  */\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex ab70fcbe613..868b4d280ca 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\n #include \"strvec.h\"\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 1ea7f8600ec..c8b90b2242e 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"pkt-line.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n \ndiff --git a/preload-index.c b/preload-index.c\nindex 100f7a374dc..4b45e1d6912 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -5,6 +5,7 @@\n #include \"pathspec.h\"\n #include \"dir.h\"\n #include \"fsmonitor.h\"\n+#include \"gettext.h\"\n #include \"config.h\"\n #include \"progress.h\"\n #include \"thread-utils.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 05b557d0961..9d7922dcc60 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"utf8.h\"\n #include \"diff.h\"\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex 1db566982ec..a8dbb788e8f 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"promisor-remote.h\"\ndiff --git a/prune-packed.c b/prune-packed.c\nindex e02f466c2ee..cff5ad569c7 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"progress.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex 4bd65ab7496..1bfc612e274 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"range-diff.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/reachable.c b/reachable.c\nindex c9dab2a66b9..b0f85046e9c 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"tag.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex 1bcf6732718..63789ea5e21 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -18,6 +18,7 @@\n #include \"tree.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"gettext.h\"\n #include \"resolve-undo.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7407c593191..649c94e69a6 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\n #include \"strbuf.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 38141bce8db..9a830bedef0 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/ref-filter.h b/ref-filter.h\nindex aa0eea4ecf5..cc811c2cadd 100644\n--- a/ref-filter.h\n+++ b/ref-filter.h\n@@ -1,6 +1,7 @@\n #ifndef REF_FILTER_H\n #define REF_FILTER_H\n \n+#include \"gettext.h\"\n #include \"oid-array.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 04630f56ec6..d1c39374318 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"reflog.h\"\n #include \"refs.h\"\ndiff --git a/refs.c b/refs.c\nindex 4e5cc73fb10..8684f4610f5 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -6,6 +6,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hashmap.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"iterator.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 31bc5c45ee6..de3628ff3f1 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 \"../gettext.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 6f975185995..3334c07003c 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1,6 +1,7 @@\n #include \"../cache.h\"\n #include \"../alloc.h\"\n #include \"../config.h\"\n+#include \"../gettext.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex ed7e3a043ac..943cd6fe6cd 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\n #include \"connect.h\"\ndiff --git a/remote.c b/remote.c\nindex 2daddb85cb7..edb1e07497c 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\n #include \"urlmatch.h\"\ndiff --git a/replace-object.c b/replace-object.c\nindex 0cf056c4fbf..9e30e0362ba 100644\n--- a/replace-object.c\n+++ b/replace-object.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\n #include \"object-store.h\"\ndiff --git a/rerere.c b/rerere.c\nindex a67abaab077..9428cbca7b2 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\ndiff --git a/rerere.h b/rerere.h\nindex c32d79c3bd8..7899dc21747 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -1,6 +1,7 @@\n #ifndef RERERE_H\n #define RERERE_H\n \n+#include \"gettext.h\"\n #include \"string-list.h\"\n \n struct pathspec;\ndiff --git a/reset.c b/reset.c\nindex 58b3829ff73..604d9325b78 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache-tree.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\ndiff --git a/revision.c b/revision.c\nindex e4c066e90b7..7423e23327b 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"tag.h\"\ndiff --git a/run-command.c b/run-command.c\nindex ba617655b23..2c8b4cd9bfc 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"thread-utils.h\"\ndiff --git a/send-pack.c b/send-pack.c\nindex 423a5cfe22d..f531cb48212 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex fb99115be5b..bc7e72d5fef 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/setup.c b/setup.c\nindex cefd5f63c46..8a4ccee4c2c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/sideband.c b/sideband.c\nindex 85bddfdcd4f..4905cf9b32a 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"color.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"sideband.h\"\n #include \"help.h\"\n #include \"pkt-line.h\"\ndiff --git a/sparse-index.c b/sparse-index.c\nindex 63216b3e57f..fdae9011b8e 100644\n--- a/sparse-index.c\n+++ b/sparse-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"sparse-index.h\"\n #include \"tree.h\"\ndiff --git a/split-index.c b/split-index.c\nindex 95ecfa53195..c98807c655b 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"split-index.h\"\n #include \"ewah/ewok.h\"\n \ndiff --git a/strbuf.c b/strbuf.c\nindex 8800830ebf8..15209777d5a 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"string-list.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 89a7bf0a93d..38663801aa4 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 0baf97cf770..8b551e53274 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -7,6 +7,7 @@\n #include \"dir.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"run-command.h\"\ndiff --git a/symlinks.c b/symlinks.c\nindex c667baa949b..c35c8d4408d 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.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/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex 615e648e555..8b7a8fce1ee 100644\n--- a/t/helper/test-cache-tree.c\n+++ b/t/helper/test-cache-tree.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 1e975df9041..68bbc41b330 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"merge-ort.h\"\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 05d56267a9f..09c711038ce 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -4,6 +4,7 @@\n #include \"commit.h\"\n #include \"commit-reach.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"ref-filter.h\"\ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 824e5c0a958..497d72058de 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\n \ndiff --git a/trailer.c b/trailer.c\nindex 72c3fed5c6e..9eb1b761190 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"commit.h\"\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 82ac63e2609..105bb801c21 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -4,6 +4,7 @@\n #include \"run-command.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"remote.h\"\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 0e2f5ceb71d..38b6556478d 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -2,6 +2,7 @@\n #include \"tree-walk.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"tree.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex a75fb9f05b4..84e0d2e8afe 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -3,6 +3,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 41b9362cf1b..eea9e6a6e8c 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/usage.c b/usage.c\nindex 5a7c6c346c1..40a1c5a4339 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -3,8 +3,8 @@\n  *\n  * Copyright (C) Linus Torvalds, 2005\n  */\n-#include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n {\ndiff --git a/walker.c b/walker.c\nindex c0469363789..b642fd2c3bc 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"walker.h\"\n #include \"repository.h\"\ndiff --git a/worktree.c b/worktree.c\nindex 9f8f3484ebd..530dd5fbc44 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n #include \"strbuf.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 299d6489a6b..0d4ceba6fc5 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n \n static intmax_t count_fsync_writeout_only;\n static intmax_t count_fsync_hardware_flush;\ndiff --git a/wt-status.c b/wt-status.c\nindex 90525bd26fd..d15f2b0e7e8 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"diffcore.h\"\n-- \ngitgitgadget\n\n"},{"id":"473715","messageId":"f4e15c9e5c2e9ee4ed463a93be90c6080aebb8e5.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 10/16] treewide: remove unnecessary includes of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:56Z","receivedAt":"2023-03-19T06:28:40Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThe last several commits were geared at replacing the include of cache.h\nin strbuf.c with an include of git-compat-util.h.  Unfortunately, I had\nto drop a patch moving some functions from cache.h to object-name.h, due\nto excessive conflicts with other in-flight topics.\n\nHowever, even without that patch, the series of patches so far allows us\nto modify a number of C files to replace an include of cache.h with\ngit-compat-util.h.  Do that to reduce our dependencies.\n\n(If we could have kept our object-name.h patch in this series, it would\nhave also let us reduce the includes in checkout.c and fmt-merge-msg.c\nin addition to strbuf.c).\n\nJust to ensure that nothing else was bringing in cache.h, all of the\naffected files have been checked to ensure that\n    gcc -E -I. $SOURCE_FILE | grep '\"cache.h\"'\nfound no hits and that\n    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}\nsuccessfully compiles without warnings.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/terminal.c      | 2 +-\n gpg-interface.c        | 2 +-\n lockfile.c             | 2 +-\n parse-options.c        | 1 -\n t/helper/test-delta.c  | 1 -\n t/helper/test-trace2.c | 2 +-\n tempfile.c             | 3 ++-\n trace2/tr2_cfg.c       | 4 +++-\n trace2/tr2_cmd_name.c  | 3 ++-\n trace2/tr2_dst.c       | 3 ++-\n trace2/tr2_sid.c       | 3 ++-\n usage.c                | 3 ++-\n 12 files changed, 17 insertions(+), 12 deletions(-)\n\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex ed2b30b38f7..d87e3211892 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"compat/terminal.h\"\n #include \"gettext.h\"\n #include \"sigchain.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 6644701fda0..aceeb083367 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"commit.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex 673c21d17a9..1d5ed016828 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -2,7 +2,7 @@\n  * Copyright (c) 2005, Junio C Hamano\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex 99fa0440b5d..8615367c69d 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,7 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n #include \"abspath.h\"\n-#include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\ndiff --git a/t/helper/test-delta.c b/t/helper/test-delta.c\nindex 6609fcbc12e..e7d134ec251 100644\n--- a/t/helper/test-delta.c\n+++ b/t/helper/test-delta.c\n@@ -11,7 +11,6 @@\n #include \"test-tool.h\"\n #include \"git-compat-util.h\"\n #include \"delta.h\"\n-#include \"cache.h\"\n #include \"wrapper.h\"\n \n static const char usage_str[] =\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex f374c21ec32..a476df6c6cb 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -1,9 +1,9 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n #include \"config.h\"\n+#include \"trace2.h\"\n \n typedef int(fn_unit_test)(int argc, const char **argv);\n \ndiff --git a/tempfile.c b/tempfile.c\nindex cdd2cab3bad..50c377134ce 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -42,7 +42,8 @@\n  * file created by its parent.\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"path.h\"\n #include \"tempfile.h\"\n #include \"sigchain.h\"\n #include \"wrapper.h\"\ndiff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c\nindex ec9ac1a6efd..78cfc15d52d 100644\n--- a/trace2/tr2_cfg.c\n+++ b/trace2/tr2_cfg.c\n@@ -1,5 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"strbuf.h\"\n+#include \"trace2.h\"\n #include \"trace2/tr2_cfg.h\"\n #include \"trace2/tr2_sysenv.h\"\n \ndiff --git a/trace2/tr2_cmd_name.c b/trace2/tr2_cmd_name.c\nindex dd313204f51..b7b5a869b74 100644\n--- a/trace2/tr2_cmd_name.c\n+++ b/trace2/tr2_cmd_name.c\n@@ -1,4 +1,5 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_cmd_name.h\"\n \n #define TR2_ENVVAR_PARENT_NAME \"GIT_TRACE2_PARENT_NAME\"\ndiff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c\nindex 273260e1f18..5be892cd5cd 100644\n--- a/trace2/tr2_dst.c\n+++ b/trace2/tr2_dst.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"sigchain.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_dst.h\"\n #include \"trace2/tr2_sid.h\"\n #include \"trace2/tr2_sysenv.h\"\ndiff --git a/trace2/tr2_sid.c b/trace2/tr2_sid.c\nindex 5f1ce6f85cf..09c4ef0d173 100644\n--- a/trace2/tr2_sid.c\n+++ b/trace2/tr2_sid.c\n@@ -1,5 +1,6 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"hex.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_tbuf.h\"\n #include \"trace2/tr2_sid.h\"\n \ndiff --git a/usage.c b/usage.c\nindex b53c99dbe5b..46d99f8bd43 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -3,8 +3,9 @@\n  *\n  * Copyright (C) Linus Torvalds, 2005\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n+#include \"trace2.h\"\n #include \"wrapper.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n-- \ngitgitgadget\n\n"},{"id":"473717","messageId":"4e6a4030b1ec542014b84b13e651ec2518511f46.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 12/16] treewide: remove cache.h inclusion due to environment.h changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:58Z","receivedAt":"2023-03-19T06:28:42Z","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 csum-file.c            | 2 +-\n gettext.c              | 2 +-\n ls-refs.c              | 2 +-\n notes-utils.c          | 2 +-\n prompt.c               | 2 +-\n prune-packed.c         | 2 +-\n reachable.c            | 2 +-\n t/helper/test-bitmap.c | 2 +-\n trailer.c              | 2 +-\n 9 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/csum-file.c b/csum-file.c\nindex 2d22f80d901..82ae2973d30 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -7,7 +7,7 @@\n  * files. Useful when you write a file that you want to be\n  * able to verify hasn't been messed with afterwards.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n #include \"wrapper.h\"\ndiff --git a/gettext.c b/gettext.c\nindex 85d3d3424eb..5f348708300 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -2,7 +2,7 @@\n  * Copyright (c) 2010 Ævar Arnfjörð Bjarmason\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"exec-cmd.h\"\ndiff --git a/ls-refs.c b/ls-refs.c\nindex 12cbb40a198..b9f3e08ec3d 100644\n--- a/ls-refs.c\n+++ b/ls-refs.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 \"hex.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex 8797271faf1..86552f31c4a 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"commit.h\"\n #include \"environment.h\"\ndiff --git a/prompt.c b/prompt.c\nindex ba10813b313..3baa33f63d8 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"environment.h\"\n #include \"run-command.h\"\ndiff --git a/prune-packed.c b/prune-packed.c\nindex 5a57072a7ac..58412b4fb91 100644\n--- a/prune-packed.c\n+++ b/prune-packed.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 \"object-store.h\"\ndiff --git a/reachable.c b/reachable.c\nindex b0f85046e9c..55bb1143530 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c\nindex ff35f5999b3..5bb489882da 100644\n--- a/t/helper/test-bitmap.c\n+++ b/t/helper/test-bitmap.c\n@@ -1,5 +1,5 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"pack-bitmap.h\"\n \n static int bitmap_list_commits(void)\ndiff --git a/trailer.c b/trailer.c\nindex 6a5091a3c46..a2c3ed6f28c 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"473718","messageId":"66f06731cab2aed5f121fb0f43bc8f0f00984cb8.1679207284.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 09/16] wrapper.h: move declarations for wrapper.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:55Z","receivedAt":"2023-03-19T06:28:48Z","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/am.c                     |  1 +\n builtin/bisect.c                 |  1 +\n builtin/branch.c                 |  1 +\n builtin/bugreport.c              |  2 +-\n builtin/config.c                 |  1 +\n builtin/credential-cache.c       |  1 +\n builtin/difftool.c               |  1 +\n builtin/fast-import.c            |  1 +\n builtin/fmt-merge-msg.c          |  1 +\n builtin/gc.c                     |  1 +\n builtin/get-tar-commit-id.c      |  1 +\n builtin/index-pack.c             |  1 +\n builtin/init-db.c                |  1 +\n builtin/merge.c                  |  1 +\n builtin/pack-objects.c           |  1 +\n builtin/rebase.c                 |  1 +\n builtin/receive-pack.c           |  1 +\n builtin/rerere.c                 |  1 +\n builtin/unpack-file.c            |  1 +\n builtin/worktree.c               |  1 +\n cache.h                          | 32 ----------------------------\n commit-graph.c                   |  1 +\n compat/mingw.c                   |  1 +\n compat/terminal.c                |  1 +\n config.c                         |  1 +\n convert.c                        |  1 +\n copy.c                           |  1 +\n csum-file.c                      |  1 +\n daemon.c                         |  1 +\n diff.c                           |  1 +\n dir.c                            |  1 +\n entry.c                          |  1 +\n environment.c                    |  1 +\n fetch-pack.c                     |  1 +\n gpg-interface.c                  |  1 +\n http-backend.c                   |  1 +\n imap-send.c                      |  1 +\n ll-merge.c                       |  1 +\n merge-recursive.c                |  1 +\n notes-merge.c                    |  1 +\n object-file.c                    |  1 +\n packfile.c                       |  1 +\n parallel-checkout.c              |  1 +\n pkt-line.c                       |  1 +\n read-cache.c                     |  1 +\n rebase-interactive.c             |  1 +\n refs.c                           |  1 +\n refs/files-backend.c             |  3 ++-\n rerere.c                         |  1 +\n sequencer.c                      |  1 +\n server-info.c                    |  1 +\n shallow.c                        |  1 +\n strbuf.c                         |  1 +\n streaming.c                      |  1 +\n t/helper/test-delta.c            |  1 +\n t/helper/test-fsmonitor-client.c |  1 +\n t/helper/test-read-cache.c       |  1 +\n tag.c                            |  1 +\n tempfile.c                       |  1 +\n trace.c                          |  1 +\n transport-helper.c               |  1 +\n transport.c                      |  1 +\n usage.c                          |  1 +\n worktree.c                       |  1 +\n wrapper.c                        |  1 +\n wrapper.h                        | 36 ++++++++++++++++++++++++++++++++\n write-or-die.c                   |  1 +\n 68 files changed, 103 insertions(+), 34 deletions(-)\n create mode 100644 wrapper.h\n\ndiff --git a/apply.c b/apply.c\nindex e5e11b85793..373565a7baf 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -26,6 +26,7 @@\n #include \"rerere.h\"\n #include \"apply.h\"\n #include \"entry.h\"\n+#include \"wrapper.h\"\n \n struct gitdiff_data {\n \tstruct strbuf *root;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 14347ecf9aa..37f82b3eb42 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -38,6 +38,7 @@\n #include \"packfile.h\"\n #include \"repository.h\"\n #include \"pretty.h\"\n+#include \"wrapper.h\"\n \n /**\n  * Returns the length of the first line of msg.\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex c2e614c2890..2db46b04c97 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -11,6 +11,7 @@\n #include \"prompt.h\"\n #include \"quote.h\"\n #include \"revision.h\"\n+#include \"wrapper.h\"\n \n static GIT_PATH_FUNC(git_path_bisect_terms, \"BISECT_TERMS\")\n static GIT_PATH_FUNC(git_path_bisect_expected_rev, \"BISECT_EXPECTED_REV\")\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 56dbee97d20..98475ea5325 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -26,6 +26,7 @@\n #include \"worktree.h\"\n #include \"help.h\"\n #include \"commit-reach.h\"\n+#include \"wrapper.h\"\n \n static const char * const builtin_branch_usage[] = {\n \tN_(\"git branch [<options>] [-r | -a] [--merged] [--no-merged]\"),\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex b5dfad4e12a..160590e4ef6 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -8,7 +8,7 @@\n #include \"hook.h\"\n #include \"hook-list.h\"\n #include \"diagnose.h\"\n-\n+#include \"wrapper.h\"\n \n static void get_system_info(struct strbuf *sys_info)\n {\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 42e6b8d3481..1c1e006ff3f 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -9,6 +9,7 @@\n #include \"urlmatch.h\"\n #include \"quote.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n static const char *const builtin_config_usage[] = {\n \tN_(\"git config [<options>]\"),\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 25f2f71c216..af56a44923d 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 \"wrapper.h\"\n \n #ifndef NO_UNIX_SOCKETS\n \ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex ed06db12085..59465c39f1d 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -27,6 +27,7 @@\n #include \"object-store.h\"\n #include \"dir.h\"\n #include \"entry.h\"\n+#include \"wrapper.h\"\n \n static int trust_exit_code;\n \ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 7307c4657f2..3300b7f30f0 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -23,6 +23,7 @@\n #include \"commit-reach.h\"\n #include \"khash.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n #define PACK_ID_BITS 16\n #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 0f9855b680e..cc812416420 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -3,6 +3,7 @@\n #include \"fmt-merge-msg.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"wrapper.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\n \tN_(\"git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]\"),\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex ef063fc828c..2107e3d1f2c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -35,6 +35,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n #define FAILED_RUN \"failed to run %s\"\n \ndiff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c\nindex 491af9202dc..67457969986 100644\n--- a/builtin/get-tar-commit-id.c\n+++ b/builtin/get-tar-commit-id.c\n@@ -6,6 +6,7 @@\n #include \"tar.h\"\n #include \"builtin.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n static const char builtin_get_tar_commit_id_usage[] =\n \"git get-tar-commit-id\";\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex bae5b054039..2393897cb88 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -19,6 +19,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n+#include \"wrapper.h\"\n \n static const char index_pack_usage[] =\n \"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])\";\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 6f724f694f4..a5d4f5c8ece 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"parse-options.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n #ifndef DEFAULT_GIT_TEMPLATE_DIR\n #define DEFAULT_GIT_TEMPLATE_DIR \"/usr/share/git-core/templates\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 38243e55c5f..f4f4a220f30 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -49,6 +49,7 @@\n #include \"commit-reach.h\"\n #include \"wt-status.h\"\n #include \"commit-graph.h\"\n+#include \"wrapper.h\"\n \n #define DEFAULT_TWOHEAD (1<<0)\n #define DEFAULT_OCTOPUS (1<<1)\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 1ca800c7c50..8b55a088a7c 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -40,6 +40,7 @@\n #include \"shallow.h\"\n #include \"promisor-remote.h\"\n #include \"pack-mtimes.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Objects we are going to pack are collected in the `to_pack` structure.\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex a3f8be88882..d2f8f703d67 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -32,6 +32,7 @@\n #include \"rebase-interactive.h\"\n #include \"reset.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n static char const * const builtin_rebase_usage[] = {\n \tN_(\"git rebase [-i] [options] [--exec <cmd>] \"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 5fab0aed533..e954c85ce3d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -33,6 +33,7 @@\n #include \"commit-reach.h\"\n #include \"worktree.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n static const char * const receive_pack_usage[] = {\n \tN_(\"git receive-pack <git-dir>\"),\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 24c78755723..d4a03707b1a 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -6,6 +6,7 @@\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\n+#include \"wrapper.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex e9b105a5397..4cbb4039293 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n+#include \"wrapper.h\"\n \n static char *create_temp_file(struct object_id *oid)\n {\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex ed614ffddcb..1533b4ab43c 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -16,6 +16,7 @@\n #include \"submodule.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n #include \"quote.h\"\n \n #define BUILTIN_WORKTREE_ADD_USAGE \\\ndiff --git a/cache.h b/cache.h\nindex 705c41992bc..31c722533f9 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1085,10 +1085,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n #define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n-/* set default permissions by passing mode arguments to open(2) */\n-int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n-int git_mkstemp_mode(char *pattern, int mode);\n-\n /*\n  * NOTE NOTE NOTE!!\n  *\n@@ -1423,31 +1419,6 @@ static inline int batch_fsync_enabled(enum fsync_component component)\n \treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n }\n \n-ssize_t read_in_full(int fd, void *buf, size_t count);\n-ssize_t write_in_full(int fd, const void *buf, size_t count);\n-ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);\n-\n-static inline ssize_t write_str_in_full(int fd, const char *str)\n-{\n-\treturn write_in_full(fd, str, strlen(str));\n-}\n-\n-/**\n- * Open (and truncate) the file at path, write the contents of buf to it,\n- * and close it. Dies if any errors are encountered.\n- */\n-void write_file_buf(const char *path, const char *buf, size_t len);\n-\n-/**\n- * Like write_file_buf(), but format the contents into a buffer first.\n- * Additionally, write_file() will append a newline if one is not already\n- * present, making it convenient to write text files:\n- *\n- *   write_file(path, \"counter: %d\", ctr);\n- */\n-__attribute__((format (printf, 2, 3)))\n-void write_file(const char *path, const char *fmt, ...);\n-\n /* pager.c */\n void setup_pager(void);\n int pager_in_use(void);\n@@ -1571,7 +1542,4 @@ int versioncmp(const char *s1, const char *s2);\n  */\n int print_sha1_ellipsis(void);\n \n-/* Return 1 if the file is empty or does not exists, 0 otherwise. */\n-int is_empty_or_missing_file(const char *filename);\n-\n #endif /* CACHE_H */\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 8f21a0a0c20..5481736c76c 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -22,6 +22,7 @@\n #include \"json-writer.h\"\n #include \"trace2.h\"\n #include \"chunk-format.h\"\n+#include \"wrapper.h\"\n \n void git_test_write_commit_graph_or_die(void)\n {\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex cbcd03aea9b..d48899bf7b4 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n+#include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\n #define SECURITY_WIN32\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex afebe6b2496..ed2b30b38f7 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -6,6 +6,7 @@\n #include \"run-command.h\"\n #include \"string-list.h\"\n #include \"hashmap.h\"\n+#include \"wrapper.h\"\n \n #if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)\n \ndiff --git a/config.c b/config.c\nindex 6815919ec30..5b1a5d52052 100644\n--- a/config.c\n+++ b/config.c\n@@ -28,6 +28,7 @@\n #include \"replace-object.h\"\n #include \"refs.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n struct config_source {\n \tstruct config_source *prev;\ndiff --git a/convert.c b/convert.c\nindex 2bd54244b55..da06e2f51cb 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -11,6 +11,7 @@\n #include \"sub-process.h\"\n #include \"utf8.h\"\n #include \"ll-merge.h\"\n+#include \"wrapper.h\"\n \n /*\n  * convert.c - convert a file when checking it out and checking it in.\ndiff --git a/copy.c b/copy.c\nindex 4de6a110f09..c3250f08221 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\n {\ndiff --git a/csum-file.c b/csum-file.c\nindex cce13c0f047..2d22f80d901 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n+#include \"wrapper.h\"\n \n static void verify_buffer_or_die(struct hashfile *f,\n \t\t\t\t const void *buf,\ndiff --git a/daemon.c b/daemon.c\nindex bb795ca3ca9..e35604e194c 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -6,6 +6,7 @@\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n+#include \"wrapper.h\"\n \n #ifdef NO_INITGROUPS\n #define initgroups(x, y) (0) /* nothing */\ndiff --git a/diff.c b/diff.c\nindex 1b0be99c065..1b0b24c21c3 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -33,6 +33,7 @@\n #include \"promisor-remote.h\"\n #include \"dir.h\"\n #include \"strmap.h\"\n+#include \"wrapper.h\"\n \n #ifdef NO_FAST_WORKING_DIRECTORY\n #define FAST_WORKING_DIRECTORY 0\ndiff --git a/dir.c b/dir.c\nindex c72481c60ee..b57c770e68b 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -21,6 +21,7 @@\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n #include \"submodule-config.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Tells read_directory_recursive how a file or directory should be treated.\ndiff --git a/entry.c b/entry.c\nindex acb76a61aca..70212af260b 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -10,6 +10,7 @@\n #include \"fsmonitor.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"wrapper.h\"\n \n static void create_directories(const char *path, int path_len,\n \t\t\t       const struct checkout *state)\ndiff --git a/environment.c b/environment.c\nindex c69571f0b29..bf02f3cf487 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -23,6 +23,7 @@\n #include \"tmp-objdir.h\"\n #include \"chdir-notify.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 359dce6afed..c1190801405 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -30,6 +30,7 @@\n #include \"commit-graph.h\"\n #include \"sigchain.h\"\n #include \"mergesort.h\"\n+#include \"wrapper.h\"\n \n static int transfer_unpack_limit = -1;\n static int fetch_unpack_limit = -1;\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex f9c5b6c3f53..6644701fda0 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -10,6 +10,7 @@\n #include \"sigchain.h\"\n #include \"tempfile.h\"\n #include \"alias.h\"\n+#include \"wrapper.h\"\n \n static int git_gpg_config(const char *, const char *, void *);\n \ndiff --git a/http-backend.c b/http-backend.c\nindex 7e7c19e66b3..42e6c2596e9 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -16,6 +16,7 @@\n #include \"object-store.h\"\n #include \"protocol.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n static const char content_type[] = \"Content-Type\";\n static const char content_length[] = \"Content-Length\";\ndiff --git a/imap-send.c b/imap-send.c\nindex c65a27219c6..aa5b2f252d2 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n+#include \"wrapper.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\n typedef void *SSL;\n #endif\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 130d26501c6..8be38d3bd41 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -11,6 +11,7 @@\n #include \"run-command.h\"\n #include \"ll-merge.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n struct ll_merge_driver;\n \ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 0b0255ebc80..f918cea4c69 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -30,6 +30,7 @@\n #include \"tag.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\n+#include \"wrapper.h\"\n #include \"xdiff-interface.h\"\n \n struct merge_options_internal {\ndiff --git a/notes-merge.c b/notes-merge.c\nindex c8d0020b1a2..ba2970f0702 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -15,6 +15,7 @@\n #include \"strbuf.h\"\n #include \"notes-utils.h\"\n #include \"commit-reach.h\"\n+#include \"wrapper.h\"\n \n struct notes_merge_pair {\n \tstruct object_id obj, base, local, remote;\ndiff --git a/object-file.c b/object-file.c\nindex bee41b30474..bdf68763a50 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -38,6 +38,7 @@\n #include \"promisor-remote.h\"\n #include \"submodule.h\"\n #include \"fsck.h\"\n+#include \"wrapper.h\"\n \n /* The maximum size for an object header. */\n #define MAX_HEADER_LEN 32\ndiff --git a/packfile.c b/packfile.c\nindex b1718b93d4b..0fe844f2075 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -20,6 +20,7 @@\n #include \"midx.h\"\n #include \"commit-graph.h\"\n #include \"promisor-remote.h\"\n+#include \"wrapper.h\"\n \n char *odb_pack_name(struct strbuf *buf,\n \t\t    const unsigned char *hash,\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 38c4dc665d5..50fd7fe31ef 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -12,6 +12,7 @@\n #include \"streaming.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n+#include \"wrapper.h\"\n \n struct pc_worker {\n \tstruct child_process cp;\ndiff --git a/pkt-line.c b/pkt-line.c\nindex c8b90b2242e..30469eb4d8d 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n+#include \"wrapper.h\"\n \n char packet_buffer[LARGE_PACKET_MAX];\n static const char *packet_trace_prefix = \"git\";\ndiff --git a/read-cache.c b/read-cache.c\nindex 63789ea5e21..9a8d5fe97ed 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -32,6 +32,7 @@\n #include \"csum-file.h\"\n #include \"promisor-remote.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n /* Mask for the name length in ce_flags in the on-disk index */\n \ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 649c94e69a6..7c885c35bfd 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -7,6 +7,7 @@\n #include \"commit-slab.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"wrapper.h\"\n \n static const char edit_todo_list_advice[] =\n N_(\"You can fix this with 'git rebase --edit-todo' \"\ndiff --git a/refs.c b/refs.c\nindex 8684f4610f5..385051752f1 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -24,6 +24,7 @@\n #include \"sigchain.h\"\n #include \"date.h\"\n #include \"commit.h\"\n+#include \"wrapper.h\"\n \n /*\n  * List of all available backends\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex de3628ff3f1..eb14d124e3f 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -13,7 +13,8 @@\n #include \"../object.h\"\n #include \"../dir.h\"\n #include \"../chdir-notify.h\"\n-#include \"worktree.h\"\n+#include \"../worktree.h\"\n+#include \"../wrapper.h\"\n \n /*\n  * This backend uses the following flags in `ref_update::flags` for\ndiff --git a/rerere.c b/rerere.c\nindex c3258e13902..b5ccbecdcd2 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -16,6 +16,7 @@\n #include \"object-store.h\"\n #include \"hash-lookup.h\"\n #include \"strmap.h\"\n+#include \"wrapper.h\"\n \n #define RESOLVED 0\n #define PUNTED 1\ndiff --git a/sequencer.c b/sequencer.c\nindex f5fe0df2689..c1ff319cfc1 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -41,6 +41,7 @@\n #include \"rebase-interactive.h\"\n #include \"reset.h\"\n #include \"branch.h\"\n+#include \"wrapper.h\"\n \n #define GIT_REFLOG_ACTION \"GIT_REFLOG_ACTION\"\n \ndiff --git a/server-info.c b/server-info.c\nindex 78643377057..ae96d784e53 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -10,6 +10,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"strbuf.h\"\n+#include \"wrapper.h\"\n \n struct update_info_ctx {\n \tFILE *cur_fp;\ndiff --git a/shallow.c b/shallow.c\nindex c5433a4fd30..7fcba5f6d06 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -17,6 +17,7 @@\n #include \"list-objects.h\"\n #include \"commit-reach.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n void set_alternate_shallow_file(struct repository *r, const char *path, int override)\n {\ndiff --git a/strbuf.c b/strbuf.c\nindex 9633e37b62f..70a83e7980e 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -8,6 +8,7 @@\n #include \"string-list.h\"\n #include \"utf8.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n int starts_with(const char *str, const char *prefix)\n {\ndiff --git a/streaming.c b/streaming.c\nindex 27841dc1d9e..6c69f595045 100644\n--- a/streaming.c\n+++ b/streaming.c\n@@ -7,6 +7,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"packfile.h\"\n+#include \"wrapper.h\"\n \n typedef int (*open_istream_fn)(struct git_istream *,\n \t\t\t       struct repository *,\ndiff --git a/t/helper/test-delta.c b/t/helper/test-delta.c\nindex b15481ea596..6609fcbc12e 100644\n--- a/t/helper/test-delta.c\n+++ b/t/helper/test-delta.c\n@@ -12,6 +12,7 @@\n #include \"git-compat-util.h\"\n #include \"delta.h\"\n #include \"cache.h\"\n+#include \"wrapper.h\"\n \n static const char usage_str[] =\n \t\"test-tool delta (-d|-p) <from_file> <data_file> <out_file>\";\ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex 54a4856c48c..c43fc976b82 100644\n--- a/t/helper/test-fsmonitor-client.c\n+++ b/t/helper/test-fsmonitor-client.c\n@@ -9,6 +9,7 @@\n #include \"fsmonitor-ipc.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n+#include \"wrapper.h\"\n \n #ifndef HAVE_FSMONITOR_DAEMON_BACKEND\n int cmd__fsmonitor_client(int argc, const char **argv)\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex 23e9e27109f..84818363d5b 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 \"wrapper.h\"\n \n int cmd__read_cache(int argc, const char **argv)\n {\ndiff --git a/tag.c b/tag.c\nindex 18b718cca66..3408bb9433f 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -8,6 +8,7 @@\n #include \"gpg-interface.h\"\n #include \"hex.h\"\n #include \"packfile.h\"\n+#include \"wrapper.h\"\n \n const char *tag_type = \"tag\";\n \ndiff --git a/tempfile.c b/tempfile.c\nindex e27048f970b..cdd2cab3bad 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -45,6 +45,7 @@\n #include \"cache.h\"\n #include \"tempfile.h\"\n #include \"sigchain.h\"\n+#include \"wrapper.h\"\n \n static VOLATILE_LIST_HEAD(tempfile_list);\n \ndiff --git a/trace.c b/trace.c\nindex 2b41c683fc8..de004f62988 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -24,6 +24,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\n struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 105bb801c21..09048eab484 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -16,6 +16,7 @@\n #include \"refspec.h\"\n #include \"transport-internal.h\"\n #include \"protocol.h\"\n+#include \"wrapper.h\"\n \n static int debug;\n \ndiff --git a/transport.c b/transport.c\nindex 80059124c0a..c6179b801e8 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -26,6 +26,7 @@\n #include \"object-store.h\"\n #include \"color.h\"\n #include \"bundle-uri.h\"\n+#include \"wrapper.h\"\n \n static int transport_use_color = -1;\n static char transport_colors[][COLOR_MAXLEN] = {\ndiff --git a/usage.c b/usage.c\nindex 40a1c5a4339..b53c99dbe5b 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"wrapper.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n {\ndiff --git a/worktree.c b/worktree.c\nindex d87141f694e..64c96605e53 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -9,6 +9,7 @@\n #include \"dir.h\"\n #include \"wt-status.h\"\n #include \"config.h\"\n+#include \"wrapper.h\"\n \n void free_worktrees(struct worktree **worktrees)\n {\ndiff --git a/wrapper.c b/wrapper.c\nindex df1fa6286d0..ee837575902 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 \"wrapper.h\"\n \n static intmax_t count_fsync_writeout_only;\n static intmax_t count_fsync_hardware_flush;\ndiff --git a/wrapper.h b/wrapper.h\nnew file mode 100644\nindex 00000000000..f0c7d0616d6\n--- /dev/null\n+++ b/wrapper.h\n@@ -0,0 +1,36 @@\n+#ifndef WRAPPER_H\n+#define WRAPPER_H\n+\n+/* set default permissions by passing mode arguments to open(2) */\n+int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n+int git_mkstemp_mode(char *pattern, int mode);\n+\n+ssize_t read_in_full(int fd, void *buf, size_t count);\n+ssize_t write_in_full(int fd, const void *buf, size_t count);\n+ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);\n+\n+static inline ssize_t write_str_in_full(int fd, const char *str)\n+{\n+\treturn write_in_full(fd, str, strlen(str));\n+}\n+\n+/**\n+ * Open (and truncate) the file at path, write the contents of buf to it,\n+ * and close it. Dies if any errors are encountered.\n+ */\n+void write_file_buf(const char *path, const char *buf, size_t len);\n+\n+/**\n+ * Like write_file_buf(), but format the contents into a buffer first.\n+ * Additionally, write_file() will append a newline if one is not already\n+ * present, making it convenient to write text files:\n+ *\n+ *   write_file(path, \"counter: %d\", ctr);\n+ */\n+__attribute__((format (printf, 2, 3)))\n+void write_file(const char *path, const char *fmt, ...);\n+\n+/* Return 1 if the file is empty or does not exists, 0 otherwise. */\n+int is_empty_or_missing_file(const char *filename);\n+\n+#endif /* WRAPPER_H */\ndiff --git a/write-or-die.c b/write-or-die.c\nindex aaa0318e824..a7afc303db2 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"run-command.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Some cases use stdio, but want to flush after the write\n-- \ngitgitgadget\n\n"},{"id":"473719","messageId":"0e84202da90e7edb90f6d7cc62aae4b10c86bbe8.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 14/16] treewide: remove cache.h inclusion due to setup.h changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:28:00Z","receivedAt":"2023-03-19T06:28:52Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nBy moving several declarations to setup.h, the previous patch made it\npossible to remove the include of cache.h in several source files.  Do\nso.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n line-log.c                                   | 1 -\n path.c                                       | 2 +-\n t/helper/test-advise.c                       | 1 -\n t/helper/test-bloom.c                        | 3 +--\n t/helper/test-config.c                       | 1 -\n t/helper/test-pack-mtimes.c                  | 1 -\n t/helper/test-partial-clone.c                | 3 +--\n t/helper/test-proc-receive.c                 | 3 +--\n t/helper/test-read-graph.c                   | 1 -\n t/helper/test-ref-store.c                    | 1 -\n t/helper/test-repository.c                   | 1 -\n t/helper/test-revision-walking.c             | 1 -\n t/helper/test-serve-v2.c                     | 1 -\n t/helper/test-submodule-nested-repo-config.c | 1 -\n t/helper/test-submodule.c                    | 1 -\n t/helper/test-subprocess.c                   | 1 -\n t/helper/test-userdiff.c                     | 1 -\n worktree.c                                   | 2 +-\n 18 files changed, 5 insertions(+), 21 deletions(-)\n\ndiff --git a/line-log.c b/line-log.c\nindex 84c8093c517..10c19daec4a 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -1,7 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"line-range.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"blob.h\"\ndiff --git a/path.c b/path.c\nindex a1702434979..dff215ac693 100644\n--- a/path.c\n+++ b/path.c\n@@ -1,7 +1,7 @@\n /*\n  * Utilities for paths and pathnames\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 4e6ed30afa1..8a3fd0009a0 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"advice.h\"\n #include \"config.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex e5754b8da62..d2b30d644da 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -1,7 +1,6 @@\n-#include \"cache.h\"\n+#include \"test-tool.h\"\n #include \"bloom.h\"\n #include \"hex.h\"\n-#include \"test-tool.h\"\n #include \"commit.h\"\n #include \"setup.h\"\n \ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 5877188f3ad..32d170ec303 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"config.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex 75ca1505a37..0f3fbeec532 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c\nindex cce496944ac..362bd64a4c2 100644\n--- a/t/helper/test-partial-clone.c\n+++ b/t/helper/test-partial-clone.c\n@@ -1,6 +1,5 @@\n-#include \"cache.h\"\n-#include \"hex.h\"\n #include \"test-tool.h\"\n+#include \"hex.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c\nindex 7c8de7b562a..f30022d2225 100644\n--- a/t/helper/test-proc-receive.c\n+++ b/t/helper/test-proc-receive.c\n@@ -1,11 +1,10 @@\n-#include \"cache.h\"\n+#include \"test-tool.h\"\n #include \"connect.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n #include \"setup.h\"\n #include \"sigchain.h\"\n-#include \"test-tool.h\"\n \n static const char *proc_receive_usage[] = {\n \t\"test-tool proc-receive [<options>]\",\ndiff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c\nindex e21b0805f3c..78965a6ebdc 100644\n--- a/t/helper/test-read-graph.c\n+++ b/t/helper/test-read-graph.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit-graph.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 8717b95e84f..d1192c8c039 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex 6774f6245f0..bafd2a5bf95 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit-graph.h\"\n #include \"commit.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex f2df4334063..7750afb2866 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -9,7 +9,6 @@\n  */\n \n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 7d590ab7227..054cbcf5d83 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex aaffd422d6e..d31f5e48ab5 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.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 f18ca46dce4..0e34581b209 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -1,6 +1,5 @@\n #include \"test-tool.h\"\n #include \"test-tool-utils.h\"\n-#include \"cache.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c\nindex 65a355cc590..c344f1694df 100644\n--- a/t/helper/test-subprocess.c\n+++ b/t/helper/test-subprocess.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"run-command.h\"\n #include \"setup.h\"\n \ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex 0cd7ee12b7e..680124a6760 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"setup.h\"\n #include \"userdiff.h\"\n #include \"config.h\"\ndiff --git a/worktree.c b/worktree.c\nindex edef9e161dc..f33826f0a0b 100644\n--- a/worktree.c\n+++ b/worktree.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 \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"473720","messageId":"626d089f10b5e0fbc6e0dfbc05a6b49a87955f46.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:28:01Z","receivedAt":"2023-03-19T06:28:56Z","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-tar.c              |  1 +\n archive-zip.c              |  1 +\n builtin/blame.c            |  1 +\n builtin/cat-file.c         |  1 +\n builtin/check-attr.c       |  1 +\n builtin/check-ignore.c     |  1 +\n builtin/check-mailmap.c    |  1 +\n builtin/credential-cache.c |  1 +\n builtin/credential-store.c |  1 +\n builtin/grep.c             |  1 +\n builtin/hash-object.c      |  1 +\n builtin/log.c              |  1 +\n builtin/notes.c            |  1 +\n builtin/send-pack.c        |  1 +\n builtin/stripspace.c       |  1 +\n builtin/tag.c              |  1 +\n builtin/update-index.c     |  1 +\n bundle.c                   |  1 +\n cache.h                    | 74 ------------------------------------\n config.c                   |  1 +\n csum-file.h                |  1 +\n diagnose.c                 |  1 +\n environment.c              |  1 +\n http-backend.c             |  1 +\n log-tree.c                 |  1 +\n pkt-line.c                 |  1 +\n refs/files-backend.c       |  1 +\n refs/packed-backend.c      |  1 +\n remote-curl.c              |  1 +\n send-pack.c                |  3 +-\n sideband.c                 |  1 +\n t/helper/test-pkt-line.c   |  3 +-\n upload-pack.c              |  1 +\n write-or-die.c             |  3 +-\n write-or-die.h             | 78 ++++++++++++++++++++++++++++++++++++++\n 35 files changed, 114 insertions(+), 77 deletions(-)\n create mode 100644 write-or-die.h\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 16ee133bbf5..497dad0b3af 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -11,6 +11,7 @@\n #include \"object-store.h\"\n #include \"streaming.h\"\n #include \"run-command.h\"\n+#include \"write-or-die.h\"\n \n #define RECORDSIZE\t(512)\n #define BLOCKSIZE\t(RECORDSIZE * 20)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex c02dc33e406..e6f5c10a14f 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -10,6 +10,7 @@\n #include \"utf8.h\"\n #include \"object-store.h\"\n #include \"userdiff.h\"\n+#include \"write-or-die.h\"\n #include \"xdiff-interface.h\"\n #include \"date.h\"\n \ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fb271bae70e..0a3cc019059 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -33,6 +33,7 @@\n #include \"refs.h\"\n #include \"setup.h\"\n #include \"tag.h\"\n+#include \"write-or-die.h\"\n \n static char blame_usage[] = N_(\"git blame [<options>] [<rev-opts>] [<rev>] [--] <file>\");\n static char annotate_usage[] = N_(\"git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>\");\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 365d9234bdb..cf73d187912 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -23,6 +23,7 @@\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n #include \"mailmap.h\"\n+#include \"write-or-die.h\"\n \n enum batch_mode {\n \tBATCH_MODE_CONTENTS,\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex ec37b8164af..1dbe9d6ca88 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -8,6 +8,7 @@\n #include \"quote.h\"\n #include \"setup.h\"\n #include \"parse-options.h\"\n+#include \"write-or-die.h\"\n \n static int all_attrs;\n static int cached_attrs;\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex a45d001e353..9401dad0070 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -8,6 +8,7 @@\n #include \"pathspec.h\"\n #include \"parse-options.h\"\n #include \"submodule.h\"\n+#include \"write-or-die.h\"\n \n static int quiet, verbose, stdin_paths, show_non_matching, no_index;\n static const char * const check_ignore_usage[] = {\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex fa86fd9423d..002d2941e93 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -5,6 +5,7 @@\n #include \"mailmap.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n+#include \"write-or-die.h\"\n \n static int use_stdin;\n static const char * const check_mailmap_usage[] = {\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex af56a44923d..508da4c6e4d 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -2,6 +2,7 @@\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n #ifndef NO_UNIX_SOCKETS\n \ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex da32cfd89e2..8977604eb9d 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -5,6 +5,7 @@\n #include \"credential.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"write-or-die.h\"\n \n static struct lock_file credential_lock;\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex b8ebf014f40..d858bf0bea6 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -28,6 +28,7 @@\n #include \"submodule-config.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n+#include \"write-or-die.h\"\n \n static const char *grep_prefix;\n \ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex a2e160db026..a15fe4fd3f4 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -15,6 +15,7 @@\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\n #include \"setup.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * This is to create corrupt objects for debugging and as such it\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b7b6dfbd1d1..84ec5b504d4 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -40,6 +40,7 @@\n #include \"commit-reach.h\"\n #include \"range-diff.h\"\n #include \"tmp-objdir.h\"\n+#include \"write-or-die.h\"\n \n #define MAIL_DEFAULT_WRAP 72\n #define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 8e9be33ddbb..26cbb564a8e 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -25,6 +25,7 @@\n #include \"notes-merge.h\"\n #include \"notes-utils.h\"\n #include \"worktree.h\"\n+#include \"write-or-die.h\"\n \n static const char * const git_notes_usage[] = {\n \tN_(\"git notes [--ref <notes-ref>] [list [<object>]]\"),\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex fb5b2bad2cc..2b360fee426 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -16,6 +16,7 @@\n #include \"gpg-interface.h\"\n #include \"gettext.h\"\n #include \"protocol.h\"\n+#include \"write-or-die.h\"\n \n static const char * const send_pack_usage[] = {\n \tN_(\"git send-pack [--mirror] [--dry-run] [--force]\\n\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 53930458ffa..9451eb69ff4 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -5,6 +5,7 @@\n #include \"parse-options.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n+#include \"write-or-die.h\"\n \n static void comment_lines(struct strbuf *buf)\n {\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 78b3e44e993..85afa50d724 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -24,6 +24,7 @@\n #include \"column.h\"\n #include \"ref-filter.h\"\n #include \"date.h\"\n+#include \"write-or-die.h\"\n \n static const char * const git_tag_usage[] = {\n \tN_(\"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\\n\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex f97f8d4c9d5..03cda5e60d2 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -23,6 +23,7 @@\n #include \"setup.h\"\n #include \"split-index.h\"\n #include \"fsmonitor.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * Default to not allowing changes to the list of files. The\ndiff --git a/bundle.c b/bundle.c\nindex efeaf6f7151..dac82e2f2d9 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -16,6 +16,7 @@\n #include \"strvec.h\"\n #include \"list-objects-filter-options.h\"\n #include \"connected.h\"\n+#include \"write-or-die.h\"\n \n static const char v2_bundle_signature[] = \"# v2 git bundle\\n\";\n static const char v3_bundle_signature[] = \"# v3 git bundle\\n\";\ndiff --git a/cache.h b/cache.h\nindex bffedd240e7..c43051d7928 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -686,63 +686,6 @@ extern int verify_ce_order;\n \n extern int quote_path_fully;\n \n-/*\n- * These values are used to help identify parts of a repository to fsync.\n- * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the\n- * repository and so shouldn't be fsynced.\n- */\n-enum fsync_component {\n-\tFSYNC_COMPONENT_NONE,\n-\tFSYNC_COMPONENT_LOOSE_OBJECT\t\t= 1 << 0,\n-\tFSYNC_COMPONENT_PACK\t\t\t= 1 << 1,\n-\tFSYNC_COMPONENT_PACK_METADATA\t\t= 1 << 2,\n-\tFSYNC_COMPONENT_COMMIT_GRAPH\t\t= 1 << 3,\n-\tFSYNC_COMPONENT_INDEX\t\t\t= 1 << 4,\n-\tFSYNC_COMPONENT_REFERENCE\t\t= 1 << 5,\n-};\n-\n-#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n-\t\t\t\t  FSYNC_COMPONENT_PACK)\n-\n-#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \\\n-\t\t\t\t\t   FSYNC_COMPONENT_COMMIT_GRAPH)\n-\n-#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \\\n-\t\t\t\t   FSYNC_COMPONENTS_DERIVED_METADATA) & \\\n-\t\t\t\t  ~FSYNC_COMPONENT_LOOSE_OBJECT)\n-\n-#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \\\n-\t\t\t\t    FSYNC_COMPONENT_REFERENCE)\n-\n-#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \\\n-\t\t\t\tFSYNC_COMPONENT_INDEX)\n-\n-#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n-\t\t\t      FSYNC_COMPONENT_PACK | \\\n-\t\t\t      FSYNC_COMPONENT_PACK_METADATA | \\\n-\t\t\t      FSYNC_COMPONENT_COMMIT_GRAPH | \\\n-\t\t\t      FSYNC_COMPONENT_INDEX | \\\n-\t\t\t      FSYNC_COMPONENT_REFERENCE)\n-\n-#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT\n-#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT\n-#endif\n-\n-/*\n- * A bitmask indicating which components of the repo should be fsynced.\n- */\n-extern enum fsync_component fsync_components;\n-extern int fsync_object_files;\n-extern int use_fsync;\n-\n-enum fsync_method {\n-\tFSYNC_METHOD_FSYNC,\n-\tFSYNC_METHOD_WRITEOUT_ONLY,\n-\tFSYNC_METHOD_BATCH,\n-};\n-\n-extern enum fsync_method fsync_method;\n-\n #define MTIME_CHANGED\t0x0001\n #define CTIME_CHANGED\t0x0002\n #define OWNER_CHANGED\t0x0004\n@@ -1045,29 +988,12 @@ int update_server_info(int);\n extern const char *git_mailmap_file;\n extern const char *git_mailmap_blob;\n \n-/* IO helper functions */\n-void maybe_flush_or_die(FILE *, const char *);\n-__attribute__((format (printf, 2, 3)))\n-void fprintf_or_die(FILE *, const char *fmt, ...);\n-void fwrite_or_die(FILE *f, const void *buf, size_t count);\n-void fflush_or_die(FILE *f);\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-void write_or_die(int fd, const void *buf, size_t count);\n-void fsync_or_die(int fd, const char *);\n-int fsync_component(enum fsync_component component, int fd);\n-void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);\n-\n-static inline int batch_fsync_enabled(enum fsync_component component)\n-{\n-\treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n-}\n-\n /* pager.c */\n void setup_pager(void);\n int pager_in_use(void);\ndiff --git a/config.c b/config.c\nindex 03a4fcaba5b..5ad9ae91436 100644\n--- a/config.c\n+++ b/config.c\n@@ -30,6 +30,7 @@\n #include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n struct config_source {\n \tstruct config_source *prev;\ndiff --git a/csum-file.h b/csum-file.h\nindex 793a59da12b..4cd9014e367 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -3,6 +3,7 @@\n \n #include \"cache.h\"\n #include \"hash.h\"\n+#include \"write-or-die.h\"\n \n struct progress;\n \ndiff --git a/diagnose.c b/diagnose.c\nindex 169a55407fd..f9a2496c7ff 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -9,6 +9,7 @@\n #include \"strvec.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n+#include \"write-or-die.h\"\n \n struct archive_dir {\n \tconst char *path;\ndiff --git a/environment.c b/environment.c\nindex 649d16ac27c..63c697e7e97 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -25,6 +25,7 @@\n #include \"setup.h\"\n #include \"shallow.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\ndiff --git a/http-backend.c b/http-backend.c\nindex 042ccf12e8c..89aad1b42c7 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -18,6 +18,7 @@\n #include \"protocol.h\"\n #include \"date.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n static const char content_type[] = \"Content-Type\";\n static const char content_length[] = \"Content-Length\";\ndiff --git a/log-tree.c b/log-tree.c\nindex e2bf8d6df75..ba7b885984f 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -23,6 +23,7 @@\n #include \"help.h\"\n #include \"range-diff.h\"\n #include \"strmap.h\"\n+#include \"write-or-die.h\"\n \n static struct decoration name_decoration = { \"object names\" };\n static int decoration_loaded;\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 30469eb4d8d..36ae0fea4a3 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -4,6 +4,7 @@\n #include \"hex.h\"\n #include \"run-command.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n char packet_buffer[LARGE_PACKET_MAX];\n static const char *packet_trace_prefix = \"git\";\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d2b8925ebd0..e6a6971381e 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -17,6 +17,7 @@\n #include \"../setup.h\"\n #include \"../worktree.h\"\n #include \"../wrapper.h\"\n+#include \"../write-or-die.h\"\n \n /*\n  * This backend uses the following flags in `ref_update::flags` for\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 3334c07003c..1eba1015dd5 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 \"../write-or-die.h\"\n \n enum mmap_strategy {\n \t/*\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 260ea200bb0..0f2410da8e7 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -22,6 +22,7 @@\n #include \"protocol.h\"\n #include \"quote.h\"\n #include \"transport.h\"\n+#include \"write-or-die.h\"\n \n static struct remote *remote;\n /* always ends with a trailing slash */\ndiff --git a/send-pack.c b/send-pack.c\nindex f531cb48212..11f41a8d81e 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -16,8 +16,9 @@\n #include \"version.h\"\n #include \"oid-array.h\"\n #include \"gpg-interface.h\"\n-#include \"cache.h\"\n #include \"shallow.h\"\n+#include \"trace2.h\"\n+#include \"write-or-die.h\"\n \n int option_parse_push_signed(const struct option *opt,\n \t\t\t     const char *arg, int unset)\ndiff --git a/sideband.c b/sideband.c\nindex 4905cf9b32a..0af582858bf 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -5,6 +5,7 @@\n #include \"sideband.h\"\n #include \"help.h\"\n #include \"pkt-line.h\"\n+#include \"write-or-die.h\"\n \n struct keyword_entry {\n \t/*\ndiff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c\nindex c5e052e5378..f4d134a1452 100644\n--- a/t/helper/test-pkt-line.c\n+++ b/t/helper/test-pkt-line.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"test-tool.h\"\n #include \"pkt-line.h\"\n+#include \"write-or-die.h\"\n \n static void pack_line(const char *line)\n {\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 1155f795382..eb3d0b3fa36 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -30,6 +30,7 @@\n #include \"commit-graph.h\"\n #include \"commit-reach.h\"\n #include \"shallow.h\"\n+#include \"write-or-die.h\"\n \n /* Remember to update object flag allocation in object.h */\n #define THEY_HAVE\t(1u << 11)\ndiff --git a/write-or-die.c b/write-or-die.c\nindex a7afc303db2..cc9e0787a1d 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -1,7 +1,8 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"run-command.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * Some cases use stdio, but want to flush after the write\ndiff --git a/write-or-die.h b/write-or-die.h\nnew file mode 100644\nindex 00000000000..65a5c42a47a\n--- /dev/null\n+++ b/write-or-die.h\n@@ -0,0 +1,78 @@\n+#ifndef WRITE_OR_DIE_H\n+#define WRITE_OR_DIE_H\n+\n+void maybe_flush_or_die(FILE *, const char *);\n+__attribute__((format (printf, 2, 3)))\n+void fprintf_or_die(FILE *, const char *fmt, ...);\n+void fwrite_or_die(FILE *f, const void *buf, size_t count);\n+void fflush_or_die(FILE *f);\n+void write_or_die(int fd, const void *buf, size_t count);\n+\n+/*\n+ * These values are used to help identify parts of a repository to fsync.\n+ * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the\n+ * repository and so shouldn't be fsynced.\n+ */\n+enum fsync_component {\n+\tFSYNC_COMPONENT_NONE,\n+\tFSYNC_COMPONENT_LOOSE_OBJECT\t\t= 1 << 0,\n+\tFSYNC_COMPONENT_PACK\t\t\t= 1 << 1,\n+\tFSYNC_COMPONENT_PACK_METADATA\t\t= 1 << 2,\n+\tFSYNC_COMPONENT_COMMIT_GRAPH\t\t= 1 << 3,\n+\tFSYNC_COMPONENT_INDEX\t\t\t= 1 << 4,\n+\tFSYNC_COMPONENT_REFERENCE\t\t= 1 << 5,\n+};\n+\n+#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n+\t\t\t\t  FSYNC_COMPONENT_PACK)\n+\n+#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \\\n+\t\t\t\t\t   FSYNC_COMPONENT_COMMIT_GRAPH)\n+\n+#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \\\n+\t\t\t\t   FSYNC_COMPONENTS_DERIVED_METADATA) & \\\n+\t\t\t\t  ~FSYNC_COMPONENT_LOOSE_OBJECT)\n+\n+#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \\\n+\t\t\t\t    FSYNC_COMPONENT_REFERENCE)\n+\n+#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \\\n+\t\t\t\tFSYNC_COMPONENT_INDEX)\n+\n+#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n+\t\t\t      FSYNC_COMPONENT_PACK | \\\n+\t\t\t      FSYNC_COMPONENT_PACK_METADATA | \\\n+\t\t\t      FSYNC_COMPONENT_COMMIT_GRAPH | \\\n+\t\t\t      FSYNC_COMPONENT_INDEX | \\\n+\t\t\t      FSYNC_COMPONENT_REFERENCE)\n+\n+#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT\n+#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT\n+#endif\n+\n+/* IO helper functions */\n+void fsync_or_die(int fd, const char *);\n+int fsync_component(enum fsync_component component, int fd);\n+void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);\n+\n+/*\n+ * A bitmask indicating which components of the repo should be fsynced.\n+ */\n+extern enum fsync_component fsync_components;\n+extern int fsync_object_files;\n+extern int use_fsync;\n+\n+enum fsync_method {\n+\tFSYNC_METHOD_FSYNC,\n+\tFSYNC_METHOD_WRITEOUT_ONLY,\n+\tFSYNC_METHOD_BATCH,\n+};\n+\n+extern enum fsync_method fsync_method;\n+\n+static inline int batch_fsync_enabled(enum fsync_component component)\n+{\n+\treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n+}\n+\n+#endif /* WRITE_OR_DIE_H */\n-- \ngitgitgadget\n\n"},{"id":"473721","messageId":"38af06f55bc8fd87af580aa94b8a83cdc5b1fd4d.1679207286.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 16/16] csum-file.h: remove unnecessary inclusion of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:28:02Z","receivedAt":"2023-03-19T06:28: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\nWith the change in the last commit to move several functions to\nwrite-or-die.h, csum-file.h no longer needs to include cache.h.\nHowever, removing that include forces several other C files, which\ndirectly or indirectly dependend upon csum-file.h's inclusion of\ncache.h, to now be more explicit about their dependencies.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n bulk-checkin.c      | 2 +-\n chunk-format.c      | 1 +\n commit-graph.c      | 2 +-\n csum-file.h         | 1 -\n delta-islands.c     | 2 +-\n fetch-pack.c        | 2 +-\n midx.c              | 2 +-\n object-file.c       | 2 +-\n pack-bitmap-write.c | 3 ++-\n pack-bitmap.c       | 2 +-\n pack.h              | 2 ++\n packfile.c          | 2 +-\n 12 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex eb6d7a2805b..d2428b86111 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -1,7 +1,7 @@\n /*\n  * Copyright (c) 2011, Google Inc.\n  */\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n #include \"environment.h\"\ndiff --git a/chunk-format.c b/chunk-format.c\nindex 6d1071729df..60a73c1b140 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 \"trace2.h\"\n \n /*\n  * When writing a chunk-based file format, collect the chunks in\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 5481736c76c..f0cd2e7a2a3 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/csum-file.h b/csum-file.h\nindex 4cd9014e367..566e05cbd25 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -1,7 +1,6 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n-#include \"cache.h\"\n #include \"hash.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/delta-islands.c b/delta-islands.c\nindex 1222b6a6cd1..73a01179e83 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"attr.h\"\n #include \"object.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex c453a4168f9..10f759532ce 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/midx.c b/midx.c\nindex b111665dcab..9af3e5de889 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 05fff230f73..397596e3c8f 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 \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 63f16080c9b..0fddeb1298b 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n@@ -17,6 +17,7 @@\n #include \"pack-objects.h\"\n #include \"commit-reach.h\"\n #include \"prio-queue.h\"\n+#include \"trace2.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex 241ac9166c1..23d87e71bd9 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n #include \"gettext.h\"\ndiff --git a/pack.h b/pack.h\nindex 01d385903ad..3ab9e3f60c0 100644\n--- a/pack.h\n+++ b/pack.h\n@@ -4,6 +4,8 @@\n #include \"object.h\"\n #include \"csum-file.h\"\n \n+struct packed_git;\n+struct pack_window;\n struct repository;\n \n /*\ndiff --git a/packfile.c b/packfile.c\nindex cc3b1e242c7..dd4b369e59f 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n-- \ngitgitgadget\n"},{"id":"473722","messageId":"fa7449b5b9990b58b524f106d22c68aaf1a09b77.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 11/16] environment.h: move declarations for environment.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:57Z","receivedAt":"2023-03-19T06:29:03Z","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 archive.c                           |   1 +\n attr.c                              |   1 +\n bisect.c                            |   1 +\n branch.c                            |   1 +\n builtin/am.c                        |   1 +\n builtin/bisect.c                    |   1 +\n builtin/blame.c                     |   1 +\n builtin/cat-file.c                  |   1 +\n builtin/check-attr.c                |   1 +\n builtin/checkout.c                  |   1 +\n builtin/clone.c                     |   1 +\n builtin/commit-graph.c              |   1 +\n builtin/config.c                    |   1 +\n builtin/count-objects.c             |   1 +\n builtin/describe.c                  |   1 +\n builtin/difftool.c                  |   1 +\n builtin/fast-import.c               |   1 +\n builtin/fetch.c                     |   1 +\n builtin/fsmonitor--daemon.c         |   1 +\n builtin/gc.c                        |   1 +\n builtin/index-pack.c                |   1 +\n builtin/init-db.c                   |   1 +\n builtin/log.c                       |   1 +\n builtin/mailinfo.c                  |   1 +\n builtin/multi-pack-index.c          |   1 +\n builtin/mv.c                        |   1 +\n builtin/name-rev.c                  |   1 +\n builtin/pack-objects.c              |   1 +\n builtin/prune.c                     |   1 +\n builtin/push.c                      |   1 +\n builtin/rebase.c                    |   1 +\n builtin/receive-pack.c              |   1 +\n builtin/repack.c                    |   1 +\n builtin/replace.c                   |   1 +\n builtin/reset.c                     |   1 +\n builtin/rev-list.c                  |   1 +\n builtin/rev-parse.c                 |   1 +\n builtin/shortlog.c                  |   1 +\n builtin/show-branch.c               |   1 +\n builtin/sparse-checkout.c           |   1 +\n builtin/stash.c                     |   1 +\n builtin/submodule--helper.c         |   1 +\n builtin/unpack-objects.c            |   1 +\n builtin/update-index.c              |   1 +\n builtin/worktree.c                  |   1 +\n builtin/write-tree.c                |   1 +\n bulk-checkin.c                      |   1 +\n bundle-uri.c                        |   1 +\n bundle.c                            |   1 +\n cache-tree.c                        |   1 +\n cache.h                             | 207 ---------------------------\n combine-diff.c                      |   1 +\n compat/mingw.c                      |   1 +\n compat/precompose_utf8.c            |   1 +\n connect.c                           |   1 +\n daemon.c                            |   1 +\n diff.c                              |   1 +\n dir.c                               |   1 +\n editor.c                            |   1 +\n entry.c                             |   1 +\n environment.h                       | 213 ++++++++++++++++++++++++++++\n exec-cmd.c                          |   1 +\n fetch-pack.c                        |   1 +\n fsmonitor.c                         |   1 +\n gettext.c                           |   1 +\n git.c                               |   1 +\n http-backend.c                      |   1 +\n http-push.c                         |   1 +\n log-tree.c                          |   1 +\n ls-refs.c                           |   1 +\n mailmap.c                           |   1 +\n merge-ort.c                         |   1 +\n merge-recursive.c                   |   1 +\n name-hash.c                         |   1 +\n notes-utils.c                       |   1 +\n notes.c                             |   1 +\n object-file.c                       |   1 +\n object-name.c                       |   1 +\n pack-bitmap-write.c                 |   1 +\n pack-check.c                        |   1 +\n pack-write.c                        |   1 +\n packfile.c                          |   1 +\n parse-options-cb.c                  |   1 +\n path.c                              |   1 +\n pathspec.c                          |   1 +\n preload-index.c                     |   1 +\n pretty.c                            |   1 +\n prompt.c                            |   1 +\n protocol.c                          |   1 +\n prune-packed.c                      |   1 +\n range-diff.c                        |   1 +\n read-cache.c                        |   1 +\n rebase-interactive.c                |   1 +\n ref-filter.c                        |   1 +\n refs.c                              |   1 +\n refs/files-backend.c                |   1 +\n remote-curl.c                       |   1 +\n remote.c                            |   1 +\n revision.c                          |   1 +\n run-command.c                       |   1 +\n server-info.c                       |   1 +\n setup.c                             |   1 +\n sparse-index.c                      |   1 +\n streaming.c                         |   1 +\n submodule-config.c                  |   1 +\n submodule.c                         |   1 +\n t/helper/test-fast-rebase.c         |   1 +\n t/helper/test-lazy-init-name-hash.c |   1 +\n t/helper/test-path-utils.c          |   1 +\n t/helper/test-repository.c          |   1 +\n tag.c                               |   1 +\n tmp-objdir.c                        |   1 +\n trace.c                             |   1 +\n transport-helper.c                  |   1 +\n transport.c                         |   1 +\n unpack-trees.c                      |   1 +\n upload-pack.c                       |   1 +\n worktree.c                          |   1 +\n 119 files changed, 330 insertions(+), 207 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 373565a7baf..a7c0bccb15c 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -16,6 +16,7 @@\n #include \"delta.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/archive.c b/archive.c\nindex c3c45a5ebe9..7aeaaf368f4 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/attr.c b/attr.c\nindex 48e2d646187..62127196cb1 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\ndiff --git a/bisect.c b/bisect.c\nindex 5a3a8182d83..8a4be05dc52 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/branch.c b/branch.c\nindex fced5342d5d..ebfdc18dce4 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"branch.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 37f82b3eb42..192968ac300 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 2db46b04c97..58e6816d8e5 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 21f6b523a6d..9ec82edcbde 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -10,6 +10,7 @@\n #include \"config.h\"\n #include \"color.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 9f1bf8f0e96..365d9234bdb 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"ident.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex ad27255e2cb..5870c4683ab 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"attr.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 3c7ff60b923..e2daad4065c 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"hook.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex b94324ea02c..15dc15408ed 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -12,6 +12,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex 311e0106810..90114269761 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 1c1e006ff3f..cf994a216c0 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -3,6 +3,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 48edc86c240..f3d8f1bcbb0 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex fcacdf8a693..27c6670e934 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 59465c39f1d..3613de6389f 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -17,6 +17,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 3300b7f30f0..068843a5d21 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex c266b6ab4dd..29ec2e7a81f 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 4efb1417344..a280d8bb14f 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 2107e3d1f2c..525c5de5b27 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 \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 2393897cb88..fdce8f88724 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"delta.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex a5d4f5c8ece..2ebc9023f56 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 639d8e90951..b7b6dfbd1d1 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex e14f7c0abce..a032a1c3881 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 579bc2cac0c..1b5083f8b26 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 0a49bf21b0f..c2dd42efbf2 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 6977a5f580b..66f82ef66f4 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 8b55a088a7c..9829b952c2b 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex ff62a0adb8f..5a381fcdf9a 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 2d76fa68376..fa550b8f80a 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex d2f8f703d67..9f3135116ed 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -7,6 +7,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex e954c85ce3d..3e9c5037b19 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 771ca01527d..ccbd5f55562 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex cf85e590d9f..dc0331defc2 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6487cf694f5..0b62c9651e6 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -10,6 +10,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex f2f6a0d3e67..b202647f281 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex a4c0878bc91..bba49d56b9f 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -9,6 +9,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex d8c4379ea16..31f81c25ea2 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"revision.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 8d569629726..c4aa0e62f26 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pretty.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 3976d8e86b8..f6a120c7c45 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 52fa892f7eb..94f81d75d03 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex ff1fd8c87ab..2bf2a1a8be5 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex f7c4b531076..c65ae3b2078 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex ef78b2d28e1..4642afaeb77 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 1533b4ab43c..d9345efdb2b 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -4,6 +4,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 7eec4e3cbd1..6085f64d100 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 778ca1e0f4f..eb6d7a2805b 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 2cc7d159bd6..1ff1cf51dad 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"refs.h\"\ndiff --git a/bundle.c b/bundle.c\nindex f5b3643b17e..efeaf6f7151 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"lockfile.h\"\n #include \"bundle.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 6f899beb041..231c3eb2ff6 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"tree.h\"\ndiff --git a/cache.h b/cache.h\nindex 31c722533f9..720c88f9fd6 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -452,98 +452,10 @@ static inline enum object_type object_type(unsigned int mode)\n \t\tOBJ_BLOB;\n }\n \n-/* Double-check local_repo_env below if you add to this list. */\n-#define GIT_DIR_ENVIRONMENT \"GIT_DIR\"\n-#define GIT_COMMON_DIR_ENVIRONMENT \"GIT_COMMON_DIR\"\n-#define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n-#define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n-#define GIT_PREFIX_ENVIRONMENT \"GIT_PREFIX\"\n-#define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n-#define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n-#define INDEX_ENVIRONMENT \"GIT_INDEX_FILE\"\n-#define GRAFT_ENVIRONMENT \"GIT_GRAFT_FILE\"\n-#define GIT_SHALLOW_FILE_ENVIRONMENT \"GIT_SHALLOW_FILE\"\n-#define TEMPLATE_DIR_ENVIRONMENT \"GIT_TEMPLATE_DIR\"\n-#define CONFIG_ENVIRONMENT \"GIT_CONFIG\"\n-#define CONFIG_DATA_ENVIRONMENT \"GIT_CONFIG_PARAMETERS\"\n-#define CONFIG_COUNT_ENVIRONMENT \"GIT_CONFIG_COUNT\"\n-#define EXEC_PATH_ENVIRONMENT \"GIT_EXEC_PATH\"\n-#define CEILING_DIRECTORIES_ENVIRONMENT \"GIT_CEILING_DIRECTORIES\"\n-#define NO_REPLACE_OBJECTS_ENVIRONMENT \"GIT_NO_REPLACE_OBJECTS\"\n-#define GIT_REPLACE_REF_BASE_ENVIRONMENT \"GIT_REPLACE_REF_BASE\"\n-#define GITATTRIBUTES_FILE \".gitattributes\"\n-#define INFOATTRIBUTES_FILE \"info/attributes\"\n-#define ATTRIBUTE_MACRO_PREFIX \"[attr]\"\n-#define GITMODULES_FILE \".gitmodules\"\n-#define GITMODULES_INDEX \":.gitmodules\"\n-#define GITMODULES_HEAD \"HEAD:.gitmodules\"\n-#define GIT_NOTES_REF_ENVIRONMENT \"GIT_NOTES_REF\"\n-#define GIT_NOTES_DEFAULT_REF \"refs/notes/commits\"\n-#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT \"GIT_NOTES_DISPLAY_REF\"\n-#define GIT_NOTES_REWRITE_REF_ENVIRONMENT \"GIT_NOTES_REWRITE_REF\"\n-#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT \"GIT_NOTES_REWRITE_MODE\"\n-#define GIT_LITERAL_PATHSPECS_ENVIRONMENT \"GIT_LITERAL_PATHSPECS\"\n-#define GIT_GLOB_PATHSPECS_ENVIRONMENT \"GIT_GLOB_PATHSPECS\"\n-#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT \"GIT_NOGLOB_PATHSPECS\"\n-#define GIT_ICASE_PATHSPECS_ENVIRONMENT \"GIT_ICASE_PATHSPECS\"\n-#define GIT_QUARANTINE_ENVIRONMENT \"GIT_QUARANTINE_PATH\"\n-#define GIT_OPTIONAL_LOCKS_ENVIRONMENT \"GIT_OPTIONAL_LOCKS\"\n-#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT \"GIT_TEXTDOMAINDIR\"\n-\n-/*\n- * Environment variable used in handshaking the wire protocol.\n- * Contains a colon ':' separated list of keys with optional values\n- * 'key[=value]'.  Presence of unknown keys and values must be\n- * ignored.\n- */\n-#define GIT_PROTOCOL_ENVIRONMENT \"GIT_PROTOCOL\"\n-/* HTTP header used to handshake the wire protocol */\n-#define GIT_PROTOCOL_HEADER \"Git-Protocol\"\n-\n-/*\n- * This environment variable is expected to contain a boolean indicating\n- * whether we should or should not treat:\n- *\n- *   GIT_DIR=foo.git git ...\n- *\n- * as if GIT_WORK_TREE=. was given. It's not expected that users will make use\n- * of this, but we use it internally to communicate to sub-processes that we\n- * are in a bare repo. If not set, defaults to true.\n- */\n-#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT \"GIT_IMPLICIT_WORK_TREE\"\n-\n-/*\n- * Repository-local GIT_* environment variables; these will be cleared\n- * when git spawns a sub-process that runs inside another repository.\n- * The array is NULL-terminated, which makes it easy to pass in the \"env\"\n- * parameter of a run-command invocation, or to do a simple walk.\n- */\n-extern const char * const local_repo_env[];\n-\n-void setup_git_env(const char *git_dir);\n-\n-/*\n- * Returns true iff we have a configured git repository (either via\n- * setup_git_directory, or in the environment via $GIT_DIR).\n- */\n-int have_git_dir(void);\n-\n-extern int is_bare_repository_cfg;\n-int is_bare_repository(void);\n int is_inside_git_dir(void);\n-extern char *git_work_tree_cfg;\n int is_inside_work_tree(void);\n-const char *get_git_dir(void);\n-const char *get_git_common_dir(void);\n-const char *get_object_directory(void);\n-char *get_index_file(void);\n-char *get_graft_file(struct repository *r);\n-void set_git_dir(const char *path, int make_realpath);\n int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n int get_common_dir(struct strbuf *sb, const char *gitdir);\n-const char *get_git_namespace(void);\n-const char *strip_namespace(const char *namespaced_ref);\n-const char *get_git_work_tree(void);\n \n /*\n  * Return true if the given path is a git directory; note that this _just_\n@@ -578,10 +490,6 @@ const char *read_gitfile_gently(const char *path, int *return_error_code);\n const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n #define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n \n-void set_git_work_tree(const char *tree);\n-\n-#define ALTERNATE_DB_ENVIRONMENT \"GIT_ALTERNATE_OBJECT_DIRECTORIES\"\n-\n void setup_work_tree(void);\n /*\n  * Find the commondir and gitdir of the repository that contains the current\n@@ -840,39 +748,7 @@ void set_alternate_index_output(const char *);\n extern int verify_index_checksum;\n extern int verify_ce_order;\n \n-/* Environment bits from configuration mechanism */\n-extern int trust_executable_bit;\n-extern int trust_ctime;\n-extern int check_stat;\n extern int quote_path_fully;\n-extern int has_symlinks;\n-extern int minimum_abbrev, default_abbrev;\n-extern int ignore_case;\n-extern int assume_unchanged;\n-extern int prefer_symlink_refs;\n-extern int warn_ambiguous_refs;\n-extern int warn_on_object_refname_ambiguity;\n-extern char *apply_default_whitespace;\n-extern char *apply_default_ignorewhitespace;\n-extern const char *git_attributes_file;\n-extern const char *git_hooks_path;\n-extern int zlib_compression_level;\n-extern int pack_compression_level;\n-extern size_t packed_git_window_size;\n-extern size_t packed_git_limit;\n-extern size_t delta_base_cache_limit;\n-extern unsigned long big_file_threshold;\n-extern unsigned long pack_size_limit_cfg;\n-\n-/*\n- * Accessors for the core.sharedrepository config which lazy-load the value\n- * from the config (if not already set). The \"reset\" function can be\n- * used to unset \"set\" or cached value, meaning that the value will be loaded\n- * fresh from the config file on the next call to get_shared_repository().\n- */\n-void set_shared_repository(int value);\n-int get_shared_repository(void);\n-void reset_shared_repository(void);\n \n /*\n  * These values are used to help identify parts of a repository to fsync.\n@@ -930,57 +806,6 @@ enum fsync_method {\n };\n \n extern enum fsync_method fsync_method;\n-extern int core_preload_index;\n-extern int precomposed_unicode;\n-extern int protect_hfs;\n-extern int protect_ntfs;\n-\n-extern int core_apply_sparse_checkout;\n-extern int core_sparse_checkout_cone;\n-extern int sparse_expect_files_outside_of_patterns;\n-\n-/*\n- * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).\n- */\n-int use_optional_locks(void);\n-\n-enum log_refs_config {\n-\tLOG_REFS_UNSET = -1,\n-\tLOG_REFS_NONE = 0,\n-\tLOG_REFS_NORMAL,\n-\tLOG_REFS_ALWAYS\n-};\n-extern enum log_refs_config log_all_ref_updates;\n-\n-enum rebase_setup_type {\n-\tAUTOREBASE_NEVER = 0,\n-\tAUTOREBASE_LOCAL,\n-\tAUTOREBASE_REMOTE,\n-\tAUTOREBASE_ALWAYS\n-};\n-\n-enum push_default_type {\n-\tPUSH_DEFAULT_NOTHING = 0,\n-\tPUSH_DEFAULT_MATCHING,\n-\tPUSH_DEFAULT_SIMPLE,\n-\tPUSH_DEFAULT_UPSTREAM,\n-\tPUSH_DEFAULT_CURRENT,\n-\tPUSH_DEFAULT_UNSPECIFIED\n-};\n-\n-extern enum rebase_setup_type autorebase;\n-extern enum push_default_type push_default;\n-\n-enum object_creation_mode {\n-\tOBJECT_CREATION_USES_HARDLINKS = 0,\n-\tOBJECT_CREATION_USES_RENAMES = 1\n-};\n-\n-extern enum object_creation_mode object_creation_mode;\n-\n-extern char *notes_ref_name;\n-\n-extern int grafts_replace_parents;\n \n /*\n  * GIT_REPO_VERSION is the version we write by default. The\n@@ -989,8 +814,6 @@ extern int grafts_replace_parents;\n  */\n #define GIT_REPO_VERSION 0\n #define GIT_REPO_VERSION_READ 1\n-extern int repository_format_precious_objects;\n-extern int repository_format_worktree_config;\n \n /*\n  * You _have_ to initialize a `struct repository_format` using\n@@ -1362,21 +1185,6 @@ struct pack_entry {\n \tstruct packed_git *p;\n };\n \n-/*\n- * Create a temporary file rooted in the object database directory, or\n- * die on failure. The filename is taken from \"pattern\", which should have the\n- * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n- * \"template\" buffer. Returns the open descriptor.\n- */\n-int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n-\n-/*\n- * Create a pack .keep file named \"name\" (which should generally be the output\n- * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on\n- * error.\n- */\n-int odb_pack_keep(const char *name);\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.\n@@ -1388,11 +1196,6 @@ extern int fetch_if_missing;\n /* Dumb servers support */\n int update_server_info(int);\n \n-const char *get_log_output_encoding(void);\n-const char *get_commit_output_encoding(void);\n-\n-extern const char *git_commit_encoding;\n-extern const char *git_log_output_encoding;\n extern const char *git_mailmap_file;\n extern const char *git_mailmap_blob;\n \n@@ -1429,10 +1232,6 @@ int decimal_width(uintmax_t);\n int check_pager_config(const char *cmd);\n void prepare_pager_args(struct child_process *, const char *pager);\n \n-extern const char *editor_program;\n-extern const char *askpass_program;\n-extern const char *excludes_file;\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@@ -1536,10 +1335,4 @@ void stat_validity_update(struct stat_validity *sv, int fd);\n \n int versioncmp(const char *s1, const char *s2);\n \n-/*\n- * Should we print an ellipsis after an abbreviated SHA-1 value\n- * when doing diff-raw output or indicating a detached HEAD?\n- */\n-int print_sha1_ellipsis(void);\n-\n #endif /* CACHE_H */\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 91051dc3258..3758e47c4f4 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -4,6 +4,7 @@\n #include \"blob.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"quote.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex d48899bf7b4..94c5a1daa40 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n+#include \"../environment.h\"\n #include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 56d36cdf22a..8a9881db077 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\ndiff --git a/connect.c b/connect.c\nindex 1dab0d79c48..9fe01446bc5 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\ndiff --git a/daemon.c b/daemon.c\nindex e35604e194c..b56a8f9717d 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/diff.c b/diff.c\nindex 1b0b24c21c3..dcf1a940942 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\ndiff --git a/dir.c b/dir.c\nindex b57c770e68b..06f8aa3c01b 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -10,6 +10,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\ndiff --git a/editor.c b/editor.c\nindex 2d3e6be64e4..d632d790660 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\ndiff --git a/entry.c b/entry.c\nindex 70212af260b..750c1f6b2f4 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -2,6 +2,7 @@\n #include \"blob.h\"\n #include \"object-store.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\ndiff --git a/environment.h b/environment.h\nindex a26931556af..a63f0c6a24f 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -3,6 +3,8 @@\n \n #include \"strvec.h\"\n \n+struct repository;\n+\n /*\n  * The character that begins a commented line in user-editable file\n  * that is subject to stripspace.\n@@ -16,4 +18,215 @@ extern int auto_comment_line_char;\n  */\n const char *getenv_safe(struct strvec *argv, const char *name);\n \n+/* Double-check local_repo_env below if you add to this list. */\n+#define GIT_DIR_ENVIRONMENT \"GIT_DIR\"\n+#define GIT_COMMON_DIR_ENVIRONMENT \"GIT_COMMON_DIR\"\n+#define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n+#define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n+#define GIT_PREFIX_ENVIRONMENT \"GIT_PREFIX\"\n+#define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n+#define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n+#define INDEX_ENVIRONMENT \"GIT_INDEX_FILE\"\n+#define GRAFT_ENVIRONMENT \"GIT_GRAFT_FILE\"\n+#define GIT_SHALLOW_FILE_ENVIRONMENT \"GIT_SHALLOW_FILE\"\n+#define TEMPLATE_DIR_ENVIRONMENT \"GIT_TEMPLATE_DIR\"\n+#define CONFIG_ENVIRONMENT \"GIT_CONFIG\"\n+#define CONFIG_DATA_ENVIRONMENT \"GIT_CONFIG_PARAMETERS\"\n+#define CONFIG_COUNT_ENVIRONMENT \"GIT_CONFIG_COUNT\"\n+#define EXEC_PATH_ENVIRONMENT \"GIT_EXEC_PATH\"\n+#define CEILING_DIRECTORIES_ENVIRONMENT \"GIT_CEILING_DIRECTORIES\"\n+#define NO_REPLACE_OBJECTS_ENVIRONMENT \"GIT_NO_REPLACE_OBJECTS\"\n+#define GIT_REPLACE_REF_BASE_ENVIRONMENT \"GIT_REPLACE_REF_BASE\"\n+#define GITATTRIBUTES_FILE \".gitattributes\"\n+#define INFOATTRIBUTES_FILE \"info/attributes\"\n+#define ATTRIBUTE_MACRO_PREFIX \"[attr]\"\n+#define GITMODULES_FILE \".gitmodules\"\n+#define GITMODULES_INDEX \":.gitmodules\"\n+#define GITMODULES_HEAD \"HEAD:.gitmodules\"\n+#define GIT_NOTES_REF_ENVIRONMENT \"GIT_NOTES_REF\"\n+#define GIT_NOTES_DEFAULT_REF \"refs/notes/commits\"\n+#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT \"GIT_NOTES_DISPLAY_REF\"\n+#define GIT_NOTES_REWRITE_REF_ENVIRONMENT \"GIT_NOTES_REWRITE_REF\"\n+#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT \"GIT_NOTES_REWRITE_MODE\"\n+#define GIT_LITERAL_PATHSPECS_ENVIRONMENT \"GIT_LITERAL_PATHSPECS\"\n+#define GIT_GLOB_PATHSPECS_ENVIRONMENT \"GIT_GLOB_PATHSPECS\"\n+#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT \"GIT_NOGLOB_PATHSPECS\"\n+#define GIT_ICASE_PATHSPECS_ENVIRONMENT \"GIT_ICASE_PATHSPECS\"\n+#define GIT_QUARANTINE_ENVIRONMENT \"GIT_QUARANTINE_PATH\"\n+#define GIT_OPTIONAL_LOCKS_ENVIRONMENT \"GIT_OPTIONAL_LOCKS\"\n+#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT \"GIT_TEXTDOMAINDIR\"\n+\n+/*\n+ * Environment variable used in handshaking the wire protocol.\n+ * Contains a colon ':' separated list of keys with optional values\n+ * 'key[=value]'.  Presence of unknown keys and values must be\n+ * ignored.\n+ */\n+#define GIT_PROTOCOL_ENVIRONMENT \"GIT_PROTOCOL\"\n+/* HTTP header used to handshake the wire protocol */\n+#define GIT_PROTOCOL_HEADER \"Git-Protocol\"\n+\n+/*\n+ * This environment variable is expected to contain a boolean indicating\n+ * whether we should or should not treat:\n+ *\n+ *   GIT_DIR=foo.git git ...\n+ *\n+ * as if GIT_WORK_TREE=. was given. It's not expected that users will make use\n+ * of this, but we use it internally to communicate to sub-processes that we\n+ * are in a bare repo. If not set, defaults to true.\n+ */\n+#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT \"GIT_IMPLICIT_WORK_TREE\"\n+\n+/*\n+ * Repository-local GIT_* environment variables; these will be cleared\n+ * when git spawns a sub-process that runs inside another repository.\n+ * The array is NULL-terminated, which makes it easy to pass in the \"env\"\n+ * parameter of a run-command invocation, or to do a simple walk.\n+ */\n+extern const char * const local_repo_env[];\n+\n+void setup_git_env(const char *git_dir);\n+\n+/*\n+ * Returns true iff we have a configured git repository (either via\n+ * setup_git_directory, or in the environment via $GIT_DIR).\n+ */\n+int have_git_dir(void);\n+\n+extern int is_bare_repository_cfg;\n+int is_bare_repository(void);\n+extern char *git_work_tree_cfg;\n+const char *get_git_dir(void);\n+const char *get_git_common_dir(void);\n+const char *get_object_directory(void);\n+char *get_index_file(void);\n+char *get_graft_file(struct repository *r);\n+void set_git_dir(const char *path, int make_realpath);\n+const char *get_git_namespace(void);\n+const char *strip_namespace(const char *namespaced_ref);\n+const char *get_git_work_tree(void);\n+void set_git_work_tree(const char *tree);\n+\n+#define ALTERNATE_DB_ENVIRONMENT \"GIT_ALTERNATE_OBJECT_DIRECTORIES\"\n+\n+/* Environment bits from configuration mechanism */\n+extern int trust_executable_bit;\n+extern int trust_ctime;\n+extern int check_stat;\n+extern int has_symlinks;\n+extern int minimum_abbrev, default_abbrev;\n+extern int ignore_case;\n+extern int assume_unchanged;\n+extern int prefer_symlink_refs;\n+extern int warn_ambiguous_refs;\n+extern int warn_on_object_refname_ambiguity;\n+extern char *apply_default_whitespace;\n+extern char *apply_default_ignorewhitespace;\n+extern const char *git_attributes_file;\n+extern const char *git_hooks_path;\n+extern int zlib_compression_level;\n+extern int pack_compression_level;\n+extern size_t packed_git_window_size;\n+extern size_t packed_git_limit;\n+extern size_t delta_base_cache_limit;\n+extern unsigned long big_file_threshold;\n+extern unsigned long pack_size_limit_cfg;\n+\n+/*\n+ * Accessors for the core.sharedrepository config which lazy-load the value\n+ * from the config (if not already set). The \"reset\" function can be\n+ * used to unset \"set\" or cached value, meaning that the value will be loaded\n+ * fresh from the config file on the next call to get_shared_repository().\n+ */\n+void set_shared_repository(int value);\n+int get_shared_repository(void);\n+void reset_shared_repository(void);\n+\n+extern int core_preload_index;\n+extern int precomposed_unicode;\n+extern int protect_hfs;\n+extern int protect_ntfs;\n+\n+extern int core_apply_sparse_checkout;\n+extern int core_sparse_checkout_cone;\n+extern int sparse_expect_files_outside_of_patterns;\n+\n+/*\n+ * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).\n+ */\n+int use_optional_locks(void);\n+\n+enum log_refs_config {\n+\tLOG_REFS_UNSET = -1,\n+\tLOG_REFS_NONE = 0,\n+\tLOG_REFS_NORMAL,\n+\tLOG_REFS_ALWAYS\n+};\n+extern enum log_refs_config log_all_ref_updates;\n+\n+enum rebase_setup_type {\n+\tAUTOREBASE_NEVER = 0,\n+\tAUTOREBASE_LOCAL,\n+\tAUTOREBASE_REMOTE,\n+\tAUTOREBASE_ALWAYS\n+};\n+\n+enum push_default_type {\n+\tPUSH_DEFAULT_NOTHING = 0,\n+\tPUSH_DEFAULT_MATCHING,\n+\tPUSH_DEFAULT_SIMPLE,\n+\tPUSH_DEFAULT_UPSTREAM,\n+\tPUSH_DEFAULT_CURRENT,\n+\tPUSH_DEFAULT_UNSPECIFIED\n+};\n+\n+extern enum rebase_setup_type autorebase;\n+extern enum push_default_type push_default;\n+\n+enum object_creation_mode {\n+\tOBJECT_CREATION_USES_HARDLINKS = 0,\n+\tOBJECT_CREATION_USES_RENAMES = 1\n+};\n+\n+extern enum object_creation_mode object_creation_mode;\n+\n+extern char *notes_ref_name;\n+\n+extern int grafts_replace_parents;\n+\n+extern int repository_format_precious_objects;\n+extern int repository_format_worktree_config;\n+\n+/*\n+ * Create a temporary file rooted in the object database directory, or\n+ * die on failure. The filename is taken from \"pattern\", which should have the\n+ * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n+ * \"template\" buffer. Returns the open descriptor.\n+ */\n+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n+\n+/*\n+ * Create a pack .keep file named \"name\" (which should generally be the output\n+ * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on\n+ * error.\n+ */\n+int odb_pack_keep(const char *name);\n+\n+const char *get_log_output_encoding(void);\n+const char *get_commit_output_encoding(void);\n+\n+extern const char *git_commit_encoding;\n+extern const char *git_log_output_encoding;\n+\n+extern const char *editor_program;\n+extern const char *askpass_program;\n+extern const char *excludes_file;\n+\n+/*\n+ * Should we print an ellipsis after an abbreviated SHA-1 value\n+ * when doing diff-raw output or indicating a detached HEAD?\n+ */\n+int print_sha1_ellipsis(void);\n+\n #endif\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 042d9247a5b..fae0d4b244a 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex c1190801405..c453a4168f9 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/fsmonitor.c b/fsmonitor.c\nindex a5b9e75437b..c956a347a27 100644\n--- a/fsmonitor.c\n+++ b/fsmonitor.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/gettext.c b/gettext.c\nindex 3e7b3baabc6..85d3d3424eb 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -4,6 +4,7 @@\n \n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/git.c b/git.c\nindex 22ce4f14b65..b24c105e83f 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"help.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex 42e6c2596e9..042ccf12e8c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 88aa045ecba..40373bc4863 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex 3adcb576e4c..e2bf8d6df75 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -2,6 +2,7 @@\n #include \"commit-reach.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/ls-refs.c b/ls-refs.c\nindex ae38889bf04..12cbb40a198 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/mailmap.c b/mailmap.c\nindex da2589b0822..2c6e9b238dd 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"string-list.h\"\n #include \"mailmap.h\"\n #include \"object-store.h\"\ndiff --git a/merge-ort.c b/merge-ort.c\nindex a26cad5f910..f3d7c202f52 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -26,6 +26,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"entry.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex f918cea4c69..d5f37724911 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -17,6 +17,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"ll-merge.h\"\ndiff --git a/name-hash.c b/name-hash.c\nindex bb9eae55aca..2c2861efd1c 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2008 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex da08e2e8e5c..8797271faf1 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\ndiff --git a/notes.c b/notes.c\nindex a7187236e98..9288c1a0705 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"notes.h\"\n #include \"object-store.h\"\ndiff --git a/object-file.c b/object-file.c\nindex bdf68763a50..3da6cd68861 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -10,6 +10,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"string-list.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 2c927bbded3..3b0ce8ef05a 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 7dc7f0ba55e..63f16080c9b 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/pack-check.c b/pack-check.c\nindex 7ed594d6679..6974e40a958 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"pack.h\"\ndiff --git a/pack-write.c b/pack-write.c\nindex 87156f89d2b..f1714054951 100644\n--- a/pack-write.c\n+++ b/pack-write.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\ndiff --git a/packfile.c b/packfile.c\nindex 0fe844f2075..cc3b1e242c7 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"list.h\"\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex fbf4b010195..15d008c3daf 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\ndiff --git a/path.c b/path.c\nindex 3976c0d7ace..5d5a15c13d6 100644\n--- a/path.c\n+++ b/path.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 53763e272f5..5fb7b5f26c9 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\ndiff --git a/preload-index.c b/preload-index.c\nindex 4b45e1d6912..52544d004e7 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"fsmonitor.h\"\n #include \"gettext.h\"\n #include \"config.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 9d7922dcc60..2b6d0f52c9f 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"utf8.h\"\ndiff --git a/prompt.c b/prompt.c\nindex 50df17279d1..ba10813b313 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"prompt.h\"\ndiff --git a/protocol.c b/protocol.c\nindex c53f7df5be4..bdb32e1eeb6 100644\n--- a/protocol.c\n+++ b/protocol.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"protocol.h\"\n \n static enum protocol_version parse_protocol_version(const char *value)\ndiff --git a/prune-packed.c b/prune-packed.c\nindex cff5ad569c7..5a57072a7ac 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex 1bfc612e274..815fb24c9ce 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"range-diff.h\"\n #include \"string-list.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex 9a8d5fe97ed..34567c1d550 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -18,6 +18,7 @@\n #include \"tree.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"resolve-undo.h\"\n #include \"run-command.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7c885c35bfd..a83334dd564 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 9a830bedef0..1489fbfe4ae 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/refs.c b/refs.c\nindex 385051752f1..04520e5a6b8 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hashmap.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex eb14d124e3f..0c3138ede8f 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 \"../environment.h\"\n #include \"../gettext.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 943cd6fe6cd..eb382a1e35d 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\ndiff --git a/remote.c b/remote.c\nindex 2bae247a0a4..aeca3ff8136 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\ndiff --git a/revision.c b/revision.c\nindex 7423e23327b..53fdeef0787 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/run-command.c b/run-command.c\nindex 2c8b4cd9bfc..614d48fa9a2 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"run-command.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"sigchain.h\"\ndiff --git a/server-info.c b/server-info.c\nindex ae96d784e53..355b6e01a52 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/setup.c b/setup.c\nindex 8f385d9f29b..cfdc849a78c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/sparse-index.c b/sparse-index.c\nindex fdae9011b8e..886054729e5 100644\n--- a/sparse-index.c\n+++ b/sparse-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"sparse-index.h\"\ndiff --git a/streaming.c b/streaming.c\nindex 6c69f595045..024fd796b7d 100644\n--- a/streaming.c\n+++ b/streaming.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2011, Google Inc.\n  */\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"streaming.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 38663801aa4..28fdfddccfb 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 13ff333f68c..acf030b95e4 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -8,6 +8,7 @@\n #include \"dir.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 68bbc41b330..627a6bdc3d0 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex ab86c14c8ba..2b678a45793 100644\n--- a/t/helper/test-lazy-init-name-hash.c\n+++ b/t/helper/test-lazy-init-name-hash.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"parse-options.h\"\n \n static int single;\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex d3d00dc34fa..cc266e3ec09 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex 10a6dfc2160..c444775eb0f 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -3,6 +3,7 @@\n #include \"commit-graph.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"object.h\"\ndiff --git a/tag.c b/tag.c\nindex 3408bb9433f..39434231799 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"tag.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/tmp-objdir.c b/tmp-objdir.c\nindex fff15cb6b5c..5adad1925d1 100644\n--- a/tmp-objdir.c\n+++ b/tmp-objdir.c\n@@ -3,6 +3,7 @@\n #include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"sigchain.h\"\n #include \"string-list.h\"\n #include \"strbuf.h\"\ndiff --git a/trace.c b/trace.c\nindex de004f62988..9c85b71ec6a 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -23,6 +23,7 @@\n \n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"quote.h\"\n #include \"wrapper.h\"\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 09048eab484..3313bb74099 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -4,6 +4,7 @@\n #include \"run-command.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/transport.c b/transport.c\nindex c6179b801e8..4f06ccbee05 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n #include \"hook.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 84e0d2e8afe..0ff4bbc6b96 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -3,6 +3,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex eea9e6a6e8c..1155f795382 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/worktree.c b/worktree.c\nindex 64c96605e53..3861ab639ca 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n-- \ngitgitgadget\n\n"},{"id":"473723","messageId":"9722988e53748d093af1816f7987897c2345520f.1679207285.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH 13/16] setup.h: move declarations for setup.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-19T06:27:59Z","receivedAt":"2023-03-19T06:29:43Z","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 archive.c                                    |   1 +\n attr.c                                       |   1 +\n blame.c                                      |   1 +\n builtin/blame.c                              |   1 +\n builtin/bugreport.c                          |   1 +\n builtin/bundle.c                             |   1 +\n builtin/check-attr.c                         |   1 +\n builtin/check-ref-format.c                   |   1 +\n builtin/checkout-index.c                     |   1 +\n builtin/checkout.c                           |   1 +\n builtin/clean.c                              |   1 +\n builtin/clone.c                              |   1 +\n builtin/config.c                             |   1 +\n builtin/describe.c                           |   1 +\n builtin/diff-index.c                         |   1 +\n builtin/diff.c                               |   1 +\n builtin/difftool.c                           |   1 +\n builtin/gc.c                                 |   1 +\n builtin/grep.c                               |   1 +\n builtin/hash-object.c                        |   1 +\n builtin/help.c                               |   1 +\n builtin/index-pack.c                         |   1 +\n builtin/init-db.c                            |   1 +\n builtin/ls-files.c                           |   1 +\n builtin/merge-file.c                         |   1 +\n builtin/mv.c                                 |   1 +\n builtin/read-tree.c                          |   1 +\n builtin/reset.c                              |   1 +\n builtin/rev-parse.c                          |   1 +\n builtin/rm.c                                 |   1 +\n builtin/shortlog.c                           |   1 +\n builtin/sparse-checkout.c                    |   1 +\n builtin/stash.c                              |   1 +\n builtin/stripspace.c                         |   1 +\n builtin/submodule--helper.c                  |   1 +\n builtin/update-index.c                       |   1 +\n cache.h                                      | 163 ------------------\n commit.c                                     |   1 +\n common-main.c                                |   1 +\n config.c                                     |   1 +\n daemon.c                                     |   1 +\n diff.c                                       |   1 +\n dir.c                                        |   1 +\n environment.c                                |   1 +\n git.c                                        |   1 +\n http-fetch.c                                 |   1 +\n http-push.c                                  |   1 +\n imap-send.c                                  |   1 +\n line-log.c                                   |   1 +\n mailmap.c                                    |   1 +\n object-file.c                                |   1 +\n object-name.c                                |   1 +\n path.c                                       |   1 +\n pathspec.c                                   |   1 +\n refs.c                                       |   1 +\n refs/files-backend.c                         |   1 +\n remote-curl.c                                |   1 +\n remote.c                                     |   1 +\n repository.c                                 |   1 +\n revision.c                                   |   1 +\n scalar.c                                     |   1 +\n setup.c                                      |   1 +\n setup.h                                      | 168 +++++++++++++++++++\n submodule.c                                  |   1 +\n symlinks.c                                   |   1 +\n t/helper/test-advise.c                       |   1 +\n t/helper/test-bitmap.c                       |   1 +\n t/helper/test-bloom.c                        |   1 +\n t/helper/test-cache-tree.c                   |   1 +\n t/helper/test-config.c                       |   1 +\n t/helper/test-dump-cache-tree.c              |   2 +-\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-split-index.c             |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-fast-rebase.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-oid-array.c                    |   1 +\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   1 +\n t/helper/test-pack-mtimes.c                  |   1 +\n t/helper/test-partial-clone.c                |   1 +\n t/helper/test-path-utils.c                   |   1 +\n t/helper/test-proc-receive.c                 |   1 +\n t/helper/test-reach.c                        |   1 +\n t/helper/test-read-cache.c                   |   1 +\n t/helper/test-read-graph.c                   |   1 +\n t/helper/test-read-midx.c                    |   1 +\n t/helper/test-ref-store.c                    |   1 +\n t/helper/test-repository.c                   |   1 +\n t/helper/test-revision-walking.c             |   1 +\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-serve-v2.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-subprocess.c                   |   1 +\n t/helper/test-userdiff.c                     |   1 +\n t/helper/test-write-cache.c                  |   1 +\n trace.c                                      |   1 +\n unpack-trees.c                               |   1 +\n worktree.c                                   |   1 +\n wt-status.c                                  |   1 +\n 105 files changed, 271 insertions(+), 164 deletions(-)\n create mode 100644 setup.h\n\ndiff --git a/apply.c b/apply.c\nindex a7c0bccb15c..caa2e0a3bc6 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -27,6 +27,7 @@\n #include \"rerere.h\"\n #include \"apply.h\"\n #include \"entry.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/archive.c b/archive.c\nindex 7aeaaf368f4..cdce5b783a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -5,6 +5,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/attr.c b/attr.c\nindex 62127196cb1..2d8aeb8b58c 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -18,6 +18,7 @@\n #include \"quote.h\"\n #include \"revision.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n #include \"thread-utils.h\"\n \n const char git_attr__true[] = \"(builtin)true\";\ndiff --git a/blame.c b/blame.c\nindex b7cd849bb6b..838eb128f01 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -7,6 +7,7 @@\n #include \"diffcore.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"tag.h\"\n #include \"blame.h\"\n #include \"alloc.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 9ec82edcbde..fb271bae70e 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -31,6 +31,7 @@\n #include \"object-store.h\"\n #include \"blame.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"tag.h\"\n \n static char blame_usage[] = N_(\"git blame [<options>] [<rev-opts>] [<rev>] [--] <file>\");\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex 160590e4ef6..52955e1d389 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -8,6 +8,7 @@\n #include \"hook.h\"\n #include \"hook-list.h\"\n #include \"diagnose.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static void get_system_info(struct strbuf *sys_info)\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 8ea1232dbce..9e4ae604580 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"gettext.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 5870c4683ab..ec37b8164af 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -6,6 +6,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"parse-options.h\"\n \n static int all_attrs;\ndiff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c\nindex fd0e5f86832..b0263467424 100644\n--- a/builtin/check-ref-format.c\n+++ b/builtin/check-ref-format.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n static const char builtin_check_ref_format_usage[] =\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 828c0363f8a..7df673e3e70 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -15,6 +15,7 @@\n #include \"parse-options.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"setup.h\"\n \n #define CHECKOUT_ALL 4\n static int nul_term_line;\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex e2daad4065c..015011cf84d 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -23,6 +23,7 @@\n #include \"resolve-undo.h\"\n #include \"revision.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"tree.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex fdcf62c5dfe..14c0d555eac 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 \"setup.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\n #include \"column.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 15dc15408ed..34f46965b95 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -33,6 +33,7 @@\n #include \"branch.h\"\n #include \"remote.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"connected.h\"\n #include \"packfile.h\"\n #include \"list-objects-filter-options.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex cf994a216c0..fe79fb60c43 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -9,6 +9,7 @@\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 27c6670e934..43b62348bc7 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -15,6 +15,7 @@\n #include \"revision.h\"\n #include \"diff.h\"\n #include \"hashmap.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 35dc9b23eef..b9a19bb7d38 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -5,6 +5,7 @@\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n \n static const char diff_cache_usage[] =\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 20bdb6e6cec..3945683bfe4 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -19,6 +19,7 @@\n #include \"revision.h\"\n #include \"log-tree.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"oid-array.h\"\n \ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 3613de6389f..176437d6da3 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -28,6 +28,7 @@\n #include \"object-store.h\"\n #include \"dir.h\"\n #include \"entry.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static int trust_exit_code;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 525c5de5b27..a85f9e3ed3d 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -36,6 +36,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n #define FAILED_RUN \"failed to run %s\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 3c9c6b38031..b8ebf014f40 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -23,6 +23,7 @@\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"pathspec.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex 7651a7a5f56..a2e160db026 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -14,6 +14,7 @@\n #include \"quote.h\"\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\n+#include \"setup.h\"\n \n /*\n  * This is to create corrupt objects for debugging and as such it\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 3fde5c4fd35..87333a02ec4 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -11,6 +11,7 @@\n #include \"config-list.h\"\n #include \"help.h\"\n #include \"alias.h\"\n+#include \"setup.h\"\n \n #ifndef DEFAULT_HELP_FORMAT\n #define DEFAULT_HELP_FORMAT \"man\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex fdce8f88724..823dc5aefb5 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -20,6 +20,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static const char index_pack_usage[] =\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 2ebc9023f56..ba6e0b20fa5 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -12,6 +12,7 @@\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 09deb752ab3..4a8de95ddc4 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -20,6 +20,7 @@\n #include \"string-list.h\"\n #include \"pathspec.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex c0096ee0810..781818d08f5 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"setup.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex c2dd42efbf2..b7c5ffbd8c7 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -16,6 +16,7 @@\n #include \"cache-tree.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"entry.h\"\n \ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex ec66008d07e..5f24453dcd7 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -19,6 +19,7 @@\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"resolve-undo.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 0b62c9651e6..02891e35a84 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -26,6 +26,7 @@\n #include \"parse-options.h\"\n #include \"unpack-trees.h\"\n #include \"cache-tree.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"dir.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex bba49d56b9f..3a5a2ee5b2d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -18,6 +18,7 @@\n #include \"parse-options.h\"\n #include \"diff.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"submodule.h\"\n #include \"commit-reach.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 5982c3d8122..97775e4c4d0 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -15,6 +15,7 @@\n #include \"tree-walk.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"pathspec.h\"\n \ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 31f81c25ea2..59d9c440fb5 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -9,6 +9,7 @@\n #include \"revision.h\"\n #include \"utf8.h\"\n #include \"mailmap.h\"\n+#include \"setup.h\"\n #include \"shortlog.h\"\n #include \"parse-options.h\"\n #include \"trailer.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex f6a120c7c45..512df0f8f54 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -16,6 +16,7 @@\n #include \"unpack-trees.h\"\n #include \"wt-status.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"sparse-index.h\"\n #include \"worktree.h\"\n \ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 94f81d75d03..30d547fff1f 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -18,6 +18,7 @@\n #include \"entry.h\"\n #include \"rerere.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n #include \"log-tree.h\"\n #include \"diffcore.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex d8e61459333..53930458ffa 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n static void comment_lines(struct strbuf *buf)\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 2bf2a1a8be5..3cb4a3ce217 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -12,6 +12,7 @@\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 4642afaeb77..f97f8d4c9d5 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -20,6 +20,7 @@\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"fsmonitor.h\"\n \ndiff --git a/cache.h b/cache.h\nindex 720c88f9fd6..bffedd240e7 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -452,67 +452,6 @@ static inline enum object_type object_type(unsigned int mode)\n \t\tOBJ_BLOB;\n }\n \n-int is_inside_git_dir(void);\n-int is_inside_work_tree(void);\n-int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n-int get_common_dir(struct strbuf *sb, const char *gitdir);\n-\n-/*\n- * Return true if the given path is a git directory; note that this _just_\n- * looks at the directory itself. If you want to know whether \"foo/.git\"\n- * is a repository, you must feed that path, not just \"foo\".\n- */\n-int is_git_directory(const char *path);\n-\n-/*\n- * Return 1 if the given path is the root of a git repository or\n- * submodule, else 0. Will not return 1 for bare repositories with the\n- * exception of creating a bare repository in \"foo/.git\" and calling\n- * is_git_repository(\"foo\").\n- *\n- * If we run into read errors, we err on the side of saying \"yes, it is\",\n- * as we usually consider sub-repos precious, and would prefer to err on the\n- * side of not disrupting or deleting them.\n- */\n-int is_nonbare_repository_dir(struct strbuf *path);\n-\n-#define READ_GITFILE_ERR_STAT_FAILED 1\n-#define READ_GITFILE_ERR_NOT_A_FILE 2\n-#define READ_GITFILE_ERR_OPEN_FAILED 3\n-#define READ_GITFILE_ERR_READ_FAILED 4\n-#define READ_GITFILE_ERR_INVALID_FORMAT 5\n-#define READ_GITFILE_ERR_NO_PATH 6\n-#define READ_GITFILE_ERR_NOT_A_REPO 7\n-#define READ_GITFILE_ERR_TOO_LARGE 8\n-void read_gitfile_error_die(int error_code, const char *path, const char *dir);\n-const char *read_gitfile_gently(const char *path, int *return_error_code);\n-#define read_gitfile(path) read_gitfile_gently((path), NULL)\n-const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n-#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n-\n-void setup_work_tree(void);\n-/*\n- * Find the commondir and gitdir of the repository that contains the current\n- * working directory, without changing the working directory or other global\n- * state. The result is appended to commondir and gitdir.  If the discovered\n- * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will\n- * both have the same result appended to the buffer.  The return value is\n- * either 0 upon success and non-zero if no repository was found.\n- */\n-int discover_git_directory(struct strbuf *commondir,\n-\t\t\t   struct strbuf *gitdir);\n-const char *setup_git_directory_gently(int *);\n-const char *setup_git_directory(void);\n-char *prefix_path(const char *prefix, int len, const char *path);\n-char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n-\n-int check_filename(const char *prefix, const char *name);\n-void verify_filename(const char *prefix,\n-\t\t     const char *name,\n-\t\t     int diagnose_misspelt_rev);\n-void verify_non_filename(const char *prefix, const char *name);\n-int path_inside_repo(const char *prefix, const char *path);\n-\n #define INIT_DB_QUIET 0x0001\n #define INIT_DB_EXIST_OK 0x0002\n \n@@ -521,9 +460,6 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t    const char *initial_branch, unsigned int flags);\n void initialize_repository_version(int hash_algo, int reinit);\n \n-void sanitize_stdfds(void);\n-int daemonize(void);\n-\n /* Initialize and use the cache information */\n struct lock_file;\n void preload_index(struct index_state *index,\n@@ -807,79 +743,6 @@ enum fsync_method {\n \n extern enum fsync_method fsync_method;\n \n-/*\n- * GIT_REPO_VERSION is the version we write by default. The\n- * _READ variant is the highest number we know how to\n- * handle.\n- */\n-#define GIT_REPO_VERSION 0\n-#define GIT_REPO_VERSION_READ 1\n-\n-/*\n- * You _have_ to initialize a `struct repository_format` using\n- * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.\n- */\n-struct repository_format {\n-\tint version;\n-\tint precious_objects;\n-\tchar *partial_clone; /* value of extensions.partialclone */\n-\tint worktree_config;\n-\tint is_bare;\n-\tint hash_algo;\n-\tint sparse_index;\n-\tchar *work_tree;\n-\tstruct string_list unknown_extensions;\n-\tstruct string_list v1_only_extensions;\n-};\n-\n-/*\n- * Always use this to initialize a `struct repository_format`\n- * to a well-defined, default state before calling\n- * `read_repository()`.\n- */\n-#define REPOSITORY_FORMAT_INIT \\\n-{ \\\n-\t.version = -1, \\\n-\t.is_bare = -1, \\\n-\t.hash_algo = GIT_HASH_SHA1, \\\n-\t.unknown_extensions = STRING_LIST_INIT_DUP, \\\n-\t.v1_only_extensions = STRING_LIST_INIT_DUP, \\\n-}\n-\n-/*\n- * Read the repository format characteristics from the config file \"path\" into\n- * \"format\" struct. Returns the numeric version. On error, or if no version is\n- * found in the configuration, -1 is returned, format->version is set to -1,\n- * and all other fields in the struct are set to the default configuration\n- * (REPOSITORY_FORMAT_INIT). Always initialize the struct using\n- * REPOSITORY_FORMAT_INIT before calling this function.\n- */\n-int read_repository_format(struct repository_format *format, const char *path);\n-\n-/*\n- * Free the memory held onto by `format`, but not the struct itself.\n- * (No need to use this after `read_repository_format()` fails.)\n- */\n-void clear_repository_format(struct repository_format *format);\n-\n-/*\n- * Verify that the repository described by repository_format is something we\n- * can read. If it is, return 0. Otherwise, return -1, and \"err\" will describe\n- * any errors encountered.\n- */\n-int verify_repository_format(const struct repository_format *format,\n-\t\t\t     struct strbuf *err);\n-\n-/*\n- * Check the repository format version in the path found in get_git_dir(),\n- * and die if it is a version we don't understand. Generally one would\n- * set_git_dir() before calling this, and use it only for \"are we in a valid\n- * repo?\".\n- *\n- * If successful and fmt is not NULL, fill fmt with data.\n- */\n-void check_repository_format(struct repository_format *fmt);\n-\n #define MTIME_CHANGED\t0x0001\n #define CTIME_CHANGED\t0x0002\n #define OWNER_CHANGED\t0x0004\n@@ -908,23 +771,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n #define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n-/*\n- * NOTE NOTE NOTE!!\n- *\n- * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must\n- * not be changed. Old repositories have core.sharedrepository written in\n- * numeric format, and therefore these values are preserved for compatibility\n- * reasons.\n- */\n-enum sharedrepo {\n-\tPERM_UMASK          = 0,\n-\tOLD_PERM_GROUP      = 1,\n-\tOLD_PERM_EVERYBODY  = 2,\n-\tPERM_GROUP          = 0660,\n-\tPERM_EVERYBODY      = 0664\n-};\n-int git_config_perm(const char *var, const char *value);\n-\n /*\n  * Create the directory containing the named path, using care to be\n  * somewhat safe against races. Return one of the scld_error values to\n@@ -1283,15 +1129,6 @@ int ws_blank_line(const char *line, int len);\n void overlay_tree_on_index(struct index_state *istate,\n \t\t\t   const char *tree_name, const char *prefix);\n \n-/* setup.c */\n-struct startup_info {\n-\tint have_repository;\n-\tconst char *prefix;\n-\tconst char *original_cwd;\n-};\n-extern struct startup_info *startup_info;\n-extern const char *tmp_original_cwd;\n-\n /* merge.c */\n struct commit_list;\n int try_merge_command(struct repository *r,\ndiff --git a/commit.c b/commit.c\nindex f88fc5e1a2c..3868f047f1b 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -23,6 +23,7 @@\n #include \"refs.h\"\n #include \"commit-reach.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n #include \"hook.h\"\n \ndiff --git a/common-main.c b/common-main.c\nindex 184d1534d2d..b83cb5cf066 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 \"setup.h\"\n \n /*\n  * Many parts of Git have subprograms communicate via pipe, expect the\ndiff --git a/config.c b/config.c\nindex 5b1a5d52052..03a4fcaba5b 100644\n--- a/config.c\n+++ b/config.c\n@@ -27,6 +27,7 @@\n #include \"color.h\"\n #include \"replace-object.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/daemon.c b/daemon.c\nindex b56a8f9717d..db8a31a6ea2 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -5,6 +5,7 @@\n #include \"environment.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"wrapper.h\"\ndiff --git a/diff.c b/diff.c\nindex dcf1a940942..b858e59c5ae 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -33,6 +33,7 @@\n #include \"help.h\"\n #include \"promisor-remote.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"strmap.h\"\n #include \"wrapper.h\"\n \ndiff --git a/dir.c b/dir.c\nindex 06f8aa3c01b..4cc2b1ead47 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -21,6 +21,7 @@\n #include \"varint.h\"\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"wrapper.h\"\n \ndiff --git a/environment.c b/environment.c\nindex bf02f3cf487..649d16ac27c 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -22,6 +22,7 @@\n #include \"replace-object.h\"\n #include \"tmp-objdir.h\"\n #include \"chdir-notify.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n #include \"wrapper.h\"\n \ndiff --git a/git.c b/git.c\nindex b24c105e83f..77f920a6f6f 100644\n--- a/git.c\n+++ b/git.c\n@@ -7,6 +7,7 @@\n #include \"run-command.h\"\n #include \"alias.h\"\n #include \"replace-object.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n \n #define RUN_SETUP\t\t(1<<0)\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 454933351b2..c874d3402dd 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -5,6 +5,7 @@\n #include \"hex.h\"\n #include \"http.h\"\n #include \"walker.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"urlmatch.h\"\n #include \"trace2.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 40373bc4863..e73864b51f5 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"remote.h\"\n #include \"list-objects.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"packfile.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex aa5b2f252d2..a62424e90a4 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\n typedef void *SSL;\ndiff --git a/line-log.c b/line-log.c\nindex 6e7fc4b2e0b..84c8093c517 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -16,6 +16,7 @@\n #include \"graph.h\"\n #include \"userdiff.h\"\n #include \"line-log.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"bloom.h\"\n \ndiff --git a/mailmap.c b/mailmap.c\nindex 2c6e9b238dd..c24a16eaf48 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -3,6 +3,7 @@\n #include \"string-list.h\"\n #include \"mailmap.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n \n #define DEBUG_MAILMAP 0\n #if DEBUG_MAILMAP\ndiff --git a/object-file.c b/object-file.c\nindex 3da6cd68861..05fff230f73 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -37,6 +37,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"promisor-remote.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"fsck.h\"\n #include \"wrapper.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 3b0ce8ef05a..ce973e01505 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -15,6 +15,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"midx.h\"\n #include \"commit-reach.h\"\ndiff --git a/path.c b/path.c\nindex 5d5a15c13d6..a1702434979 100644\n--- a/path.c\n+++ b/path.c\n@@ -11,6 +11,7 @@\n #include \"string-list.h\"\n #include \"dir.h\"\n #include \"worktree.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"path.h\"\n #include \"packfile.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 5fb7b5f26c9..6972d515f0c 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 \"setup.h\"\n #include \"strvec.h\"\n #include \"quote.h\"\n \ndiff --git a/refs.c b/refs.c\nindex 04520e5a6b8..21b317e8153 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -22,6 +22,7 @@\n #include \"worktree.h\"\n #include \"strvec.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"date.h\"\n #include \"commit.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 0c3138ede8f..d2b8925ebd0 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -14,6 +14,7 @@\n #include \"../object.h\"\n #include \"../dir.h\"\n #include \"../chdir-notify.h\"\n+#include \"../setup.h\"\n #include \"../worktree.h\"\n #include \"../wrapper.h\"\n \ndiff --git a/remote-curl.c b/remote-curl.c\nindex eb382a1e35d..260ea200bb0 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -18,6 +18,7 @@\n #include \"credential.h\"\n #include \"oid-array.h\"\n #include \"send-pack.h\"\n+#include \"setup.h\"\n #include \"protocol.h\"\n #include \"quote.h\"\n #include \"transport.h\"\ndiff --git a/remote.c b/remote.c\nindex aeca3ff8136..c29e2f52981 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -15,6 +15,7 @@\n #include \"revision.h\"\n #include \"dir.h\"\n #include \"tag.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\n #include \"commit-reach.h\"\ndiff --git a/repository.c b/repository.c\nindex 4412f633224..f6d9f5db08e 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -11,6 +11,7 @@\n #include \"object.h\"\n #include \"lockfile.h\"\n #include \"remote.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"sparse-index.h\"\n #include \"promisor-remote.h\"\ndiff --git a/revision.c b/revision.c\nindex 53fdeef0787..f98691a3531 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -29,6 +29,7 @@\n #include \"bisect.h\"\n #include \"packfile.h\"\n #include \"worktree.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"commit-reach.h\"\n #include \"commit-graph.h\"\ndiff --git a/scalar.c b/scalar.c\nindex fe61a3ebdd7..27635658c01 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -15,6 +15,7 @@\n #include \"dir.h\"\n #include \"packfile.h\"\n #include \"help.h\"\n+#include \"setup.h\"\n \n static void setup_enlistment_directory(int argc, const char **argv,\n \t\t\t\t       const char * const *usagestr,\ndiff --git a/setup.c b/setup.c\nindex cfdc849a78c..6c5b85e96c1 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -5,6 +5,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"chdir-notify.h\"\n #include \"promisor-remote.h\"\ndiff --git a/setup.h b/setup.h\nnew file mode 100644\nindex 00000000000..4c1ca9d0c94\n--- /dev/null\n+++ b/setup.h\n@@ -0,0 +1,168 @@\n+#ifndef SETUP_H\n+#define SETUP_H\n+\n+#include \"string-list.h\"\n+\n+int is_inside_git_dir(void);\n+int is_inside_work_tree(void);\n+int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n+int get_common_dir(struct strbuf *sb, const char *gitdir);\n+\n+/*\n+ * Return true if the given path is a git directory; note that this _just_\n+ * looks at the directory itself. If you want to know whether \"foo/.git\"\n+ * is a repository, you must feed that path, not just \"foo\".\n+ */\n+int is_git_directory(const char *path);\n+\n+/*\n+ * Return 1 if the given path is the root of a git repository or\n+ * submodule, else 0. Will not return 1 for bare repositories with the\n+ * exception of creating a bare repository in \"foo/.git\" and calling\n+ * is_git_repository(\"foo\").\n+ *\n+ * If we run into read errors, we err on the side of saying \"yes, it is\",\n+ * as we usually consider sub-repos precious, and would prefer to err on the\n+ * side of not disrupting or deleting them.\n+ */\n+int is_nonbare_repository_dir(struct strbuf *path);\n+\n+#define READ_GITFILE_ERR_STAT_FAILED 1\n+#define READ_GITFILE_ERR_NOT_A_FILE 2\n+#define READ_GITFILE_ERR_OPEN_FAILED 3\n+#define READ_GITFILE_ERR_READ_FAILED 4\n+#define READ_GITFILE_ERR_INVALID_FORMAT 5\n+#define READ_GITFILE_ERR_NO_PATH 6\n+#define READ_GITFILE_ERR_NOT_A_REPO 7\n+#define READ_GITFILE_ERR_TOO_LARGE 8\n+void read_gitfile_error_die(int error_code, const char *path, const char *dir);\n+const char *read_gitfile_gently(const char *path, int *return_error_code);\n+#define read_gitfile(path) read_gitfile_gently((path), NULL)\n+const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n+#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n+\n+void setup_work_tree(void);\n+/*\n+ * Find the commondir and gitdir of the repository that contains the current\n+ * working directory, without changing the working directory or other global\n+ * state. The result is appended to commondir and gitdir.  If the discovered\n+ * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will\n+ * both have the same result appended to the buffer.  The return value is\n+ * either 0 upon success and non-zero if no repository was found.\n+ */\n+int discover_git_directory(struct strbuf *commondir,\n+\t\t\t   struct strbuf *gitdir);\n+const char *setup_git_directory_gently(int *);\n+const char *setup_git_directory(void);\n+char *prefix_path(const char *prefix, int len, const char *path);\n+char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n+\n+int check_filename(const char *prefix, const char *name);\n+void verify_filename(const char *prefix,\n+\t\t     const char *name,\n+\t\t     int diagnose_misspelt_rev);\n+void verify_non_filename(const char *prefix, const char *name);\n+int path_inside_repo(const char *prefix, const char *path);\n+\n+void sanitize_stdfds(void);\n+int daemonize(void);\n+\n+/*\n+ * GIT_REPO_VERSION is the version we write by default. The\n+ * _READ variant is the highest number we know how to\n+ * handle.\n+ */\n+#define GIT_REPO_VERSION 0\n+#define GIT_REPO_VERSION_READ 1\n+\n+/*\n+ * You _have_ to initialize a `struct repository_format` using\n+ * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.\n+ */\n+struct repository_format {\n+\tint version;\n+\tint precious_objects;\n+\tchar *partial_clone; /* value of extensions.partialclone */\n+\tint worktree_config;\n+\tint is_bare;\n+\tint hash_algo;\n+\tint sparse_index;\n+\tchar *work_tree;\n+\tstruct string_list unknown_extensions;\n+\tstruct string_list v1_only_extensions;\n+};\n+\n+/*\n+ * Always use this to initialize a `struct repository_format`\n+ * to a well-defined, default state before calling\n+ * `read_repository()`.\n+ */\n+#define REPOSITORY_FORMAT_INIT \\\n+{ \\\n+\t.version = -1, \\\n+\t.is_bare = -1, \\\n+\t.hash_algo = GIT_HASH_SHA1, \\\n+\t.unknown_extensions = STRING_LIST_INIT_DUP, \\\n+\t.v1_only_extensions = STRING_LIST_INIT_DUP, \\\n+}\n+\n+/*\n+ * Read the repository format characteristics from the config file \"path\" into\n+ * \"format\" struct. Returns the numeric version. On error, or if no version is\n+ * found in the configuration, -1 is returned, format->version is set to -1,\n+ * and all other fields in the struct are set to the default configuration\n+ * (REPOSITORY_FORMAT_INIT). Always initialize the struct using\n+ * REPOSITORY_FORMAT_INIT before calling this function.\n+ */\n+int read_repository_format(struct repository_format *format, const char *path);\n+\n+/*\n+ * Free the memory held onto by `format`, but not the struct itself.\n+ * (No need to use this after `read_repository_format()` fails.)\n+ */\n+void clear_repository_format(struct repository_format *format);\n+\n+/*\n+ * Verify that the repository described by repository_format is something we\n+ * can read. If it is, return 0. Otherwise, return -1, and \"err\" will describe\n+ * any errors encountered.\n+ */\n+int verify_repository_format(const struct repository_format *format,\n+\t\t\t     struct strbuf *err);\n+\n+/*\n+ * Check the repository format version in the path found in get_git_dir(),\n+ * and die if it is a version we don't understand. Generally one would\n+ * set_git_dir() before calling this, and use it only for \"are we in a valid\n+ * repo?\".\n+ *\n+ * If successful and fmt is not NULL, fill fmt with data.\n+ */\n+void check_repository_format(struct repository_format *fmt);\n+\n+/*\n+ * NOTE NOTE NOTE!!\n+ *\n+ * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must\n+ * not be changed. Old repositories have core.sharedrepository written in\n+ * numeric format, and therefore these values are preserved for compatibility\n+ * reasons.\n+ */\n+enum sharedrepo {\n+\tPERM_UMASK          = 0,\n+\tOLD_PERM_GROUP      = 1,\n+\tOLD_PERM_EVERYBODY  = 2,\n+\tPERM_GROUP          = 0660,\n+\tPERM_EVERYBODY      = 0664\n+};\n+int git_config_perm(const char *var, const char *value);\n+\n+struct startup_info {\n+\tint have_repository;\n+\tconst char *prefix;\n+\tconst char *original_cwd;\n+};\n+extern struct startup_info *startup_info;\n+extern const char *tmp_original_cwd;\n+\n+#endif /* SETUP_H */\ndiff --git a/submodule.c b/submodule.c\nindex acf030b95e4..75e0d45cbcb 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -26,6 +26,7 @@\n #include \"parse-options.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n \n static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;\ndiff --git a/symlinks.c b/symlinks.c\nindex c35c8d4408d..27ecc93693b 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"setup.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/t/helper/test-advise.c b/t/helper/test-advise.c\nindex cb881139f73..4e6ed30afa1 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n \n int cmd__advise_if_enabled(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c\nindex 5bb489882da..af43ee1cb5e 100644\n--- a/t/helper/test-bitmap.c\n+++ b/t/helper/test-bitmap.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"git-compat-util.h\"\n #include \"pack-bitmap.h\"\n+#include \"setup.h\"\n \n static int bitmap_list_commits(void)\n {\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex 127f134a2a6..e5754b8da62 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"test-tool.h\"\n #include \"commit.h\"\n+#include \"setup.h\"\n \n static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\n \ndiff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex 8b7a8fce1ee..cdaf5046f5a 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 \"setup.h\"\n \n static char const * const test_cache_tree_usage[] = {\n \tN_(\"test-tool cache-tree <options> (control|prime|update)\"),\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 4ba9eb65606..5877188f3ad 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c\nindex 92dfc1aa8c4..715aabfbae7 100644\n--- a/t/helper/test-dump-cache-tree.c\n+++ b/t/helper/test-dump-cache-tree.c\n@@ -4,7 +4,7 @@\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n-\n+#include \"setup.h\"\n \n static void dump_one(struct cache_tree *it, const char *pfx, const char *x)\n {\ndiff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c\nindex 975f0ac8905..7e9de296db3 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 \"setup.h\"\n \n int cmd__dump_fsmonitor(int ac, const char **av)\n {\ndiff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c\nindex 813d0a38fae..289a01c10ac 100644\n--- a/t/helper/test-dump-split-index.c\n+++ b/t/helper/test-dump-split-index.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"ewah/ewok.h\"\n \ndiff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c\nindex af953fabe87..415f55f31da 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 \"setup.h\"\n \n static int compare_untracked(const void *a_, const void *b_)\n {\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 627a6bdc3d0..e402c35a702 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -23,6 +23,7 @@\n #include \"refs.h\"\n #include \"revision.h\"\n #include \"sequencer.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"tree.h\"\n \ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex c43fc976b82..a37236cd0a6 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 \"setup.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex 2b678a45793..06ce3a47ccf 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 \"setup.h\"\n \n static int single;\n static int multi;\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 04bc2563f3e..64705734dfe 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 \"setup.h\"\n #include \"tree.h\"\n \n int cmd__match_trees(int ac, const char **av)\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex 0906993ad59..fd6f73ea03b 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oid-array.h\"\n+#include \"setup.h\"\n \n static int print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex 883d40efd45..f1b3dbe376b 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n /* key is an oid and value is a name (could be a refname for example) */\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex 0b82431a70f..edcb7e9f448 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oidtree.h\"\n+#include \"setup.h\"\n \n static enum cb_next print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex 0e53dee9e57..75ca1505a37 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -5,6 +5,7 @@\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"pack-mtimes.h\"\n+#include \"setup.h\"\n \n static void dump_mtimes(struct packed_git *p)\n {\ndiff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c\nindex da17fd37eb1..cce496944ac 100644\n--- a/t/helper/test-partial-clone.c\n+++ b/t/helper/test-partial-clone.c\n@@ -3,6 +3,7 @@\n #include \"test-tool.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n \n /*\n  * Prints the size of the object corresponding to the given hash in a specific\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex cc266e3ec09..4f5ac2fadce 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 \"setup.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c\nindex 7e12d4f9aa2..7c8de7b562a 100644\n--- a/t/helper/test-proc-receive.c\n+++ b/t/helper/test-proc-receive.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"test-tool.h\"\n \ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 09c711038ce..91bb2dec1df 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -8,6 +8,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"ref-filter.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"tag.h\"\n \ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex 84818363d5b..a4c24d0e421 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 \"setup.h\"\n #include \"wrapper.h\"\n \n int cmd__read_cache(int argc, const char **argv)\ndiff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c\nindex 98b73bb8f25..e21b0805f3c 100644\n--- a/t/helper/test-read-graph.c\n+++ b/t/helper/test-read-graph.c\n@@ -4,6 +4,7 @@\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"bloom.h\"\n+#include \"setup.h\"\n \n int cmd__read_graph(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex 0a883cdf26b..05c4f2b2625 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 \"setup.h\"\n \n static int read_midx_file(const char *object_dir, int show_objects)\n {\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 1745b088b7c..8717b95e84f 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex c444775eb0f..6774f6245f0 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -8,6 +8,7 @@\n #include \"object-store.h\"\n #include \"object.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"tree.h\"\n \n static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex 4a45d5bac2a..f2df4334063 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -13,6 +13,7 @@\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n \n static void print_commit(struct commit *commit)\n {\ndiff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c\nindex a26107ed70a..15b7688774c 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 \"setup.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n \ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 497d72058de..7d590ab7227 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\n+#include \"setup.h\"\n \n static char const * const serve_usage[] = {\n \tN_(\"test-tool serve-v2 [<options>]\"),\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 22a41c40926..256bfa6e9e1 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 \"cache.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex a3848a8b668..aaffd422d6e 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n \n static void die_usage(const char **argv, const char *msg)\ndiff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c\nindex e060cc62268..f18ca46dce4 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c\nindex ff22f2fa2c5..65a355cc590 100644\n--- a/t/helper/test-subprocess.c\n+++ b/t/helper/test-subprocess.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n \n int cmd__subprocess(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex a2b56b9cae5..0cd7ee12b7e 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"setup.h\"\n #include \"userdiff.h\"\n #include \"config.h\"\n \ndiff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c\nindex 7d45cd61e82..a93417ed3a9 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 \"setup.h\"\n \n int cmd__write_cache(int argc, const char **argv)\n {\ndiff --git a/trace.c b/trace.c\nindex 9c85b71ec6a..81318a2455d 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -25,6 +25,7 @@\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 0ff4bbc6b96..a26fda3493f 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -22,6 +22,7 @@\n #include \"promisor-remote.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"setup.h\"\n \n /*\n  * Error messages expected by scripts out of plumbing commands such as\ndiff --git a/worktree.c b/worktree.c\nindex 3861ab639ca..edef9e161dc 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"worktree.h\"\n #include \"dir.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex 106e46480a1..16e0df5736f 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -16,6 +16,7 @@\n #include \"refs.h\"\n #include \"submodule.h\"\n #include \"column.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n-- \ngitgitgadget\n\n"},{"id":"473751","messageId":"230320.86v8ivwvx3.gmgdl@evledraar.gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"Re: [PATCH 00/16] Header cleanups","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2023-03-20T09:58:40Z","receivedAt":"2023-03-20T10:38:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sun, Mar 19 2023, Elijah Newren via GitGitGadget wrote:\n\n> This series picks up where en/header-cleanups leaves off and does more\n> header cleanups, trying to reduce the number of files depending on cache.h.\n> (There are still more that could be done, but again, this is a good chunk\n> for now.)\n\n> Elijah Newren (16):\n>   treewide: remove unnecessary cache.h inclusion from a few headers\n>   treewide: be explicit about dependence on gettext.h\n>   treewide: remove unnecessary inclusion of gettext.h\n>   treewide: remove unnecessary cache.h inclusion from several sources\n\nI couldn't seem to square what you were doing in 2/16 with what 4/16\ndoes, but I think the \"issue\" is that the commit message for 4/6 doesn't\nmatch at least one change it's making, i.e.:\n\n\tBy making those files explicitly include gettext.h, we can\n\talready drop the include of cache.h in these files.\n\nBut in fact compat/linux/procinfo.c at least (I didn't do more than skim\nthe others) isn't like the rest, in that it doesn't need gettext.h at\nall.\n\nI also find the ordering hard to follow, but it's ultimately correct in\nthe cases I looked at. E.g. for ref-filter.c your 1/16 does:\n\n\t-#include \"git-compat-util.h\"\n\t+#include \"cache.h\"\n\nThen 2/16 does:\n\n\t+#include \"gettext.h\"\n\nSo I wondered, wait a minute, didn't we just end up over-including\ncache.h because we needed gettext.h, which the later commit adds?\n\nBut no, that's not the case, because as 1/16 notes (\"on things from\ncache.h[...]\") we need *other* things from cache.h, so this is\nultimately correct.\n\nStill, given that, I for one would have found this easier to follow if\ncommits like 2/16 came before the 1/16, i.e. let's first be explicit\nabout e.g. gettext.h, and then change git-compat-util.h inclusions to\ncache.h, to clearly note in the progression that the two are distinct.\n\nBut this is also fine with me if you don't agree, or can't be bothered\nto re-roll it.\n\nAs a more general note on the direction here: I have some old WIP\npatches to do similar split-ups of cache.h, but in doing those I was\ntrying to first identify cases where we had a function in cache.h that\nwas used by the low tens of our ~500 *.c source files.\n\nE.g. advice.h is such a case[1], ditto wildmatch.h. Then we have case\nlike ws.c[3], base85.c[4] and pager.c[5] where there's no corresponding\nheader, but we should probably create one (which those WIP commits of\nmine do).\n\nWhereas this approach feels like the opposite of that, i.e. at the end\nof this series we're including gettext.h in more than 250 files.\n\nStepping back a bit, I think our use of cache.h falls into a few broad\ncategories:\n\n A. Things to do with the index (we should probably create an index.h\n    for those).\n B. Used almost everywhere, i.e. \"cache.h\" can be though of as \"git.h\",\n    or \"common-utils.h\" or whatever.\n C. Things used almost nowhere, or only a handful of places,\n    e.g. wildmatch.h and others noted above.\n\nPart of this series is a frontal assault on the \"B\" part of that. I\nthink if we're going to include gettext.h explicitly everywhere we're\nprobably saying by extension that no such thing as a \"common header\"\nshould exist.\n\nWhich I'd be fine with, I just personally never thought it was much of a\npractical problem, i.e. to have the gettext.h's in our tree included\n\"everywhere\", ditto \"strbuf.h\", and even \"enum object_file\" and other\n\"mostly everyone wants these\".\n\nWhereas it is rather annoying that we over-include things in cache.h, or\neven have cache.h include other headers, as often minor changes to\nrelated libraries result in a full re-build.\n\nBut maybe \"B\" isn't sustainable at all, and I'm just fooling myself\nthinking we could have such a thing.\n\nA nice thing I hadn't considered is that after your topic e.g. removing\nthe gettext.h inclusion from parse-options.h will compile *most* of git,\nbut we'll fail e.g. in:\n\n\tt/helper/test-parse-pathspec-file.c: In function ‘cmd__parse_pathspec_file’:\n\t./parse-options.h:209:40: error: implicit declaration of function ‘N_’ [-Werror=implicit-function-declaration]\n\t  209 |                                        N_(\"file\"), (h) }\n\t\n\nSo as we don't want gettext in t/helper/* it's nice to get *an* error\nabout that.\n\nSo, in the end I think I've convinced myself that even the \"B\" in that\n\"A..C\" is a bad idea.\n\n1. https://github.com/avar/git/commit/17366c2b7b4\n2. https://github.com/avar/git/commit/ffb226fb6e6\n3. https://github.com/avar/git/commit/1d023e554bf\n4. https://github.com/avar/git/commit/e7d5b511090\n5. https://github.com/avar/git/commit/0054eea1a1a \n"},{"id":"473781","messageId":"CABPp-BFZBWTG1VF6N8teVMYxoUdOeciKGwPq1g-G1K5--My5uQ@mail.gmail.com","threadId":"59412","inReplyTo":"230320.86v8ivwvx3.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH 00/16] Header cleanups","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-03-20T16:18:44Z","receivedAt":"2023-03-20T16:26:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Ævar,\n\nOn Mon, Mar 20, 2023 at 3:37 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n>\n> On Sun, Mar 19 2023, Elijah Newren via GitGitGadget wrote:\n>\n> > This series picks up where en/header-cleanups leaves off and does more\n> > header cleanups, trying to reduce the number of files depending on cache.h.\n> > (There are still more that could be done, but again, this is a good chunk\n> > for now.)\n>\n> > Elijah Newren (16):\n> >   treewide: remove unnecessary cache.h inclusion from a few headers\n> >   treewide: be explicit about dependence on gettext.h\n> >   treewide: remove unnecessary inclusion of gettext.h\n> >   treewide: remove unnecessary cache.h inclusion from several sources\n>\n> I couldn't seem to square what you were doing in 2/16 with what 4/16\n> does, but I think the \"issue\" is that the commit message for 4/6 doesn't\n> match at least one change it's making, i.e.:\n>\n>         By making those files explicitly include gettext.h, we can\n>         already drop the include of cache.h in these files.\n>\n> But in fact compat/linux/procinfo.c at least (I didn't do more than skim\n> the others) isn't like the rest, in that it doesn't need gettext.h at\n> all.\n\nYeah, there were apparently pre-existing headers that did not need\ncache.h, so my script to find the ones that \"no longer need it\" after\nsome changes identifies not only the ones that can be cleaned out due\nto the gettext.h changes but the ones that could have been cleaned up\nbeforehand.  Maybe I should do a preliminary patch that removes\ncache.h from some headers, then do the gettext changes, then this\npatch becomes clearer.\n\nOr I can tweak the commit message to just spell out we already had\nsome headers that didn't need cache.h, so this patch just combines\nthose cleanups.\n\n> I also find the ordering hard to follow, but it's ultimately correct in\n> the cases I looked at. E.g. for ref-filter.c your 1/16 does:\n>\n>         -#include \"git-compat-util.h\"\n>         +#include \"cache.h\"\n>\n> Then 2/16 does:\n>\n>         +#include \"gettext.h\"\n>\n> So I wondered, wait a minute, didn't we just end up over-including\n> cache.h because we needed gettext.h, which the later commit adds?\n>\n> But no, that's not the case, because as 1/16 notes (\"on things from\n> cache.h[...]\") we need *other* things from cache.h, so this is\n> ultimately correct.\n>\n> Still, given that, I for one would have found this easier to follow if\n> commits like 2/16 came before the 1/16, i.e. let's first be explicit\n> about e.g. gettext.h, and then change git-compat-util.h inclusions to\n> cache.h, to clearly note in the progression that the two are distinct.\n>\n> But this is also fine with me if you don't agree, or can't be bothered\n> to re-roll it.\n\nIn my mind, 1/16 probably belonged in en/header-cleanup that was\nalready merged to master and was an oversight that made other cleanups\nI was trying to do harder.  The gettext stuff was new stuff I was\ndoing to make other things in this series easier, so I placed it right\nafter 1/16.\n\nBut, I can see your point of view, and I don't feel strongly about the\norder of these patches.  I'm happy to switch them around.\n\n> As a more general note on the direction here: I have some old WIP\n> patches to do similar split-ups of cache.h, but in doing those I was\n> trying to first identify cases where we had a function in cache.h that\n> was used by the low tens of our ~500 *.c source files.\n>\n> E.g. advice.h is such a case[1], ditto wildmatch.h. Then we have case\n> like ws.c[3], base85.c[4] and pager.c[5] where there's no corresponding\n> header, but we should probably create one (which those WIP commits of\n> mine do).\n\nHere was my approach:\n  * Identify a *single* file that I know that makes no sense to include cache.h.\n  * Try to figure out why and fix it...but also fix *all* other files\nthat have the same nonsensical dependencies throughout the entire\ntree.\n  * (And maybe also fix a few extra things you find along the way that\nrepeatedly turn up).\n\nFor my first series (en/header-cleanup which is now in master), I was\nlooking at diffcore-rename.c.  17 patches later it was clean.\n\nFor this series, I was looking at strbuf.c.  It would have been clean\nat the end, but while waiting for my first series to merge to master,\nyou submitted your series which conflicts.  So I dropped some of the\nchanges, but submitted the rest.  (And the gettext.h changes\noriginally weren't at the beginning of my series, but then I noticed\nthey repeatedly were additional squashed-in changes that made things\nharder for others to review, AND harder for me to figure out (see\nbelow), so I went back and made the gettext changes into a preliminary\nbig cleanup.)\n\nYour approach also makes sense, I've considered it before and still\nhave it in my backlog, but this series focused on making strbuf.c\nclean and was already long enough, so I'm deferring those other\nchanges to later.\n\n> Whereas this approach feels like the opposite of that, i.e. at the end\n> of this series we're including gettext.h in more than 250 files.\n\nThe idea to \"fix all other files with the same nonsensical\ndependencies\" was heavily impeded by gettext.h.  I had scripts to\noptimistically change \"cache.h\" to \"git-compat-util.h\" and try to\ncompile.  For those that only gave warnings rather than errors, I\nneeded to wade through pages of gettext-related undeclared warnings,\nto see the other dependencies in the file.  So, making gettext\ndependencies explicit just made it vastly easier to do all the\nsubsequent cleanups.\n\n> Stepping back a bit, I think our use of cache.h falls into a few broad\n> categories:\n>\n>  A. Things to do with the index (we should probably create an index.h\n>     for those).\n>  B. Used almost everywhere, i.e. \"cache.h\" can be though of as \"git.h\",\n>     or \"common-utils.h\" or whatever.\n>  C. Things used almost nowhere, or only a handful of places,\n>     e.g. wildmatch.h and others noted above.\n>\n> Part of this series is a frontal assault on the \"B\" part of that. I\n> think if we're going to include gettext.h explicitly everywhere we're\n> probably saying by extension that no such thing as a \"common header\"\n> should exist.\n\nThere might be a way to have a common header that doesn't devolve into\na dumping ground of all dependencies the way cache.h has become, but I\nthink we'd need to be really careful.  I think git-compat-util.h would\nobviously make sense to include in such a thing.  You might be able to\nconvince me that gettext.h should be in such a thing, but I'm not even\nsure about that: we have more C files that do not use stuff from\ngettext (321) than those that do (245).\n\nI think cache.h is really far from what we want.  It has often tripped\nme up in trying to understand the code, often results in needless\ncompile-everything loops when making simple changes, is an impediment\nto any potential libifying or code-sharing exercise (I was hoping that\ne.g. merge-ort could be shared with other projects instead of being\nreinvented), and makes other interesting exploratory hacking harder\n(e.g. I've toyed with the idea of speeding up merge-ort or other parts\nof the code by rust-rewrites for self-educational purposes and\nwondered why the code depended on so many things).\n\nThe focus of this series was not B; it was just \"remove the cache.h\nheader from strbuf.c, and from any files that depend on cache.h for\nthe same dumb reasons\".  However, even though it wasn't the focus of\nmy series, I would have to say that you are right that I don't believe\nin having a dumping ground of \"common\" includes as I think it just\ngets littered with things that aren't actually common.  I may well\nsubmit future series explicitly assaulting part \"B\".\n\n> Which I'd be fine with, I just personally never thought it was much of a\n> practical problem, i.e. to have the gettext.h's in our tree included\n> \"everywhere\", ditto \"strbuf.h\", and even \"enum object_file\" and other\n> \"mostly everyone wants these\".\n>\n> Whereas it is rather annoying that we over-include things in cache.h, or\n> even have cache.h include other headers, as often minor changes to\n> related libraries result in a full re-build.\n\nThe time to rebuild the code is one concern, but wasn't even my primary concern.\n\n> But maybe \"B\" isn't sustainable at all, and I'm just fooling myself\n> thinking we could have such a thing.\n>\n> A nice thing I hadn't considered is that after your topic e.g. removing\n> the gettext.h inclusion from parse-options.h will compile *most* of git,\n> but we'll fail e.g. in:\n>\n>         t/helper/test-parse-pathspec-file.c: In function ‘cmd__parse_pathspec_file’:\n>         ./parse-options.h:209:40: error: implicit declaration of function ‘N_’ [-Werror=implicit-function-declaration]\n>           209 |                                        N_(\"file\"), (h) }\n>\n>\n> So as we don't want gettext in t/helper/* it's nice to get *an* error\n> about that.\n\nI don't see why that's a \"nice thing\"; it doesn't even make sense to\nme as being a useful thing to try.  parse-options.h has several macros\nthat explicitly call N_().  Even if the code compiled with that\nproposed change (because no one used those particular macros), it'd be\na bad idea unless those macros were first deleted or modified to not\ndepend upon gettext.h.  Since the file clearly depends upon gettext.h,\nI think it should explicitly include it.\n\n(In general, I believe if you depend upon something, you should\nexplicitly include it.  I was convinced otherwise for\ngit-compat-util.h and header files[1], but I hold that as the only\nexception until others have solid reasons for other headers being\nspecial.  In fact, I'd like to change the coding guidelines to state\nthat you should directly include any headers you use, with the\nexception of git-compat-util.h in other header files.  We're just too\nfar away from that right now for it to be realistic.)\n\n[1] https://lore.kernel.org/git/CABPp-BHizCj2e454w3vtHrDNip3Rm-gUMT0oJiAsbkAvr_QvVA@mail.gmail.com/\n\n> So, in the end I think I've convinced myself that even the \"B\" in that\n> \"A..C\" is a bad idea.\n\nWas this based only on the mistaken idea of removing gettext.h from\nparse-options.h, or on other factors?\n"},{"id":"473822","messageId":"a1be63930c43c9c7980fa37815985898426111c6.1679379970.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 01/16] treewide: remove unnecessary cache.h inclusion from a few headers","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:53Z","receivedAt":"2023-03-21T06:26: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\nEver since a64215b6cd (\"object.h: stop depending on cache.h; make\ncache.h depend on object.h\", 2023-02-24), we have a few headers that\ncould have replaced their include of cache.h with an include of\nobject.h.  Make that change now.\n\nSome C files had to start including cache.h after this change (or some\nsmaller header it had brought in), because the C files were depending\non things from cache.h but were only formerly implicitly getting\ncache.h through one of these headers being modified in this patch.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n bulk-checkin.h              | 2 +-\n bundle.h                    | 1 -\n cache-tree.c                | 2 +-\n config.c                    | 2 +-\n fmt-merge-msg.c             | 2 +-\n fsck.c                      | 2 +-\n http-backend.c              | 2 +-\n pack-mtimes.c               | 2 +-\n packfile.h                  | 4 +++-\n prune-packed.c              | 2 +-\n ref-filter.c                | 2 +-\n refs.c                      | 2 +-\n refs.h                      | 1 -\n refs/packed-backend.c       | 2 +-\n refspec.c                   | 1 +\n remote.c                    | 2 +-\n server-info.c               | 2 +-\n shallow.c                   | 2 +-\n strbuf.c                    | 2 +-\n streaming.h                 | 4 +++-\n submodule.c                 | 2 +-\n t/helper/test-bundle-uri.c  | 1 +\n t/helper/test-fast-rebase.c | 2 +-\n t/helper/test-pack-mtimes.c | 2 +-\n t/helper/test-reach.c       | 1 +\n transport.c                 | 2 +-\n transport.h                 | 1 -\n worktree.c                  | 2 +-\n 28 files changed, 29 insertions(+), 25 deletions(-)\n\ndiff --git a/bulk-checkin.h b/bulk-checkin.h\nindex 8281b9cb159..48fe9a6e917 100644\n--- a/bulk-checkin.h\n+++ b/bulk-checkin.h\n@@ -4,7 +4,7 @@\n #ifndef BULK_CHECKIN_H\n #define BULK_CHECKIN_H\n \n-#include \"cache.h\"\n+#include \"object.h\"\n \n void prepare_loose_object_bulk_checkin(void);\n void fsync_loose_object_bulk_checkin(int fd, const char *filename);\ndiff --git a/bundle.h b/bundle.h\nindex 9f2bd733a6a..021adbdcbb3 100644\n--- a/bundle.h\n+++ b/bundle.h\n@@ -2,7 +2,6 @@\n #define BUNDLE_H\n \n #include \"strvec.h\"\n-#include \"cache.h\"\n #include \"string-list.h\"\n #include \"list-objects-filter-options.h\"\n \ndiff --git a/cache-tree.c b/cache-tree.c\nindex 9d46ecef091..6f899beb041 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/config.c b/config.c\nindex d0aff55fa66..983c45fc37b 100644\n--- a/config.c\n+++ b/config.c\n@@ -5,7 +5,7 @@\n  * Copyright (C) Johannes Schindelin, 2005\n  *\n  */\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"date.h\"\n #include \"branch.h\"\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex 24cc44bdbc9..c870cb95b9d 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"refs.h\"\ndiff --git a/fsck.c b/fsck.c\nindex 871c0a9a252..70e12497878 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex 9cfc6f25414..7e7c19e66b3 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/pack-mtimes.c b/pack-mtimes.c\nindex 0f9785fc5e4..cd92fc1d86c 100644\n--- a/pack-mtimes.c\n+++ b/pack-mtimes.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"pack-mtimes.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/packfile.h b/packfile.h\nindex a3f6723857b..648be62bf22 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -1,11 +1,13 @@\n #ifndef PACKFILE_H\n #define PACKFILE_H\n \n-#include \"cache.h\"\n+#include \"object.h\"\n #include \"oidset.h\"\n \n /* in object-store.h */\n struct packed_git;\n+struct pack_entry;\n+struct pack_window;\n struct object_info;\n \n /*\ndiff --git a/prune-packed.c b/prune-packed.c\nindex d2813f6a405..e02f466c2ee 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"progress.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex ed802778da7..38141bce8db 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/refs.c b/refs.c\nindex 53240bcc07b..4e5cc73fb10 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -2,7 +2,7 @@\n  * The backend-independent part of the reference module.\n  */\n \n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hashmap.h\"\ndiff --git a/refs.h b/refs.h\nindex 935cdd1ece3..5741b69d0d1 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -1,7 +1,6 @@\n #ifndef REFS_H\n #define REFS_H\n \n-#include \"cache.h\"\n #include \"commit.h\"\n \n struct object_id;\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex b665d0f7d9b..6f975185995 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1,4 +1,4 @@\n-#include \"../git-compat-util.h\"\n+#include \"../cache.h\"\n #include \"../alloc.h\"\n #include \"../config.h\"\n #include \"../hex.h\"\ndiff --git a/refspec.c b/refspec.c\nindex 28d90911aa5..7b5c305514d 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strvec.h\"\n #include \"refs.h\"\ndiff --git a/remote.c b/remote.c\nindex b04e5da3383..2daddb85cb7 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/server-info.c b/server-info.c\nindex 40436892023..78643377057 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n #include \"hex.h\"\ndiff --git a/shallow.c b/shallow.c\nindex 1cbb05ba0e4..c5433a4fd30 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex 1c57ac6574f..8800830ebf8 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/streaming.h b/streaming.h\nindex 5e4e6acfd0d..bd27f59e576 100644\n--- a/streaming.h\n+++ b/streaming.h\n@@ -3,10 +3,12 @@\n  */\n #ifndef STREAMING_H\n #define STREAMING_H 1\n-#include \"cache.h\"\n+\n+#include \"object.h\"\n \n /* opaque */\n struct git_istream;\n+struct stream_filter;\n \n struct git_istream *open_istream(struct repository *, const struct object_id *,\n \t\t\t\t enum object_type *, unsigned long *,\ndiff --git a/submodule.c b/submodule.c\nindex 2a057c35b74..0baf97cf770 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-bundle-uri.c b/t/helper/test-bundle-uri.c\nindex b18e7603103..475058592d1 100644\n--- a/t/helper/test-bundle-uri.c\n+++ b/t/helper/test-bundle-uri.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"parse-options.h\"\n #include \"bundle-uri.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"transport.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex b1edb92a032..1e975df9041 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -12,7 +12,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n-\n+#include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n #include \"hex.h\"\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex f68b3761b68..0e53dee9e57 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -1,5 +1,5 @@\n-#include \"git-compat-util.h\"\n #include \"test-tool.h\"\n+#include \"cache.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex de8f26639d4..05d56267a9f 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -1,4 +1,5 @@\n #include \"test-tool.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n #include \"commit-reach.h\"\ndiff --git a/transport.c b/transport.c\nindex 906dbad5a08..80059124c0a 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hex.h\"\ndiff --git a/transport.h b/transport.h\nindex 85150f504fb..6393cd9823c 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -1,7 +1,6 @@\n #ifndef TRANSPORT_H\n #define TRANSPORT_H\n \n-#include \"cache.h\"\n #include \"run-command.h\"\n #include \"remote.h\"\n #include \"list-objects-filter-options.h\"\ndiff --git a/worktree.c b/worktree.c\nindex e10594ef336..cbb0db2d7cc 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n-- \ngitgitgadget\n\n"},{"id":"473823","messageId":"644d305c6696e47a5a7e235ab11f69d368aca5f2.1679379971.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 03/16] treewide: remove unnecessary inclusion of gettext.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:55Z","receivedAt":"2023-03-21T06:26: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\nLooking at things from the opposite angle of the last patch, we had a\nfew files that were including gettext.h and perhaps needed it at some\npoint in history, but no longer require it.  Remove the include.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n progress.c                          | 1 -\n t/helper/test-parse-pathspec-file.c | 1 -\n t/helper/test-progress.c            | 1 -\n t/helper/test-run-command.c         | 1 -\n 4 files changed, 4 deletions(-)\n\ndiff --git a/progress.c b/progress.c\nindex 9b33a2df325..44c784d75f1 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -10,7 +10,6 @@\n \n #define GIT_TEST_PROGRESS_ONLY\n #include \"cache.h\"\n-#include \"gettext.h\"\n #include \"progress.h\"\n #include \"strbuf.h\"\n #include \"trace.h\"\ndiff --git a/t/helper/test-parse-pathspec-file.c b/t/helper/test-parse-pathspec-file.c\nindex 71d2131fbad..89ecefd1cdb 100644\n--- a/t/helper/test-parse-pathspec-file.c\n+++ b/t/helper/test-parse-pathspec-file.c\n@@ -1,7 +1,6 @@\n #include \"test-tool.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n-#include \"gettext.h\"\n \n int cmd__parse_pathspec_file(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-progress.c b/t/helper/test-progress.c\nindex 6cc9735b601..66acb6a06c9 100644\n--- a/t/helper/test-progress.c\n+++ b/t/helper/test-progress.c\n@@ -19,7 +19,6 @@\n  */\n #define GIT_TEST_PROGRESS_ONLY\n #include \"test-tool.h\"\n-#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"progress.h\"\n #include \"strbuf.h\"\ndiff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c\nindex b0d041ec5ff..c0ed8722c87 100644\n--- a/t/helper/test-run-command.c\n+++ b/t/helper/test-run-command.c\n@@ -16,7 +16,6 @@\n #include \"string-list.h\"\n #include \"thread-utils.h\"\n #include \"wildmatch.h\"\n-#include \"gettext.h\"\n \n static int number_callbacks;\n static int parallel_next(struct child_process *cp,\n-- \ngitgitgadget\n\n"},{"id":"473824","messageId":"95b86aecb4391bf9767a1308267e18cc55c2fa5f.1679379971.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 04/16] treewide: remove unnecessary cache.h inclusion from several sources","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:56Z","receivedAt":"2023-03-21T06:26: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\nA number of files were apparently including cache.h solely to get\ngettext.h.  By making those files explicitly include gettext.h, we can\nalready drop the include of cache.h in these files.  On top of that,\nthere were some files using cache.h that didn't need to for any reason.\nRemove these unnecessary includes.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/linux/procinfo.c        | 2 +-\n compat/simple-ipc/ipc-shared.c | 2 +-\n connected.c                    | 2 +-\n grep.c                         | 2 +-\n negotiator/default.c           | 2 +-\n negotiator/skipping.c          | 2 +-\n notes-cache.c                  | 2 +-\n patch-ids.c                    | 2 +-\n reflog.c                       | 2 +-\n refs/iterator.c                | 2 +-\n replace-object.c               | 2 +-\n t/helper/test-hash.c           | 1 -\n xdiff-interface.c              | 2 +-\n 13 files changed, 12 insertions(+), 13 deletions(-)\n\ndiff --git a/compat/linux/procinfo.c b/compat/linux/procinfo.c\nindex bc2f9382a17..4bb2d66227b 100644\n--- a/compat/linux/procinfo.c\n+++ b/compat/linux/procinfo.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n \n #include \"strbuf.h\"\n #include \"strvec.h\"\ndiff --git a/compat/simple-ipc/ipc-shared.c b/compat/simple-ipc/ipc-shared.c\nindex 1b9d359ab68..e5e1dda8ccd 100644\n--- a/compat/simple-ipc/ipc-shared.c\n+++ b/compat/simple-ipc/ipc-shared.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/connected.c b/connected.c\nindex a4c0aece757..669bc4e8d69 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/grep.c b/grep.c\nindex febb076a7e6..bb8796a829f 100644\n--- a/grep.c\n+++ b/grep.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 \"grep.h\"\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex b7e79feaf04..5dd553a1fe3 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"default.h\"\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex 264acf8bbea..4157c4d72f5 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"skipping.h\"\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\ndiff --git a/notes-cache.c b/notes-cache.c\nindex 9dfd251a815..01a918c925e 100644\n--- a/notes-cache.c\n+++ b/notes-cache.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"notes-cache.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/patch-ids.c b/patch-ids.c\nindex a4473a88fa2..19af7bee984 100644\n--- a/patch-ids.c\n+++ b/patch-ids.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"hash-lookup.h\"\ndiff --git a/reflog.c b/reflog.c\nindex d1c39374318..4e121e449d1 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"reflog.h\"\ndiff --git a/refs/iterator.c b/refs/iterator.c\nindex c9fd0bcaf90..6b680f610ef 100644\n--- a/refs/iterator.c\n+++ b/refs/iterator.c\n@@ -3,7 +3,7 @@\n  * documentation about the design and use of reference iterators.\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"refs.h\"\n #include \"refs/refs-internal.h\"\n #include \"iterator.h\"\ndiff --git a/replace-object.c b/replace-object.c\nindex 9e30e0362ba..e98825d5852 100644\n--- a/replace-object.c\n+++ b/replace-object.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\ndiff --git a/t/helper/test-hash.c b/t/helper/test-hash.c\nindex 016248106a7..45d829c908f 100644\n--- a/t/helper/test-hash.c\n+++ b/t/helper/test-hash.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n \n int cmd_hash_impl(int ac, const char **av, int algo)\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 5baf6ceb947..356356afe71 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n-- \ngitgitgadget\n\n"},{"id":"473825","messageId":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.git.1679207282.gitgitgadget@gmail.com","subject":"[PATCH v2 00/16] Header cleanups","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:52Z","receivedAt":"2023-03-21T06:26:36Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Maintainer note: I dropped multiple changes from this series to avoid\nconflicts with other in-flight series, but has some small conflicts with\nseen: one semantic conflict with ed/fsmonitor-inotify (correct resolution:\ninclude abspath.h in the new file compat/fsmonitor/fsm-path-utils-linux.c)\nand a few conflicts with sg/parse-options-h-users (which was submitted after\nmy series; correct resolution: just make sure all the headers are included\nfrom both sides).\n\nThe motivating thrust of this series was trying to remove the inclusion of\ncache.h from strbuf.c. This series doesn't quite achieve that, because I\ndropped some changes to avoid conflicting with ed/fsmonitor-inotify, and to\navoid conflicting with Ævar's series on the_repository cleanup.\n\nOverview of the series:\n\n * Patch 1: leftover cleanup from en/header-cleanups (now in master) that\n   should have been included in that series\n * Patches 2-4: cleanups around gettext.h. Without these patches, many\n   gettext inclusions would have to be squashed into later patches and make\n   them harder to review. Also, the implicit dependency on gettext.h was\n   making it much harder to find other dependencies.\n * Patch 5: move some global var declarations from cache.h into the header\n   associated with where the vars are declared\n * Patches 6-16: move header declarations from cache.h into a header named\n   the same as the source file containing the actual functions (e.g. move\n   declarations for abspath.c functions from cache.h into abspath.h), and\n   reduce the dependencies on cache.h accordingly.\n\nChanges since v1:\n\n * rebased on main (to avoid conflict with jk/bundle-use-dash-for-stdfiles;\n   no more conflicts with next!)\n * cleaned up the wording in patch 4\n * added more detail to this cover letter giving an overview of the series,\n   and updating about conflicts\n\nChanges not incorporated:\n\n * I left patch 1 before patches 2-4, since it's purpose (leftover cleanup\n   from en/header-cleanups) just means it makes more sense there for me. I\n   don't know how to explain it in a way that makes sense if I move it.\n\nNotes:\n\n * As I mentioned in my last series, Dscho's gitgitgadget is super helpful\n   for a series like this.\n * As with my previous series (en/header-cleanup), I used the scripts at my\n   header-cleanup-scripts branch\n   [https://github.com/newren/git/commit/db81c8d7fb554b3edf04320e218bddeb98bb6194],\n   and some tweaks thereof, repeatedly while making this series (though they\n   are prone to produce both false positive and false negatives, so if you\n   use them, only use them to generate hints about which files to look at).\n\nElijah Newren (16):\n  treewide: remove unnecessary cache.h inclusion from a few headers\n  treewide: be explicit about dependence on gettext.h\n  treewide: remove unnecessary inclusion of gettext.h\n  treewide: remove unnecessary cache.h inclusion from several sources\n  environment: move comment_line_char from cache.h\n  abspath.h: move absolute path functions from cache.h\n  cache.h: remove expand_user_path()\n  path.h: move function declarations for path.c functions from cache.h\n  wrapper.h: move declarations for wrapper.c functions from cache.h\n  treewide: remove unnecessary includes of cache.h\n  environment.h: move declarations for environment.c functions from\n    cache.h\n  treewide: remove cache.h inclusion due to environment.h changes\n  setup.h: move declarations for setup.c functions from cache.h\n  treewide: remove cache.h inclusion due to setup.h changes\n  write-or-die.h: move declarations for write-or-die.c functions from\n    cache.h\n  csum-file.h: remove unnecessary inclusion of cache.h\n\n abspath.c                                    |   4 +-\n abspath.h                                    |  33 ++\n add-interactive.c                            |   1 +\n add-patch.c                                  |   2 +\n apply.c                                      |   5 +\n archive-tar.c                                |   2 +\n archive-zip.c                                |   2 +\n archive.c                                    |   4 +\n attr.c                                       |   3 +\n bisect.c                                     |   2 +\n blame.c                                      |   2 +\n branch.c                                     |   2 +\n builtin/add.c                                |   1 +\n builtin/am.c                                 |   4 +\n builtin/apply.c                              |   1 +\n builtin/archive.c                            |   1 +\n builtin/bisect.c                             |   3 +\n builtin/blame.c                              |   4 +\n builtin/branch.c                             |   3 +\n builtin/bugreport.c                          |   5 +-\n builtin/bundle.c                             |   3 +\n builtin/cat-file.c                           |   3 +\n builtin/check-attr.c                         |   4 +\n builtin/check-ignore.c                       |   2 +\n builtin/check-mailmap.c                      |   2 +\n builtin/check-ref-format.c                   |   1 +\n builtin/checkout--worker.c                   |   1 +\n builtin/checkout-index.c                     |   2 +\n builtin/checkout.c                           |   3 +\n builtin/clean.c                              |   3 +\n builtin/clone.c                              |   4 +\n builtin/column.c                             |   1 +\n builtin/commit-graph.c                       |   2 +\n builtin/commit-tree.c                        |   1 +\n builtin/commit.c                             |   2 +\n builtin/config.c                             |   5 +\n builtin/count-objects.c                      |   2 +\n builtin/credential-cache--daemon.c           |   2 +\n builtin/credential-cache.c                   |   3 +\n builtin/credential-store.c                   |   2 +\n builtin/describe.c                           |   3 +\n builtin/diagnose.c                           |   2 +\n builtin/diff-index.c                         |   1 +\n builtin/diff-tree.c                          |   1 +\n builtin/diff.c                               |   2 +\n builtin/difftool.c                           |   5 +\n builtin/fast-export.c                        |   1 +\n builtin/fast-import.c                        |   4 +\n builtin/fetch-pack.c                         |   1 +\n builtin/fetch.c                              |   2 +\n builtin/fmt-merge-msg.c                      |   2 +\n builtin/for-each-ref.c                       |   1 +\n builtin/for-each-repo.c                      |   1 +\n builtin/fsck.c                               |   1 +\n builtin/fsmonitor--daemon.c                  |   3 +\n builtin/gc.c                                 |   5 +\n builtin/get-tar-commit-id.c                  |   1 +\n builtin/grep.c                               |   3 +\n builtin/hash-object.c                        |   4 +\n builtin/help.c                               |   2 +\n builtin/hook.c                               |   1 +\n builtin/index-pack.c                         |   4 +\n builtin/init-db.c                            |   5 +\n builtin/interpret-trailers.c                 |   1 +\n builtin/log.c                                |   4 +\n builtin/ls-files.c                           |   2 +\n builtin/ls-remote.c                          |   1 +\n builtin/ls-tree.c                            |   1 +\n builtin/mailinfo.c                           |   3 +\n builtin/mailsplit.c                          |   1 +\n builtin/merge-base.c                         |   1 +\n builtin/merge-file.c                         |   3 +\n builtin/merge-recursive.c                    |   1 +\n builtin/merge-tree.c                         |   1 +\n builtin/merge.c                              |   4 +\n builtin/mktag.c                              |   1 +\n builtin/mktree.c                             |   1 +\n builtin/multi-pack-index.c                   |   3 +\n builtin/mv.c                                 |   4 +\n builtin/name-rev.c                           |   2 +\n builtin/notes.c                              |   2 +\n builtin/pack-objects.c                       |   3 +\n builtin/pack-redundant.c                     |   1 +\n builtin/pack-refs.c                          |   1 +\n builtin/patch-id.c                           |   1 +\n builtin/prune-packed.c                       |   1 +\n builtin/prune.c                              |   2 +\n builtin/pull.c                               |   1 +\n builtin/push.c                               |   2 +\n builtin/range-diff.c                         |   1 +\n builtin/read-tree.c                          |   2 +\n builtin/rebase.c                             |   4 +\n builtin/receive-pack.c                       |   4 +\n builtin/reflog.c                             |   1 +\n builtin/remote.c                             |   1 +\n builtin/repack.c                             |   2 +\n builtin/replace.c                            |   2 +\n builtin/rerere.c                             |   2 +\n builtin/reset.c                              |   3 +\n builtin/rev-list.c                           |   2 +\n builtin/rev-parse.c                          |   4 +\n builtin/revert.c                             |   1 +\n builtin/rm.c                                 |   2 +\n builtin/send-pack.c                          |   1 +\n builtin/shortlog.c                           |   3 +\n builtin/show-branch.c                        |   2 +\n builtin/show-index.c                         |   1 +\n builtin/show-ref.c                           |   1 +\n builtin/sparse-checkout.c                    |   3 +\n builtin/stash.c                              |   4 +\n builtin/stripspace.c                         |   3 +\n builtin/submodule--helper.c                  |   4 +\n builtin/symbolic-ref.c                       |   1 +\n builtin/tag.c                                |   3 +\n builtin/unpack-file.c                        |   1 +\n builtin/unpack-objects.c                     |   2 +\n builtin/update-index.c                       |   4 +\n builtin/update-ref.c                         |   1 +\n builtin/update-server-info.c                 |   1 +\n builtin/upload-pack.c                        |   1 +\n builtin/verify-commit.c                      |   1 +\n builtin/verify-pack.c                        |   1 +\n builtin/verify-tag.c                         |   1 +\n builtin/worktree.c                           |   4 +\n builtin/write-tree.c                         |   2 +\n bulk-checkin.c                               |   4 +-\n bulk-checkin.h                               |   2 +-\n bundle-uri.c                                 |   2 +\n bundle.c                                     |   3 +\n bundle.h                                     |   1 -\n cache-tree.c                                 |   3 +-\n cache.h                                      | 571 -------------------\n chdir-notify.c                               |   1 +\n chunk-format.c                               |   2 +\n color.c                                      |   1 +\n combine-diff.c                               |   1 +\n commit-graph.c                               |   4 +-\n commit.c                                     |   3 +\n common-main.c                                |   2 +\n compat/disk.h                                |   2 +\n compat/fsmonitor/fsm-health-win32.c          |   1 +\n compat/fsmonitor/fsm-listen-darwin.c         |   1 +\n compat/fsmonitor/fsm-listen-win32.c          |   1 +\n compat/fsmonitor/fsm-path-utils-darwin.c     |   1 +\n compat/fsmonitor/fsm-path-utils-win32.c      |   1 +\n compat/linux/procinfo.c                      |   2 +-\n compat/mingw.c                               |   4 +\n compat/precompose_utf8.c                     |   2 +\n compat/simple-ipc/ipc-shared.c               |   2 +-\n compat/simple-ipc/ipc-unix-socket.c          |   1 +\n compat/simple-ipc/ipc-win32.c                |   2 +\n compat/terminal.c                            |   4 +-\n config.c                                     |   7 +-\n connect.c                                    |   2 +\n connected.c                                  |   3 +-\n convert.c                                    |   2 +\n copy.c                                       |   1 +\n credential.c                                 |   2 +\n csum-file.c                                  |   3 +-\n csum-file.h                                  |   2 +-\n daemon.c                                     |   4 +\n date.c                                       |   1 +\n delta-islands.c                              |   3 +-\n diagnose.c                                   |   2 +\n diff-lib.c                                   |   1 +\n diff-no-index.c                              |   2 +\n diff.c                                       |   5 +\n dir.c                                        |   5 +\n editor.c                                     |   3 +\n entry.c                                      |   3 +\n environment.c                                |   5 +\n environment.h                                | 220 +++++++\n exec-cmd.c                                   |   3 +\n fetch-pack.c                                 |   5 +-\n fmt-merge-msg.c                              |   3 +-\n fsck.c                                       |   2 +-\n fsmonitor-ipc.c                              |   1 +\n fsmonitor.c                                  |   1 +\n gettext.c                                    |   4 +-\n git.c                                        |   3 +\n gpg-interface.c                              |   6 +-\n grep.c                                       |   3 +-\n http-backend.c                               |   5 +-\n http-fetch.c                                 |   2 +\n http-push.c                                  |   2 +\n imap-send.c                                  |   3 +\n line-log.c                                   |   2 +-\n list-objects-filter-options.h                |   1 +\n list-objects-filter.c                        |   1 +\n list-objects.c                               |   1 +\n ll-merge.c                                   |   1 +\n lockfile.c                                   |   4 +-\n log-tree.c                                   |   2 +\n ls-refs.c                                    |   4 +-\n mailmap.c                                    |   2 +\n merge-ort-wrappers.c                         |   1 +\n merge-ort.c                                  |   2 +\n merge-recursive.c                            |   3 +\n merge.c                                      |   1 +\n midx.c                                       |   4 +-\n name-hash.c                                  |   2 +\n negotiator/default.c                         |   2 +-\n negotiator/skipping.c                        |   2 +-\n notes-cache.c                                |   2 +-\n notes-merge.c                                |   2 +\n notes-utils.c                                |   4 +-\n notes.c                                      |   1 +\n object-file.c                                |   7 +-\n object-name.c                                |   3 +\n object.c                                     |   1 +\n pack-bitmap-write.c                          |   5 +-\n pack-bitmap.c                                |   3 +-\n pack-check.c                                 |   1 +\n pack-mtimes.c                                |   3 +-\n pack-revindex.c                              |   1 +\n pack-write.c                                 |   2 +\n pack.h                                       |   2 +\n packfile.c                                   |   5 +-\n packfile.h                                   |   4 +-\n parallel-checkout.c                          |   2 +\n parse-options-cb.c                           |   2 +\n parse-options.c                              |   3 +-\n parse-options.h                              |   2 +\n patch-ids.c                                  |   2 +-\n path.c                                       |   6 +-\n path.h                                       |  62 +-\n pathspec.c                                   |   4 +\n pkt-line.c                                   |   3 +\n preload-index.c                              |   2 +\n pretty.c                                     |   2 +\n progress.c                                   |   1 -\n promisor-remote.c                            |   1 +\n prompt.c                                     |   3 +-\n protocol.c                                   |   1 +\n prune-packed.c                               |   2 +\n range-diff.c                                 |   2 +\n reachable.c                                  |   3 +-\n read-cache.c                                 |   3 +\n rebase-interactive.c                         |   3 +\n ref-filter.c                                 |   4 +-\n ref-filter.h                                 |   1 +\n reflog.c                                     |   3 +-\n refs.c                                       |   6 +-\n refs.h                                       |   1 -\n refs/files-backend.c                         |   7 +-\n refs/iterator.c                              |   2 +-\n refs/packed-backend.c                        |   4 +-\n refspec.c                                    |   1 +\n remote-curl.c                                |   4 +\n remote.c                                     |   6 +-\n replace-object.c                             |   3 +-\n repository.c                                 |   2 +\n rerere.c                                     |   3 +\n rerere.h                                     |   1 +\n reset.c                                      |   1 +\n revision.c                                   |   3 +\n run-command.c                                |   2 +\n scalar.c                                     |   2 +\n send-pack.c                                  |   4 +-\n sequencer.c                                  |   4 +\n server-info.c                                |   4 +-\n setup.c                                      |   4 +\n setup.h                                      | 168 ++++++\n shallow.c                                    |   3 +-\n sideband.c                                   |   2 +\n sparse-index.c                               |   2 +\n split-index.c                                |   1 +\n strbuf.c                                     |   6 +-\n streaming.c                                  |   2 +\n streaming.h                                  |   4 +-\n submodule-config.c                           |   2 +\n submodule.c                                  |   6 +-\n symlinks.c                                   |   2 +\n t/helper/test-advise.c                       |   2 +-\n t/helper/test-bitmap.c                       |   3 +-\n t/helper/test-bloom.c                        |   4 +-\n t/helper/test-bundle-uri.c                   |   1 +\n t/helper/test-cache-tree.c                   |   2 +\n t/helper/test-config.c                       |   2 +-\n t/helper/test-delta.c                        |   2 +-\n t/helper/test-dump-cache-tree.c              |   2 +-\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-split-index.c             |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-fast-rebase.c                  |   5 +-\n t/helper/test-fsmonitor-client.c             |   2 +\n t/helper/test-hash.c                         |   1 -\n t/helper/test-lazy-init-name-hash.c          |   2 +\n t/helper/test-match-trees.c                  |   1 +\n t/helper/test-oid-array.c                    |   1 +\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   1 +\n t/helper/test-pack-mtimes.c                  |   2 +-\n t/helper/test-parse-pathspec-file.c          |   1 -\n t/helper/test-partial-clone.c                |   4 +-\n t/helper/test-path-utils.c                   |   3 +\n t/helper/test-pkt-line.c                     |   3 +-\n t/helper/test-proc-receive.c                 |   4 +-\n t/helper/test-progress.c                     |   1 -\n t/helper/test-reach.c                        |   3 +\n t/helper/test-read-cache.c                   |   2 +\n t/helper/test-read-graph.c                   |   2 +-\n t/helper/test-read-midx.c                    |   1 +\n t/helper/test-ref-store.c                    |   2 +-\n t/helper/test-repository.c                   |   3 +-\n t/helper/test-revision-walking.c             |   2 +-\n t/helper/test-run-command.c                  |   1 -\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-serve-v2.c                     |   3 +-\n t/helper/test-submodule-config.c             |   1 +\n t/helper/test-submodule-nested-repo-config.c |   2 +-\n t/helper/test-submodule.c                    |   2 +-\n t/helper/test-subprocess.c                   |   2 +-\n t/helper/test-trace2.c                       |   2 +-\n t/helper/test-userdiff.c                     |   2 +-\n t/helper/test-write-cache.c                  |   1 +\n tag.c                                        |   2 +\n tempfile.c                                   |   4 +-\n tmp-objdir.c                                 |   2 +\n trace.c                                      |   4 +\n trace2/tr2_cfg.c                             |   4 +-\n trace2/tr2_cmd_name.c                        |   3 +-\n trace2/tr2_dst.c                             |   4 +-\n trace2/tr2_sid.c                             |   3 +-\n trailer.c                                    |   4 +-\n transport-helper.c                           |   3 +\n transport.c                                  |   4 +-\n transport.h                                  |   1 -\n tree-walk.c                                  |   1 +\n unpack-trees.c                               |   3 +\n upload-pack.c                                |   3 +\n usage.c                                      |   4 +-\n walker.c                                     |   1 +\n worktree.c                                   |   5 +\n wrapper.c                                    |   3 +\n wrapper.h                                    |  36 ++\n write-or-die.c                               |   4 +-\n write-or-die.h                               |  78 +++\n wt-status.c                                  |   3 +\n xdiff-interface.c                            |   2 +-\n 340 files changed, 1311 insertions(+), 669 deletions(-)\n create mode 100644 abspath.h\n create mode 100644 setup.h\n create mode 100644 wrapper.h\n create mode 100644 write-or-die.h\n\n\nbase-commit: e25cabbf6b34e4a6e903d65102d87055cc994778\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1493%2Fnewren%2Fheader-cleanup-2-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1493/newren/header-cleanup-2-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1493\n\nRange-diff vs v1:\n\n  1:  88959aba6f1 =  1:  a1be63930c4 treewide: remove unnecessary cache.h inclusion from a few headers\n  2:  b771199fae3 =  2:  6e80396e861 treewide: be explicit about dependence on gettext.h\n  3:  a31269a26b3 =  3:  644d305c669 treewide: remove unnecessary inclusion of gettext.h\n  4:  3c193bef1d0 !  4:  95b86aecb43 treewide: remove unnecessary cache.h inclusion from several sources\n     @@ Commit message\n      \n          A number of files were apparently including cache.h solely to get\n          gettext.h.  By making those files explicitly include gettext.h, we can\n     -    already drop the include of cache.h in these files.  Remove those now\n     -    unnecessary includes.\n     +    already drop the include of cache.h in these files.  On top of that,\n     +    there were some files using cache.h that didn't need to for any reason.\n     +    Remove these unnecessary includes.\n      \n          Signed-off-by: Elijah Newren <newren@gmail.com>\n      \n  5:  43457e44b4e =  5:  417b2ffa999 environment: move comment_line_char from cache.h\n  6:  a0bbd2c9b48 !  6:  1fbd957047d abspath.h: move absolute path functions from cache.h\n     @@ abspath.h (new)\n      + */\n      +char *prefix_filename(const char *prefix, const char *path);\n      +\n     ++/* Likewise, but path==\"-\" always yields \"-\" */\n     ++char *prefix_filename_except_for_dash(const char *prefix, const char *path);\n     ++\n      +static inline int is_absolute_path(const char *path)\n      +{\n      +\treturn is_dir_sep(path[0]) || has_dos_drive_prefix(path);\n     @@ cache.h: const char *setup_git_directory(void);\n      - * prefix was empty).\n      - */\n      -char *prefix_filename(const char *prefix, const char *path);\n     +-\n     +-/* Likewise, but path==\"-\" always yields \"-\" */\n     +-char *prefix_filename_except_for_dash(const char *prefix, const char *path);\n      -\n       int check_filename(const char *prefix, const char *name);\n       void verify_filename(const char *prefix,\n  7:  a0fc4aa2470 =  7:  805d0a86951 cache.h: remove expand_user_path()\n  8:  0f48e561b79 =  8:  b0bfbe7f38c path.h: move function declarations for path.c functions from cache.h\n  9:  66f06731cab =  9:  43a61845240 wrapper.h: move declarations for wrapper.c functions from cache.h\n 10:  f4e15c9e5c2 = 10:  a6c7245219a treewide: remove unnecessary includes of cache.h\n 11:  fa7449b5b99 = 11:  5ef1a4f1d6c environment.h: move declarations for environment.c functions from cache.h\n 12:  4e6a4030b1e = 12:  496d36e4fd0 treewide: remove cache.h inclusion due to environment.h changes\n 13:  9722988e537 = 13:  1d5cd115161 setup.h: move declarations for setup.c functions from cache.h\n 14:  0e84202da90 = 14:  30b21691265 treewide: remove cache.h inclusion due to setup.h changes\n 15:  626d089f10b = 15:  6e40d1d783d write-or-die.h: move declarations for write-or-die.c functions from cache.h\n 16:  38af06f55bc = 16:  72d58b391a1 csum-file.h: remove unnecessary inclusion of cache.h\n\n-- \ngitgitgadget\n"},{"id":"473826","messageId":"417b2ffa9992846cd3d93681ad19f66158ae1a42.1679379971.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 05/16] environment: move comment_line_char from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:57Z","receivedAt":"2023-03-21T06:26:39Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThis is one step towards making strbuf.c not depend upon cache.h.\nAdditional steps will follow in subsequent commits.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-patch.c      | 1 +\n builtin/branch.c | 1 +\n builtin/commit.c | 1 +\n builtin/merge.c  | 1 +\n builtin/tag.c    | 1 +\n cache.h          | 7 -------\n commit.c         | 1 +\n environment.h    | 7 +++++++\n fmt-merge-msg.c  | 1 +\n sequencer.c      | 1 +\n strbuf.c         | 1 +\n trailer.c        | 1 +\n wt-status.c      | 1 +\n 13 files changed, 18 insertions(+), 7 deletions(-)\n\ndiff --git a/add-patch.c b/add-patch.c\nindex 4c803a5f4db..e59830291a6 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"add-interactive.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a67a8334d5c..56dbee97d20 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 25575435ad7..42bf20f589c 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -12,6 +12,7 @@\n #include \"cache-tree.h\"\n #include \"color.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex a90ae5d2ddc..2c9da4b23d1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex c2ea89c4754..0611b3bd600 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/cache.h b/cache.h\nindex 5a736a2b7e7..e122de6f930 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -959,13 +959,6 @@ extern int sparse_expect_files_outside_of_patterns;\n  */\n int use_optional_locks(void);\n \n-/*\n- * The character that begins a commented line in user-editable file\n- * that is subject to stripspace.\n- */\n-extern char comment_line_char;\n-extern int auto_comment_line_char;\n-\n enum log_refs_config {\n \tLOG_REFS_UNSET = -1,\n \tLOG_REFS_NONE = 0,\ndiff --git a/commit.c b/commit.c\nindex 3fdfb325117..f88fc5e1a2c 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -2,6 +2,7 @@\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"commit-graph.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/environment.h b/environment.h\nindex d438b5c8f3a..a26931556af 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -3,6 +3,13 @@\n \n #include \"strvec.h\"\n \n+/*\n+ * The character that begins a commented line in user-editable file\n+ * that is subject to stripspace.\n+ */\n+extern char comment_line_char;\n+extern int auto_comment_line_char;\n+\n /*\n  * Wrapper of getenv() that returns a strdup value. This value is kept\n  * in argv to be freed later.\ndiff --git a/fmt-merge-msg.c b/fmt-merge-msg.c\nindex c870cb95b9d..bc4e61c5b1a 100644\n--- a/fmt-merge-msg.c\n+++ b/fmt-merge-msg.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"diff.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 0df51726306..7fa776b0615 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex 15209777d5a..b9cd593b147 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/trailer.c b/trailer.c\nindex 9eb1b761190..6a5091a3c46 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex d15f2b0e7e8..106e46480a1 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n-- \ngitgitgadget\n\n"},{"id":"473827","messageId":"805d0a86951eeaf0abf6760e127940c3a0e1dfb6.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 07/16] cache.h: remove expand_user_path()","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:59Z","receivedAt":"2023-03-21T06:26:40Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nexpand_user_path() was renamed to interpolate_path() back in mid-2021,\nbut reinstated with a #define and a NEEDSWORK comment that we would\neventually want to get rid of it.  Do so now.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n cache.h         | 2 --\n gpg-interface.c | 2 +-\n 2 files changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 260203c7a62..978aa01712b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1142,8 +1142,6 @@ enum scld_error safe_create_leading_directories_no_share(char *path);\n \n int mkdir_in_gitdir(const char *path);\n char *interpolate_path(const char *path, int real_home);\n-/* NEEDSWORK: remove this synonym once in-flight topics have migrated */\n-#define expand_user_path interpolate_path\n const char *enter_repo(const char *path, int strict);\n const char *remove_leading_path(const char *in, const char *prefix);\n const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 632265691e5..f9c5b6c3f53 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1049,7 +1049,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,\n \t\tssh_signing_key_file = strbuf_detach(&key_file->filename, NULL);\n \t} else {\n \t\t/* We assume a file */\n-\t\tssh_signing_key_file = expand_user_path(signing_key, 1);\n+\t\tssh_signing_key_file = interpolate_path(signing_key, 1);\n \t}\n \n \tbuffer_file = mks_tempfile_t(\".git_signing_buffer_tmpXXXXXX\");\n-- \ngitgitgadget\n\n"},{"id":"473828","messageId":"1fbd957047d96e5efde6a472b872b400d8a94cdb.1679379971.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 06/16] abspath.h: move absolute path functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:58Z","receivedAt":"2023-03-21T06:26:43Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThis is another step towards letting us remove the include of cache.h in\nstrbuf.c.  It does mean that we also need to add includes of abspath.h\nin a number of C files.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n abspath.c                          |  4 +++-\n abspath.h                          | 33 ++++++++++++++++++++++++++++++\n apply.c                            |  1 +\n archive.c                          |  1 +\n builtin/am.c                       |  1 +\n builtin/bugreport.c                |  1 +\n builtin/bundle.c                   |  1 +\n builtin/clean.c                    |  1 +\n builtin/clone.c                    |  1 +\n builtin/config.c                   |  1 +\n builtin/credential-cache--daemon.c |  1 +\n builtin/diagnose.c                 |  1 +\n builtin/difftool.c                 |  1 +\n builtin/fast-import.c              |  1 +\n builtin/fsmonitor--daemon.c        |  1 +\n builtin/gc.c                       |  1 +\n builtin/hash-object.c              |  1 +\n builtin/init-db.c                  |  1 +\n builtin/log.c                      |  1 +\n builtin/mailinfo.c                 |  1 +\n builtin/merge-file.c               |  1 +\n builtin/merge.c                    |  1 +\n builtin/multi-pack-index.c         |  1 +\n builtin/mv.c                       |  1 +\n builtin/rebase.c                   |  1 +\n builtin/receive-pack.c             |  1 +\n builtin/rev-parse.c                |  1 +\n builtin/stash.c                    |  1 +\n builtin/submodule--helper.c        |  1 +\n builtin/worktree.c                 |  1 +\n cache.h                            | 27 ------------------------\n chdir-notify.c                     |  1 +\n compat/disk.h                      |  1 +\n compat/mingw.c                     |  1 +\n compat/simple-ipc/ipc-win32.c      |  1 +\n config.c                           |  1 +\n credential.c                       |  1 +\n daemon.c                           |  1 +\n diff-no-index.c                    |  1 +\n diff.c                             |  1 +\n dir.c                              |  1 +\n editor.c                           |  1 +\n environment.c                      |  1 +\n exec-cmd.c                         |  1 +\n gettext.c                          |  1 +\n lockfile.c                         |  1 +\n midx.c                             |  1 +\n object-file.c                      |  1 +\n parse-options.c                    |  1 +\n path.c                             |  1 +\n pathspec.c                         |  1 +\n remote.c                           |  1 +\n repository.c                       |  1 +\n rerere.c                           |  1 +\n scalar.c                           |  1 +\n sequencer.c                        |  1 +\n setup.c                            |  1 +\n strbuf.c                           |  1 +\n submodule.c                        |  1 +\n t/helper/test-path-utils.c         |  1 +\n tmp-objdir.c                       |  1 +\n trace.c                            |  1 +\n trace2/tr2_dst.c                   |  1 +\n worktree.c                         |  1 +\n wrapper.c                          |  1 +\n 65 files changed, 98 insertions(+), 28 deletions(-)\n create mode 100644 abspath.h\n\ndiff --git a/abspath.c b/abspath.c\nindex 9a81c5525be..d032f5dce51 100644\n--- a/abspath.c\n+++ b/abspath.c\n@@ -1,4 +1,6 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"abspath.h\"\n+#include \"strbuf.h\"\n \n /*\n  * Do not use this for inspecting *tracked* content.  When path is a\ndiff --git a/abspath.h b/abspath.h\nnew file mode 100644\nindex 00000000000..7cd3de5e9de\n--- /dev/null\n+++ b/abspath.h\n@@ -0,0 +1,33 @@\n+#ifndef ABSPATH_H\n+#define ABSPATH_H\n+\n+int is_directory(const char *);\n+char *strbuf_realpath(struct strbuf *resolved, const char *path,\n+\t\t      int die_on_error);\n+char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,\n+\t\t\t\tint die_on_error);\n+char *real_pathdup(const char *path, int die_on_error);\n+const char *absolute_path(const char *path);\n+char *absolute_pathdup(const char *path);\n+\n+/*\n+ * Concatenate \"prefix\" (if len is non-zero) and \"path\", with no\n+ * connecting characters (so \"prefix\" should end with a \"/\").\n+ * Unlike prefix_path, this should be used if the named file does\n+ * not have to interact with index entry; i.e. name of a random file\n+ * on the filesystem.\n+ *\n+ * The return value is always a newly allocated string (even if the\n+ * prefix was empty).\n+ */\n+char *prefix_filename(const char *prefix, const char *path);\n+\n+/* Likewise, but path==\"-\" always yields \"-\" */\n+char *prefix_filename_except_for_dash(const char *prefix, const char *path);\n+\n+static inline int is_absolute_path(const char *path)\n+{\n+\treturn is_dir_sep(path[0]) || has_dos_drive_prefix(path);\n+}\n+\n+#endif /* ABSPATH_H */\ndiff --git a/apply.c b/apply.c\nindex e0bdd43a68e..e5e11b85793 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"object-store.h\"\ndiff --git a/archive.c b/archive.c\nindex 2c3da1cff30..c3c45a5ebe9 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex cc1fdf4f75d..14347ecf9aa 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex b61cfa9464f..b5dfad4e12a 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex de3898ffa41..9e2aecadf7d 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 46c51029ab4..fdcf62c5dfe 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -8,6 +8,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex d605fcafa0f..b94324ea02c 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -10,6 +10,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 33b17b40b41..42e6b8d3481 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 0f00ba4d741..62c09a271d6 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/diagnose.c b/builtin/diagnose.c\nindex 5b12d1fb963..0f8b64994c4 100644\n--- a/builtin/diagnose.c\n+++ b/builtin/diagnose.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"diagnose.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex f7380dd1cc7..ed06db12085 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -13,6 +13,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f3635c7aefd..7307c4657f2 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 215e3813d7d..4efb1417344 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 32cabad7cf6..ef063fc828c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -11,6 +11,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex f233eda7590..7651a7a5f56 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -5,6 +5,7 @@\n  * Copyright (C) Junio C Hamano, 2005\n  */\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex e182bc7e839..6f724f694f4 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex e702cf126e5..b7333b34cce 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -5,6 +5,7 @@\n  *\t\t 2006 Junio Hamano\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex e8bb011cfb4..e14f7c0abce 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -3,6 +3,7 @@\n  * email to figure out authorship and subject\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"builtin.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex ae45f523b95..c0096ee0810 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 2c9da4b23d1..38243e55c5f 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -8,6 +8,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex e6757a44470..579bc2cac0c 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex c02dddb72b5..0a49bf21b0f 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex a2c68b8ff7b..a3f8be88882 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -6,6 +6,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 006565f8513..aec5ee930b2 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 5a932a861b4..a4c0878bc91 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -5,6 +5,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 65817d0b763..52fa892f7eb 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1,5 +1,6 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex a4bdd44daa3..ff1fd8c87ab 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,5 +1,6 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex ed89b7e9725..ed614ffddcb 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"checkout.h\"\n #include \"config.h\"\n #include \"builtin.h\"\ndiff --git a/cache.h b/cache.h\nindex e122de6f930..260203c7a62 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -598,21 +598,6 @@ const char *setup_git_directory(void);\n char *prefix_path(const char *prefix, int len, const char *path);\n char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n \n-/*\n- * Concatenate \"prefix\" (if len is non-zero) and \"path\", with no\n- * connecting characters (so \"prefix\" should end with a \"/\").\n- * Unlike prefix_path, this should be used if the named file does\n- * not have to interact with index entry; i.e. name of a random file\n- * on the filesystem.\n- *\n- * The return value is always a newly allocated string (even if the\n- * prefix was empty).\n- */\n-char *prefix_filename(const char *prefix, const char *path);\n-\n-/* Likewise, but path==\"-\" always yields \"-\" */\n-char *prefix_filename_except_for_dash(const char *prefix, const char *path);\n-\n int check_filename(const char *prefix, const char *name);\n void verify_filename(const char *prefix,\n \t\t     const char *name,\n@@ -1160,18 +1145,6 @@ char *interpolate_path(const char *path, int real_home);\n /* NEEDSWORK: remove this synonym once in-flight topics have migrated */\n #define expand_user_path interpolate_path\n const char *enter_repo(const char *path, int strict);\n-static inline int is_absolute_path(const char *path)\n-{\n-\treturn is_dir_sep(path[0]) || has_dos_drive_prefix(path);\n-}\n-int is_directory(const char *);\n-char *strbuf_realpath(struct strbuf *resolved, const char *path,\n-\t\t      int die_on_error);\n-char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,\n-\t\t\t\tint die_on_error);\n-char *real_pathdup(const char *path, int die_on_error);\n-const char *absolute_path(const char *path);\n-char *absolute_pathdup(const char *path);\n const char *remove_leading_path(const char *in, const char *prefix);\n const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\ndiff --git a/chdir-notify.c b/chdir-notify.c\nindex 5f7f2c2ac23..929ec01b3a2 100644\n--- a/chdir-notify.c\n+++ b/chdir-notify.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"list.h\"\n #include \"strbuf.h\"\ndiff --git a/compat/disk.h b/compat/disk.h\nindex a04a8d294af..6c979c27d89 100644\n--- a/compat/disk.h\n+++ b/compat/disk.h\n@@ -2,6 +2,7 @@\n #define COMPAT_DISK_H\n \n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n \n static int get_disk_info(struct strbuf *out)\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex a9e5570288c..cbcd03aea9b 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -7,6 +7,7 @@\n #include \"../strbuf.h\"\n #include \"../run-command.h\"\n #include \"../cache.h\"\n+#include \"../abspath.h\"\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\ndiff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c\nindex f011e5cead8..997f6144344 100644\n--- a/compat/simple-ipc/ipc-win32.c\n+++ b/compat/simple-ipc/ipc-win32.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\ndiff --git a/config.c b/config.c\nindex f30a6d8e686..6815919ec30 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"date.h\"\n #include \"branch.h\"\ndiff --git a/credential.c b/credential.c\nindex 5244f3c12c0..e6417bf8804 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"credential.h\"\n #include \"gettext.h\"\ndiff --git a/daemon.c b/daemon.c\nindex 8908e7f8d2a..bb795ca3ca9 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"pkt-line.h\"\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 287a113badd..934a24bee58 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"color.h\"\n #include \"commit.h\"\n #include \"blob.h\"\ndiff --git a/diff.c b/diff.c\nindex 00746f2f86e..1b0be99c065 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2,6 +2,7 @@\n  * Copyright (C) 2005 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/dir.c b/dir.c\nindex 46f1bb6e5b7..c72481c60ee 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -6,6 +6,7 @@\n  *\t\t Junio Hamano, 2005-2006\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/editor.c b/editor.c\nindex 58e790548d2..2d3e6be64e4 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/environment.c b/environment.c\nindex 82a1fc17d0b..c69571f0b29 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"branch.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 282d95af081..042d9247a5b 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\ndiff --git a/gettext.c b/gettext.c\nindex f139008d0a3..3e7b3baabc6 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex ab6490a391d..673c21d17a9 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\n \ndiff --git a/midx.c b/midx.c\nindex e132ef250e4..b111665dcab 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"csum-file.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 39660d49dbc..bee41b30474 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex 084b4f10621..a577cc85f67 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n+#include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\ndiff --git a/path.c b/path.c\nindex 3f2702cbe49..3976c0d7ace 100644\n--- a/path.c\n+++ b/path.c\n@@ -2,6 +2,7 @@\n  * Utilities for paths and pathnames\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 868b4d280ca..53763e272f5 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/remote.c b/remote.c\nindex edb1e07497c..2bae247a0a4 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/repository.c b/repository.c\nindex 937fa974b38..4412f633224 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -4,6 +4,7 @@\n  */\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"config.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 9428cbca7b2..c3258e13902 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,4 +1,5 @@\n #include \"git-compat-util.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/scalar.c b/scalar.c\nindex ca19b95ce46..fe61a3ebdd7 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"config.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 7fa776b0615..c61c1fc4d87 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\ndiff --git a/setup.c b/setup.c\nindex 8a4ccee4c2c..8f385d9f29b 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/strbuf.c b/strbuf.c\nindex b9cd593b147..9633e37b62f 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 8b551e53274..13ff333f68c 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex f69709d674f..d3d00dc34fa 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/tmp-objdir.c b/tmp-objdir.c\nindex 2a2012eb6d0..fff15cb6b5c 100644\n--- a/tmp-objdir.c\n+++ b/tmp-objdir.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"tmp-objdir.h\"\n+#include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"dir.h\"\n #include \"sigchain.h\"\ndiff --git a/trace.c b/trace.c\nindex efa4e2d8e08..2b41c683fc8 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -22,6 +22,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"quote.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\ndiff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c\nindex 8a21dd29725..273260e1f18 100644\n--- a/trace2/tr2_dst.c\n+++ b/trace2/tr2_dst.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"sigchain.h\"\n #include \"trace2/tr2_dst.h\"\n #include \"trace2/tr2_sid.h\"\ndiff --git a/worktree.c b/worktree.c\nindex 09eb522e5a9..b7bc4c7bb7a 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"alloc.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 0d4ceba6fc5..df1fa6286d0 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -2,6 +2,7 @@\n  * Various trivial helper wrappers around standard functions\n  */\n #include \"cache.h\"\n+#include \"abspath.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n \n-- \ngitgitgadget\n\n"},{"id":"473829","messageId":"b0bfbe7f38c99e4371265f0e92fbe38adfc09bd8.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 08/16] path.h: move function declarations for path.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:00Z","receivedAt":"2023-03-21T06:26:45Z","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 | 59 ------------------------------------------------------\n path.h  | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 61 insertions(+), 60 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 978aa01712b..705c41992bc 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1105,7 +1105,6 @@ enum sharedrepo {\n \tPERM_EVERYBODY      = 0664\n };\n int git_config_perm(const char *var, const char *value);\n-int adjust_shared_perm(const char *path);\n \n /*\n  * Create the directory containing the named path, using care to be\n@@ -1141,54 +1140,6 @@ enum scld_error safe_create_leading_directories_const(const char *path);\n enum scld_error safe_create_leading_directories_no_share(char *path);\n \n int mkdir_in_gitdir(const char *path);\n-char *interpolate_path(const char *path, int real_home);\n-const char *enter_repo(const char *path, int strict);\n-const char *remove_leading_path(const char *in, const char *prefix);\n-const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n-int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\n-int normalize_path_copy(char *dst, const char *src);\n-int longest_ancestor_length(const char *path, struct string_list *prefixes);\n-char *strip_path_suffix(const char *path, const char *suffix);\n-int daemon_avoid_alias(const char *path);\n-\n-/*\n- * These functions match their is_hfs_dotgit() counterparts; see utf8.h for\n- * details.\n- */\n-int is_ntfs_dotgit(const char *name);\n-int is_ntfs_dotgitmodules(const char *name);\n-int is_ntfs_dotgitignore(const char *name);\n-int is_ntfs_dotgitattributes(const char *name);\n-int is_ntfs_dotmailmap(const char *name);\n-\n-/*\n- * Returns true iff \"str\" could be confused as a command-line option when\n- * passed to a sub-program like \"ssh\". Note that this has nothing to do with\n- * shell-quoting, which should be handled separately; we're assuming here that\n- * the string makes it verbatim to the sub-program.\n- */\n-int looks_like_command_line_option(const char *str);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CONFIG_HOME/$subdir/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n- * \"$HOME/.config/$subdir/$filename\". Return NULL upon error.\n- */\n-char *xdg_config_home_for(const char *subdir, const char *filename);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CONFIG_HOME/git/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n- * \"$HOME/.config/git/$filename\". Return NULL upon error.\n- */\n-char *xdg_config_home(const char *filename);\n-\n-/**\n- * Return a newly allocated string with the evaluation of\n- * \"$XDG_CACHE_HOME/git/$filename\" if $XDG_CACHE_HOME is non-empty, otherwise\n- * \"$HOME/.cache/git/$filename\". Return NULL upon error.\n- */\n-char *xdg_cache_home(const char *filename);\n \n int git_open_cloexec(const char *name, int flags);\n #define git_open(name) git_open_cloexec(name, O_RDONLY)\n@@ -1355,8 +1306,6 @@ int repo_interpret_branch_name(struct repository *r,\n #define interpret_branch_name(str, len, buf, options) \\\n \trepo_interpret_branch_name(the_repository, str, len, buf, options)\n \n-int validate_headref(const char *ref);\n-\n 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@@ -1616,14 +1565,6 @@ void stat_validity_update(struct stat_validity *sv, int fd);\n \n int versioncmp(const char *s1, const char *s2);\n \n-/*\n- * Create a directory and (if share is nonzero) adjust its permissions\n- * according to the shared_repository setting. Only use this for\n- * directories under $GIT_DIR.  Don't use it for working tree\n- * directories.\n- */\n-void safe_create_dir(const char *dir, int share);\n-\n /*\n  * Should we print an ellipsis after an abbreviated SHA-1 value\n  * when doing diff-raw output or indicating a detached HEAD?\ndiff --git a/path.h b/path.h\nindex 0a59c85a62e..60e83a49a98 100644\n--- a/path.h\n+++ b/path.h\n@@ -3,6 +3,7 @@\n \n struct repository;\n struct strbuf;\n+struct string_list;\n \n /*\n  * The result to all functions which return statically allocated memory may be\n@@ -179,7 +180,66 @@ const char *git_path_auto_merge(struct repository *r);\n const char *git_path_fetch_head(struct repository *r);\n const char *git_path_shallow(struct repository *r);\n \n-\n int ends_with_path_components(const char *path, const char *components);\n+int validate_headref(const char *ref);\n+\n+int adjust_shared_perm(const char *path);\n+\n+char *interpolate_path(const char *path, int real_home);\n+const char *enter_repo(const char *path, int strict);\n+const char *remove_leading_path(const char *in, const char *prefix);\n+const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);\n+int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);\n+int normalize_path_copy(char *dst, const char *src);\n+int longest_ancestor_length(const char *path, struct string_list *prefixes);\n+char *strip_path_suffix(const char *path, const char *suffix);\n+int daemon_avoid_alias(const char *path);\n+\n+/*\n+ * These functions match their is_hfs_dotgit() counterparts; see utf8.h for\n+ * details.\n+ */\n+int is_ntfs_dotgit(const char *name);\n+int is_ntfs_dotgitmodules(const char *name);\n+int is_ntfs_dotgitignore(const char *name);\n+int is_ntfs_dotgitattributes(const char *name);\n+int is_ntfs_dotmailmap(const char *name);\n+\n+/*\n+ * Returns true iff \"str\" could be confused as a command-line option when\n+ * passed to a sub-program like \"ssh\". Note that this has nothing to do with\n+ * shell-quoting, which should be handled separately; we're assuming here that\n+ * the string makes it verbatim to the sub-program.\n+ */\n+int looks_like_command_line_option(const char *str);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CONFIG_HOME/$subdir/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n+ * \"$HOME/.config/$subdir/$filename\". Return NULL upon error.\n+ */\n+char *xdg_config_home_for(const char *subdir, const char *filename);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CONFIG_HOME/git/$filename\" if $XDG_CONFIG_HOME is non-empty, otherwise\n+ * \"$HOME/.config/git/$filename\". Return NULL upon error.\n+ */\n+char *xdg_config_home(const char *filename);\n+\n+/**\n+ * Return a newly allocated string with the evaluation of\n+ * \"$XDG_CACHE_HOME/git/$filename\" if $XDG_CACHE_HOME is non-empty, otherwise\n+ * \"$HOME/.cache/git/$filename\". Return NULL upon error.\n+ */\n+char *xdg_cache_home(const char *filename);\n+\n+/*\n+ * Create a directory and (if share is nonzero) adjust its permissions\n+ * according to the shared_repository setting. Only use this for\n+ * directories under $GIT_DIR.  Don't use it for working tree\n+ * directories.\n+ */\n+void safe_create_dir(const char *dir, int share);\n \n #endif /* PATH_H */\n-- \ngitgitgadget\n\n"},{"id":"473830","messageId":"a6c7245219af6552c139903b5ecd12e497384f67.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 10/16] treewide: remove unnecessary includes of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:02Z","receivedAt":"2023-03-21T06:26:48Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nThe last several commits were geared at replacing the include of cache.h\nin strbuf.c with an include of git-compat-util.h.  Unfortunately, I had\nto drop a patch moving some functions from cache.h to object-name.h, due\nto excessive conflicts with other in-flight topics.\n\nHowever, even without that patch, the series of patches so far allows us\nto modify a number of C files to replace an include of cache.h with\ngit-compat-util.h.  Do that to reduce our dependencies.\n\n(If we could have kept our object-name.h patch in this series, it would\nhave also let us reduce the includes in checkout.c and fmt-merge-msg.c\nin addition to strbuf.c).\n\nJust to ensure that nothing else was bringing in cache.h, all of the\naffected files have been checked to ensure that\n    gcc -E -I. $SOURCE_FILE | grep '\"cache.h\"'\nfound no hits and that\n    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}\nsuccessfully compiles without warnings.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/terminal.c      | 2 +-\n gpg-interface.c        | 2 +-\n lockfile.c             | 2 +-\n parse-options.c        | 1 -\n t/helper/test-delta.c  | 1 -\n t/helper/test-trace2.c | 2 +-\n tempfile.c             | 3 ++-\n trace2/tr2_cfg.c       | 4 +++-\n trace2/tr2_cmd_name.c  | 3 ++-\n trace2/tr2_dst.c       | 3 ++-\n trace2/tr2_sid.c       | 3 ++-\n usage.c                | 3 ++-\n 12 files changed, 17 insertions(+), 12 deletions(-)\n\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex ed2b30b38f7..d87e3211892 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"compat/terminal.h\"\n #include \"gettext.h\"\n #include \"sigchain.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 6644701fda0..aceeb083367 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"commit.h\"\n #include \"config.h\"\n #include \"gettext.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex 673c21d17a9..1d5ed016828 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -2,7 +2,7 @@\n  * Copyright (c) 2005, Junio C Hamano\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"gettext.h\"\n #include \"lockfile.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex a577cc85f67..b6803647d0e 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,7 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n #include \"abspath.h\"\n-#include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\ndiff --git a/t/helper/test-delta.c b/t/helper/test-delta.c\nindex 6609fcbc12e..e7d134ec251 100644\n--- a/t/helper/test-delta.c\n+++ b/t/helper/test-delta.c\n@@ -11,7 +11,6 @@\n #include \"test-tool.h\"\n #include \"git-compat-util.h\"\n #include \"delta.h\"\n-#include \"cache.h\"\n #include \"wrapper.h\"\n \n static const char usage_str[] =\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex f374c21ec32..a476df6c6cb 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -1,9 +1,9 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n #include \"config.h\"\n+#include \"trace2.h\"\n \n typedef int(fn_unit_test)(int argc, const char **argv);\n \ndiff --git a/tempfile.c b/tempfile.c\nindex cdd2cab3bad..50c377134ce 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -42,7 +42,8 @@\n  * file created by its parent.\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"path.h\"\n #include \"tempfile.h\"\n #include \"sigchain.h\"\n #include \"wrapper.h\"\ndiff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c\nindex ec9ac1a6efd..78cfc15d52d 100644\n--- a/trace2/tr2_cfg.c\n+++ b/trace2/tr2_cfg.c\n@@ -1,5 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"strbuf.h\"\n+#include \"trace2.h\"\n #include \"trace2/tr2_cfg.h\"\n #include \"trace2/tr2_sysenv.h\"\n \ndiff --git a/trace2/tr2_cmd_name.c b/trace2/tr2_cmd_name.c\nindex dd313204f51..b7b5a869b74 100644\n--- a/trace2/tr2_cmd_name.c\n+++ b/trace2/tr2_cmd_name.c\n@@ -1,4 +1,5 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_cmd_name.h\"\n \n #define TR2_ENVVAR_PARENT_NAME \"GIT_TRACE2_PARENT_NAME\"\ndiff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c\nindex 273260e1f18..5be892cd5cd 100644\n--- a/trace2/tr2_dst.c\n+++ b/trace2/tr2_dst.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"sigchain.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_dst.h\"\n #include \"trace2/tr2_sid.h\"\n #include \"trace2/tr2_sysenv.h\"\ndiff --git a/trace2/tr2_sid.c b/trace2/tr2_sid.c\nindex 5f1ce6f85cf..09c4ef0d173 100644\n--- a/trace2/tr2_sid.c\n+++ b/trace2/tr2_sid.c\n@@ -1,5 +1,6 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"hex.h\"\n+#include \"strbuf.h\"\n #include \"trace2/tr2_tbuf.h\"\n #include \"trace2/tr2_sid.h\"\n \ndiff --git a/usage.c b/usage.c\nindex b53c99dbe5b..46d99f8bd43 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -3,8 +3,9 @@\n  *\n  * Copyright (C) Linus Torvalds, 2005\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n+#include \"trace2.h\"\n #include \"wrapper.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n-- \ngitgitgadget\n\n"},{"id":"473831","messageId":"496d36e4fd0cd68ef6592d3694c8c4ec281f579b.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 12/16] treewide: remove cache.h inclusion due to environment.h changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:04Z","receivedAt":"2023-03-21T06:26: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 csum-file.c            | 2 +-\n gettext.c              | 2 +-\n ls-refs.c              | 2 +-\n notes-utils.c          | 2 +-\n prompt.c               | 2 +-\n prune-packed.c         | 2 +-\n reachable.c            | 2 +-\n t/helper/test-bitmap.c | 2 +-\n trailer.c              | 2 +-\n 9 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/csum-file.c b/csum-file.c\nindex 2d22f80d901..82ae2973d30 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -7,7 +7,7 @@\n  * files. Useful when you write a file that you want to be\n  * able to verify hasn't been messed with afterwards.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n #include \"wrapper.h\"\ndiff --git a/gettext.c b/gettext.c\nindex 85d3d3424eb..5f348708300 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -2,7 +2,7 @@\n  * Copyright (c) 2010 Ævar Arnfjörð Bjarmason\n  */\n \n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"exec-cmd.h\"\ndiff --git a/ls-refs.c b/ls-refs.c\nindex 12cbb40a198..b9f3e08ec3d 100644\n--- a/ls-refs.c\n+++ b/ls-refs.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 \"hex.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex 8797271faf1..86552f31c4a 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"commit.h\"\n #include \"environment.h\"\ndiff --git a/prompt.c b/prompt.c\nindex ba10813b313..3baa33f63d8 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"environment.h\"\n #include \"run-command.h\"\ndiff --git a/prune-packed.c b/prune-packed.c\nindex 5a57072a7ac..58412b4fb91 100644\n--- a/prune-packed.c\n+++ b/prune-packed.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 \"object-store.h\"\ndiff --git a/reachable.c b/reachable.c\nindex b0f85046e9c..55bb1143530 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c\nindex ff35f5999b3..5bb489882da 100644\n--- a/t/helper/test-bitmap.c\n+++ b/t/helper/test-bitmap.c\n@@ -1,5 +1,5 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"pack-bitmap.h\"\n \n static int bitmap_list_commits(void)\ndiff --git a/trailer.c b/trailer.c\nindex 6a5091a3c46..a2c3ed6f28c 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,4 +1,4 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"473832","messageId":"43a61845240b69fd57ec3488517d3dc1201615c6.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 09/16] wrapper.h: move declarations for wrapper.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:01Z","receivedAt":"2023-03-21T06:26: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 apply.c                          |  1 +\n builtin/am.c                     |  1 +\n builtin/bisect.c                 |  1 +\n builtin/branch.c                 |  1 +\n builtin/bugreport.c              |  2 +-\n builtin/config.c                 |  1 +\n builtin/credential-cache.c       |  1 +\n builtin/difftool.c               |  1 +\n builtin/fast-import.c            |  1 +\n builtin/fmt-merge-msg.c          |  1 +\n builtin/gc.c                     |  1 +\n builtin/get-tar-commit-id.c      |  1 +\n builtin/index-pack.c             |  1 +\n builtin/init-db.c                |  1 +\n builtin/merge.c                  |  1 +\n builtin/pack-objects.c           |  1 +\n builtin/rebase.c                 |  1 +\n builtin/receive-pack.c           |  1 +\n builtin/rerere.c                 |  1 +\n builtin/unpack-file.c            |  1 +\n builtin/worktree.c               |  1 +\n cache.h                          | 32 ----------------------------\n commit-graph.c                   |  1 +\n compat/mingw.c                   |  1 +\n compat/terminal.c                |  1 +\n config.c                         |  1 +\n convert.c                        |  1 +\n copy.c                           |  1 +\n csum-file.c                      |  1 +\n daemon.c                         |  1 +\n diff.c                           |  1 +\n dir.c                            |  1 +\n entry.c                          |  1 +\n environment.c                    |  1 +\n fetch-pack.c                     |  1 +\n gpg-interface.c                  |  1 +\n http-backend.c                   |  1 +\n imap-send.c                      |  1 +\n ll-merge.c                       |  1 +\n merge-recursive.c                |  1 +\n notes-merge.c                    |  1 +\n object-file.c                    |  1 +\n packfile.c                       |  1 +\n parallel-checkout.c              |  1 +\n pkt-line.c                       |  1 +\n read-cache.c                     |  1 +\n rebase-interactive.c             |  1 +\n refs.c                           |  1 +\n refs/files-backend.c             |  3 ++-\n rerere.c                         |  1 +\n sequencer.c                      |  1 +\n server-info.c                    |  1 +\n shallow.c                        |  1 +\n strbuf.c                         |  1 +\n streaming.c                      |  1 +\n t/helper/test-delta.c            |  1 +\n t/helper/test-fsmonitor-client.c |  1 +\n t/helper/test-read-cache.c       |  1 +\n tag.c                            |  1 +\n tempfile.c                       |  1 +\n trace.c                          |  1 +\n transport-helper.c               |  1 +\n transport.c                      |  1 +\n usage.c                          |  1 +\n worktree.c                       |  1 +\n wrapper.c                        |  1 +\n wrapper.h                        | 36 ++++++++++++++++++++++++++++++++\n write-or-die.c                   |  1 +\n 68 files changed, 103 insertions(+), 34 deletions(-)\n create mode 100644 wrapper.h\n\ndiff --git a/apply.c b/apply.c\nindex e5e11b85793..373565a7baf 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -26,6 +26,7 @@\n #include \"rerere.h\"\n #include \"apply.h\"\n #include \"entry.h\"\n+#include \"wrapper.h\"\n \n struct gitdiff_data {\n \tstruct strbuf *root;\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 14347ecf9aa..37f82b3eb42 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -38,6 +38,7 @@\n #include \"packfile.h\"\n #include \"repository.h\"\n #include \"pretty.h\"\n+#include \"wrapper.h\"\n \n /**\n  * Returns the length of the first line of msg.\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 09188e554b3..31cc57e45ba 100644\n--- a/builtin/bisect.c\n+++ b/builtin/bisect.c\n@@ -11,6 +11,7 @@\n #include \"prompt.h\"\n #include \"quote.h\"\n #include \"revision.h\"\n+#include \"wrapper.h\"\n \n static GIT_PATH_FUNC(git_path_bisect_terms, \"BISECT_TERMS\")\n static GIT_PATH_FUNC(git_path_bisect_expected_rev, \"BISECT_EXPECTED_REV\")\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 56dbee97d20..98475ea5325 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -26,6 +26,7 @@\n #include \"worktree.h\"\n #include \"help.h\"\n #include \"commit-reach.h\"\n+#include \"wrapper.h\"\n \n static const char * const builtin_branch_usage[] = {\n \tN_(\"git branch [<options>] [-r | -a] [--merged] [--no-merged]\"),\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex b5dfad4e12a..160590e4ef6 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -8,7 +8,7 @@\n #include \"hook.h\"\n #include \"hook-list.h\"\n #include \"diagnose.h\"\n-\n+#include \"wrapper.h\"\n \n static void get_system_info(struct strbuf *sys_info)\n {\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 42e6b8d3481..1c1e006ff3f 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -9,6 +9,7 @@\n #include \"urlmatch.h\"\n #include \"quote.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n static const char *const builtin_config_usage[] = {\n \tN_(\"git config [<options>]\"),\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 25f2f71c216..af56a44923d 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 \"wrapper.h\"\n \n #ifndef NO_UNIX_SOCKETS\n \ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex ed06db12085..59465c39f1d 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -27,6 +27,7 @@\n #include \"object-store.h\"\n #include \"dir.h\"\n #include \"entry.h\"\n+#include \"wrapper.h\"\n \n static int trust_exit_code;\n \ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 7307c4657f2..3300b7f30f0 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -23,6 +23,7 @@\n #include \"commit-reach.h\"\n #include \"khash.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n #define PACK_ID_BITS 16\n #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 0f9855b680e..cc812416420 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -3,6 +3,7 @@\n #include \"fmt-merge-msg.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"wrapper.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\n \tN_(\"git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]\"),\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex ef063fc828c..2107e3d1f2c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -35,6 +35,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n #define FAILED_RUN \"failed to run %s\"\n \ndiff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c\nindex 491af9202dc..67457969986 100644\n--- a/builtin/get-tar-commit-id.c\n+++ b/builtin/get-tar-commit-id.c\n@@ -6,6 +6,7 @@\n #include \"tar.h\"\n #include \"builtin.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n static const char builtin_get_tar_commit_id_usage[] =\n \"git get-tar-commit-id\";\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex bae5b054039..2393897cb88 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -19,6 +19,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n+#include \"wrapper.h\"\n \n static const char index_pack_usage[] =\n \"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])\";\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 6f724f694f4..a5d4f5c8ece 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"parse-options.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n #ifndef DEFAULT_GIT_TEMPLATE_DIR\n #define DEFAULT_GIT_TEMPLATE_DIR \"/usr/share/git-core/templates\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 38243e55c5f..f4f4a220f30 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -49,6 +49,7 @@\n #include \"commit-reach.h\"\n #include \"wt-status.h\"\n #include \"commit-graph.h\"\n+#include \"wrapper.h\"\n \n #define DEFAULT_TWOHEAD (1<<0)\n #define DEFAULT_OCTOPUS (1<<1)\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 1ca800c7c50..8b55a088a7c 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -40,6 +40,7 @@\n #include \"shallow.h\"\n #include \"promisor-remote.h\"\n #include \"pack-mtimes.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Objects we are going to pack are collected in the `to_pack` structure.\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex a3f8be88882..d2f8f703d67 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -32,6 +32,7 @@\n #include \"rebase-interactive.h\"\n #include \"reset.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n static char const * const builtin_rebase_usage[] = {\n \tN_(\"git rebase [-i] [options] [--exec <cmd>] \"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex aec5ee930b2..ae49ea8c2ad 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -33,6 +33,7 @@\n #include \"commit-reach.h\"\n #include \"worktree.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n static const char * const receive_pack_usage[] = {\n \tN_(\"git receive-pack <git-dir>\"),\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 24c78755723..d4a03707b1a 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -6,6 +6,7 @@\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\n+#include \"wrapper.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex e9b105a5397..4cbb4039293 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n+#include \"wrapper.h\"\n \n static char *create_temp_file(struct object_id *oid)\n {\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex ed614ffddcb..1533b4ab43c 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -16,6 +16,7 @@\n #include \"submodule.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n #include \"quote.h\"\n \n #define BUILTIN_WORKTREE_ADD_USAGE \\\ndiff --git a/cache.h b/cache.h\nindex 705c41992bc..31c722533f9 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1085,10 +1085,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n #define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n-/* set default permissions by passing mode arguments to open(2) */\n-int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n-int git_mkstemp_mode(char *pattern, int mode);\n-\n /*\n  * NOTE NOTE NOTE!!\n  *\n@@ -1423,31 +1419,6 @@ static inline int batch_fsync_enabled(enum fsync_component component)\n \treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n }\n \n-ssize_t read_in_full(int fd, void *buf, size_t count);\n-ssize_t write_in_full(int fd, const void *buf, size_t count);\n-ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);\n-\n-static inline ssize_t write_str_in_full(int fd, const char *str)\n-{\n-\treturn write_in_full(fd, str, strlen(str));\n-}\n-\n-/**\n- * Open (and truncate) the file at path, write the contents of buf to it,\n- * and close it. Dies if any errors are encountered.\n- */\n-void write_file_buf(const char *path, const char *buf, size_t len);\n-\n-/**\n- * Like write_file_buf(), but format the contents into a buffer first.\n- * Additionally, write_file() will append a newline if one is not already\n- * present, making it convenient to write text files:\n- *\n- *   write_file(path, \"counter: %d\", ctr);\n- */\n-__attribute__((format (printf, 2, 3)))\n-void write_file(const char *path, const char *fmt, ...);\n-\n /* pager.c */\n void setup_pager(void);\n int pager_in_use(void);\n@@ -1571,7 +1542,4 @@ int versioncmp(const char *s1, const char *s2);\n  */\n int print_sha1_ellipsis(void);\n \n-/* Return 1 if the file is empty or does not exists, 0 otherwise. */\n-int is_empty_or_missing_file(const char *filename);\n-\n #endif /* CACHE_H */\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 8f21a0a0c20..5481736c76c 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -22,6 +22,7 @@\n #include \"json-writer.h\"\n #include \"trace2.h\"\n #include \"chunk-format.h\"\n+#include \"wrapper.h\"\n \n void git_test_write_commit_graph_or_die(void)\n {\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex cbcd03aea9b..d48899bf7b4 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n+#include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\n #define SECURITY_WIN32\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex afebe6b2496..ed2b30b38f7 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -6,6 +6,7 @@\n #include \"run-command.h\"\n #include \"string-list.h\"\n #include \"hashmap.h\"\n+#include \"wrapper.h\"\n \n #if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)\n \ndiff --git a/config.c b/config.c\nindex 6815919ec30..5b1a5d52052 100644\n--- a/config.c\n+++ b/config.c\n@@ -28,6 +28,7 @@\n #include \"replace-object.h\"\n #include \"refs.h\"\n #include \"worktree.h\"\n+#include \"wrapper.h\"\n \n struct config_source {\n \tstruct config_source *prev;\ndiff --git a/convert.c b/convert.c\nindex 2bd54244b55..da06e2f51cb 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -11,6 +11,7 @@\n #include \"sub-process.h\"\n #include \"utf8.h\"\n #include \"ll-merge.h\"\n+#include \"wrapper.h\"\n \n /*\n  * convert.c - convert a file when checking it out and checking it in.\ndiff --git a/copy.c b/copy.c\nindex 4de6a110f09..c3250f08221 100644\n--- a/copy.c\n+++ b/copy.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"wrapper.h\"\n \n int copy_fd(int ifd, int ofd)\n {\ndiff --git a/csum-file.c b/csum-file.c\nindex cce13c0f047..2d22f80d901 100644\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"progress.h\"\n #include \"csum-file.h\"\n+#include \"wrapper.h\"\n \n static void verify_buffer_or_die(struct hashfile *f,\n \t\t\t\t const void *buf,\ndiff --git a/daemon.c b/daemon.c\nindex bb795ca3ca9..e35604e194c 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -6,6 +6,7 @@\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n+#include \"wrapper.h\"\n \n #ifdef NO_INITGROUPS\n #define initgroups(x, y) (0) /* nothing */\ndiff --git a/diff.c b/diff.c\nindex 1b0be99c065..1b0b24c21c3 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -33,6 +33,7 @@\n #include \"promisor-remote.h\"\n #include \"dir.h\"\n #include \"strmap.h\"\n+#include \"wrapper.h\"\n \n #ifdef NO_FAST_WORKING_DIRECTORY\n #define FAST_WORKING_DIRECTORY 0\ndiff --git a/dir.c b/dir.c\nindex c72481c60ee..b57c770e68b 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -21,6 +21,7 @@\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n #include \"submodule-config.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Tells read_directory_recursive how a file or directory should be treated.\ndiff --git a/entry.c b/entry.c\nindex acb76a61aca..70212af260b 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -10,6 +10,7 @@\n #include \"fsmonitor.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"wrapper.h\"\n \n static void create_directories(const char *path, int path_len,\n \t\t\t       const struct checkout *state)\ndiff --git a/environment.c b/environment.c\nindex c69571f0b29..bf02f3cf487 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -23,6 +23,7 @@\n #include \"tmp-objdir.h\"\n #include \"chdir-notify.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 359dce6afed..c1190801405 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -30,6 +30,7 @@\n #include \"commit-graph.h\"\n #include \"sigchain.h\"\n #include \"mergesort.h\"\n+#include \"wrapper.h\"\n \n static int transfer_unpack_limit = -1;\n static int fetch_unpack_limit = -1;\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex f9c5b6c3f53..6644701fda0 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -10,6 +10,7 @@\n #include \"sigchain.h\"\n #include \"tempfile.h\"\n #include \"alias.h\"\n+#include \"wrapper.h\"\n \n static int git_gpg_config(const char *, const char *, void *);\n \ndiff --git a/http-backend.c b/http-backend.c\nindex 7e7c19e66b3..42e6c2596e9 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -16,6 +16,7 @@\n #include \"object-store.h\"\n #include \"protocol.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n static const char content_type[] = \"Content-Type\";\n static const char content_length[] = \"Content-Length\";\ndiff --git a/imap-send.c b/imap-send.c\nindex c65a27219c6..aa5b2f252d2 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n+#include \"wrapper.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\n typedef void *SSL;\n #endif\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 130d26501c6..8be38d3bd41 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -11,6 +11,7 @@\n #include \"run-command.h\"\n #include \"ll-merge.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n struct ll_merge_driver;\n \ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 0b0255ebc80..f918cea4c69 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -30,6 +30,7 @@\n #include \"tag.h\"\n #include \"tree-walk.h\"\n #include \"unpack-trees.h\"\n+#include \"wrapper.h\"\n #include \"xdiff-interface.h\"\n \n struct merge_options_internal {\ndiff --git a/notes-merge.c b/notes-merge.c\nindex c8d0020b1a2..ba2970f0702 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -15,6 +15,7 @@\n #include \"strbuf.h\"\n #include \"notes-utils.h\"\n #include \"commit-reach.h\"\n+#include \"wrapper.h\"\n \n struct notes_merge_pair {\n \tstruct object_id obj, base, local, remote;\ndiff --git a/object-file.c b/object-file.c\nindex bee41b30474..bdf68763a50 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -38,6 +38,7 @@\n #include \"promisor-remote.h\"\n #include \"submodule.h\"\n #include \"fsck.h\"\n+#include \"wrapper.h\"\n \n /* The maximum size for an object header. */\n #define MAX_HEADER_LEN 32\ndiff --git a/packfile.c b/packfile.c\nindex 3290fde15a1..8c117ccee27 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -20,6 +20,7 @@\n #include \"midx.h\"\n #include \"commit-graph.h\"\n #include \"promisor-remote.h\"\n+#include \"wrapper.h\"\n \n char *odb_pack_name(struct strbuf *buf,\n \t\t    const unsigned char *hash,\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 38c4dc665d5..50fd7fe31ef 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -12,6 +12,7 @@\n #include \"streaming.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n+#include \"wrapper.h\"\n \n struct pc_worker {\n \tstruct child_process cp;\ndiff --git a/pkt-line.c b/pkt-line.c\nindex c8b90b2242e..30469eb4d8d 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n+#include \"wrapper.h\"\n \n char packet_buffer[LARGE_PACKET_MAX];\n static const char *packet_trace_prefix = \"git\";\ndiff --git a/read-cache.c b/read-cache.c\nindex 63789ea5e21..9a8d5fe97ed 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -32,6 +32,7 @@\n #include \"csum-file.h\"\n #include \"promisor-remote.h\"\n #include \"hook.h\"\n+#include \"wrapper.h\"\n \n /* Mask for the name length in ce_flags in the on-disk index */\n \ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 649c94e69a6..7c885c35bfd 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -7,6 +7,7 @@\n #include \"commit-slab.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"wrapper.h\"\n \n static const char edit_todo_list_advice[] =\n N_(\"You can fix this with 'git rebase --edit-todo' \"\ndiff --git a/refs.c b/refs.c\nindex 8684f4610f5..385051752f1 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -24,6 +24,7 @@\n #include \"sigchain.h\"\n #include \"date.h\"\n #include \"commit.h\"\n+#include \"wrapper.h\"\n \n /*\n  * List of all available backends\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex de3628ff3f1..eb14d124e3f 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -13,7 +13,8 @@\n #include \"../object.h\"\n #include \"../dir.h\"\n #include \"../chdir-notify.h\"\n-#include \"worktree.h\"\n+#include \"../worktree.h\"\n+#include \"../wrapper.h\"\n \n /*\n  * This backend uses the following flags in `ref_update::flags` for\ndiff --git a/rerere.c b/rerere.c\nindex c3258e13902..b5ccbecdcd2 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -16,6 +16,7 @@\n #include \"object-store.h\"\n #include \"hash-lookup.h\"\n #include \"strmap.h\"\n+#include \"wrapper.h\"\n \n #define RESOLVED 0\n #define PUNTED 1\ndiff --git a/sequencer.c b/sequencer.c\nindex c61c1fc4d87..aa7983f5b45 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -41,6 +41,7 @@\n #include \"rebase-interactive.h\"\n #include \"reset.h\"\n #include \"branch.h\"\n+#include \"wrapper.h\"\n \n #define GIT_REFLOG_ACTION \"GIT_REFLOG_ACTION\"\n \ndiff --git a/server-info.c b/server-info.c\nindex 78643377057..ae96d784e53 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -10,6 +10,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"strbuf.h\"\n+#include \"wrapper.h\"\n \n struct update_info_ctx {\n \tFILE *cur_fp;\ndiff --git a/shallow.c b/shallow.c\nindex c5433a4fd30..7fcba5f6d06 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -17,6 +17,7 @@\n #include \"list-objects.h\"\n #include \"commit-reach.h\"\n #include \"shallow.h\"\n+#include \"wrapper.h\"\n \n void set_alternate_shallow_file(struct repository *r, const char *path, int override)\n {\ndiff --git a/strbuf.c b/strbuf.c\nindex 9633e37b62f..70a83e7980e 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -8,6 +8,7 @@\n #include \"string-list.h\"\n #include \"utf8.h\"\n #include \"date.h\"\n+#include \"wrapper.h\"\n \n int starts_with(const char *str, const char *prefix)\n {\ndiff --git a/streaming.c b/streaming.c\nindex 27841dc1d9e..6c69f595045 100644\n--- a/streaming.c\n+++ b/streaming.c\n@@ -7,6 +7,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"packfile.h\"\n+#include \"wrapper.h\"\n \n typedef int (*open_istream_fn)(struct git_istream *,\n \t\t\t       struct repository *,\ndiff --git a/t/helper/test-delta.c b/t/helper/test-delta.c\nindex b15481ea596..6609fcbc12e 100644\n--- a/t/helper/test-delta.c\n+++ b/t/helper/test-delta.c\n@@ -12,6 +12,7 @@\n #include \"git-compat-util.h\"\n #include \"delta.h\"\n #include \"cache.h\"\n+#include \"wrapper.h\"\n \n static const char usage_str[] =\n \t\"test-tool delta (-d|-p) <from_file> <data_file> <out_file>\";\ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex 54a4856c48c..c43fc976b82 100644\n--- a/t/helper/test-fsmonitor-client.c\n+++ b/t/helper/test-fsmonitor-client.c\n@@ -9,6 +9,7 @@\n #include \"fsmonitor-ipc.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n+#include \"wrapper.h\"\n \n #ifndef HAVE_FSMONITOR_DAEMON_BACKEND\n int cmd__fsmonitor_client(int argc, const char **argv)\ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex 23e9e27109f..84818363d5b 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 \"wrapper.h\"\n \n int cmd__read_cache(int argc, const char **argv)\n {\ndiff --git a/tag.c b/tag.c\nindex 18b718cca66..3408bb9433f 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -8,6 +8,7 @@\n #include \"gpg-interface.h\"\n #include \"hex.h\"\n #include \"packfile.h\"\n+#include \"wrapper.h\"\n \n const char *tag_type = \"tag\";\n \ndiff --git a/tempfile.c b/tempfile.c\nindex e27048f970b..cdd2cab3bad 100644\n--- a/tempfile.c\n+++ b/tempfile.c\n@@ -45,6 +45,7 @@\n #include \"cache.h\"\n #include \"tempfile.h\"\n #include \"sigchain.h\"\n+#include \"wrapper.h\"\n \n static VOLATILE_LIST_HEAD(tempfile_list);\n \ndiff --git a/trace.c b/trace.c\nindex 2b41c683fc8..de004f62988 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -24,6 +24,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"quote.h\"\n+#include \"wrapper.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\n struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 105bb801c21..09048eab484 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -16,6 +16,7 @@\n #include \"refspec.h\"\n #include \"transport-internal.h\"\n #include \"protocol.h\"\n+#include \"wrapper.h\"\n \n static int debug;\n \ndiff --git a/transport.c b/transport.c\nindex 80059124c0a..c6179b801e8 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -26,6 +26,7 @@\n #include \"object-store.h\"\n #include \"color.h\"\n #include \"bundle-uri.h\"\n+#include \"wrapper.h\"\n \n static int transport_use_color = -1;\n static char transport_colors[][COLOR_MAXLEN] = {\ndiff --git a/usage.c b/usage.c\nindex 40a1c5a4339..b53c99dbe5b 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"wrapper.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n {\ndiff --git a/worktree.c b/worktree.c\nindex b7bc4c7bb7a..fe4345012c4 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -9,6 +9,7 @@\n #include \"dir.h\"\n #include \"wt-status.h\"\n #include \"config.h\"\n+#include \"wrapper.h\"\n \n void free_worktrees(struct worktree **worktrees)\n {\ndiff --git a/wrapper.c b/wrapper.c\nindex df1fa6286d0..ee837575902 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 \"wrapper.h\"\n \n static intmax_t count_fsync_writeout_only;\n static intmax_t count_fsync_hardware_flush;\ndiff --git a/wrapper.h b/wrapper.h\nnew file mode 100644\nindex 00000000000..f0c7d0616d6\n--- /dev/null\n+++ b/wrapper.h\n@@ -0,0 +1,36 @@\n+#ifndef WRAPPER_H\n+#define WRAPPER_H\n+\n+/* set default permissions by passing mode arguments to open(2) */\n+int git_mkstemps_mode(char *pattern, int suffix_len, int mode);\n+int git_mkstemp_mode(char *pattern, int mode);\n+\n+ssize_t read_in_full(int fd, void *buf, size_t count);\n+ssize_t write_in_full(int fd, const void *buf, size_t count);\n+ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);\n+\n+static inline ssize_t write_str_in_full(int fd, const char *str)\n+{\n+\treturn write_in_full(fd, str, strlen(str));\n+}\n+\n+/**\n+ * Open (and truncate) the file at path, write the contents of buf to it,\n+ * and close it. Dies if any errors are encountered.\n+ */\n+void write_file_buf(const char *path, const char *buf, size_t len);\n+\n+/**\n+ * Like write_file_buf(), but format the contents into a buffer first.\n+ * Additionally, write_file() will append a newline if one is not already\n+ * present, making it convenient to write text files:\n+ *\n+ *   write_file(path, \"counter: %d\", ctr);\n+ */\n+__attribute__((format (printf, 2, 3)))\n+void write_file(const char *path, const char *fmt, ...);\n+\n+/* Return 1 if the file is empty or does not exists, 0 otherwise. */\n+int is_empty_or_missing_file(const char *filename);\n+\n+#endif /* WRAPPER_H */\ndiff --git a/write-or-die.c b/write-or-die.c\nindex aaa0318e824..a7afc303db2 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"run-command.h\"\n+#include \"wrapper.h\"\n \n /*\n  * Some cases use stdio, but want to flush after the write\n-- \ngitgitgadget\n\n"},{"id":"473833","messageId":"5ef1a4f1d6c73481bbbed7ed1ccb4dc7c42ed955.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 11/16] environment.h: move declarations for environment.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:03Z","receivedAt":"2023-03-21T06:26: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 apply.c                             |   1 +\n archive.c                           |   1 +\n attr.c                              |   1 +\n bisect.c                            |   1 +\n branch.c                            |   1 +\n builtin/am.c                        |   1 +\n builtin/bisect.c                    |   1 +\n builtin/blame.c                     |   1 +\n builtin/cat-file.c                  |   1 +\n builtin/check-attr.c                |   1 +\n builtin/checkout.c                  |   1 +\n builtin/clone.c                     |   1 +\n builtin/commit-graph.c              |   1 +\n builtin/config.c                    |   1 +\n builtin/count-objects.c             |   1 +\n builtin/describe.c                  |   1 +\n builtin/difftool.c                  |   1 +\n builtin/fast-import.c               |   1 +\n builtin/fetch.c                     |   1 +\n builtin/fsmonitor--daemon.c         |   1 +\n builtin/gc.c                        |   1 +\n builtin/index-pack.c                |   1 +\n builtin/init-db.c                   |   1 +\n builtin/log.c                       |   1 +\n builtin/mailinfo.c                  |   1 +\n builtin/multi-pack-index.c          |   1 +\n builtin/mv.c                        |   1 +\n builtin/name-rev.c                  |   1 +\n builtin/pack-objects.c              |   1 +\n builtin/prune.c                     |   1 +\n builtin/push.c                      |   1 +\n builtin/rebase.c                    |   1 +\n builtin/receive-pack.c              |   1 +\n builtin/repack.c                    |   1 +\n builtin/replace.c                   |   1 +\n builtin/reset.c                     |   1 +\n builtin/rev-list.c                  |   1 +\n builtin/rev-parse.c                 |   1 +\n builtin/shortlog.c                  |   1 +\n builtin/show-branch.c               |   1 +\n builtin/sparse-checkout.c           |   1 +\n builtin/stash.c                     |   1 +\n builtin/submodule--helper.c         |   1 +\n builtin/unpack-objects.c            |   1 +\n builtin/update-index.c              |   1 +\n builtin/worktree.c                  |   1 +\n builtin/write-tree.c                |   1 +\n bulk-checkin.c                      |   1 +\n bundle-uri.c                        |   1 +\n bundle.c                            |   1 +\n cache-tree.c                        |   1 +\n cache.h                             | 207 ---------------------------\n combine-diff.c                      |   1 +\n compat/mingw.c                      |   1 +\n compat/precompose_utf8.c            |   1 +\n connect.c                           |   1 +\n daemon.c                            |   1 +\n diff.c                              |   1 +\n dir.c                               |   1 +\n editor.c                            |   1 +\n entry.c                             |   1 +\n environment.h                       | 213 ++++++++++++++++++++++++++++\n exec-cmd.c                          |   1 +\n fetch-pack.c                        |   1 +\n fsmonitor.c                         |   1 +\n gettext.c                           |   1 +\n git.c                               |   1 +\n http-backend.c                      |   1 +\n http-push.c                         |   1 +\n log-tree.c                          |   1 +\n ls-refs.c                           |   1 +\n mailmap.c                           |   1 +\n merge-ort.c                         |   1 +\n merge-recursive.c                   |   1 +\n name-hash.c                         |   1 +\n notes-utils.c                       |   1 +\n notes.c                             |   1 +\n object-file.c                       |   1 +\n object-name.c                       |   1 +\n pack-bitmap-write.c                 |   1 +\n pack-check.c                        |   1 +\n pack-write.c                        |   1 +\n packfile.c                          |   1 +\n parse-options-cb.c                  |   1 +\n path.c                              |   1 +\n pathspec.c                          |   1 +\n preload-index.c                     |   1 +\n pretty.c                            |   1 +\n prompt.c                            |   1 +\n protocol.c                          |   1 +\n prune-packed.c                      |   1 +\n range-diff.c                        |   1 +\n read-cache.c                        |   1 +\n rebase-interactive.c                |   1 +\n ref-filter.c                        |   1 +\n refs.c                              |   1 +\n refs/files-backend.c                |   1 +\n remote-curl.c                       |   1 +\n remote.c                            |   1 +\n revision.c                          |   1 +\n run-command.c                       |   1 +\n server-info.c                       |   1 +\n setup.c                             |   1 +\n sparse-index.c                      |   1 +\n streaming.c                         |   1 +\n submodule-config.c                  |   1 +\n submodule.c                         |   1 +\n t/helper/test-fast-rebase.c         |   1 +\n t/helper/test-lazy-init-name-hash.c |   1 +\n t/helper/test-path-utils.c          |   1 +\n t/helper/test-repository.c          |   1 +\n tag.c                               |   1 +\n tmp-objdir.c                        |   1 +\n trace.c                             |   1 +\n transport-helper.c                  |   1 +\n transport.c                         |   1 +\n unpack-trees.c                      |   1 +\n upload-pack.c                       |   1 +\n worktree.c                          |   1 +\n 119 files changed, 330 insertions(+), 207 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 373565a7baf..a7c0bccb15c 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -16,6 +16,7 @@\n #include \"delta.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/archive.c b/archive.c\nindex c3c45a5ebe9..7aeaaf368f4 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/attr.c b/attr.c\nindex 48e2d646187..62127196cb1 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\ndiff --git a/bisect.c b/bisect.c\nindex 5a3a8182d83..8a4be05dc52 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/branch.c b/branch.c\nindex 66d32c68564..3865bdbc87c 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"branch.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 37f82b3eb42..192968ac300 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex 31cc57e45ba..d8e92dfa16a 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 21f6b523a6d..9ec82edcbde 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -10,6 +10,7 @@\n #include \"config.h\"\n #include \"color.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 9f1bf8f0e96..365d9234bdb 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"ident.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex ad27255e2cb..5870c4683ab 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"attr.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 47d4c369a16..5541e76c337 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"hook.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex b94324ea02c..15dc15408ed 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -12,6 +12,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex 311e0106810..90114269761 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 1c1e006ff3f..cf994a216c0 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -3,6 +3,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 48edc86c240..f3d8f1bcbb0 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex fcacdf8a693..27c6670e934 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 59465c39f1d..3613de6389f 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -17,6 +17,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 3300b7f30f0..068843a5d21 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 990f81f6d1a..4d883da02e6 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex 4efb1417344..a280d8bb14f 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 2107e3d1f2c..525c5de5b27 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 \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 2393897cb88..fdce8f88724 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"delta.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex a5d4f5c8ece..2ebc9023f56 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex b7333b34cce..1b92dee196e 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex e14f7c0abce..a032a1c3881 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 579bc2cac0c..1b5083f8b26 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 0a49bf21b0f..c2dd42efbf2 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 6977a5f580b..66f82ef66f4 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 8b55a088a7c..9829b952c2b 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex ff62a0adb8f..5a381fcdf9a 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 2d76fa68376..fa550b8f80a 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex d2f8f703d67..9f3135116ed 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -7,6 +7,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex ae49ea8c2ad..3745c0b95cd 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 771ca01527d..ccbd5f55562 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex cf85e590d9f..dc0331defc2 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 4335c1a6e1b..b5dfce1159e 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -10,6 +10,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex f2f6a0d3e67..b202647f281 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex a4c0878bc91..bba49d56b9f 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -9,6 +9,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex d8c4379ea16..31f81c25ea2 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"revision.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 8d569629726..c4aa0e62f26 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pretty.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 3976d8e86b8..f6a120c7c45 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 52fa892f7eb..94f81d75d03 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex ff1fd8c87ab..2bf2a1a8be5 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex f7c4b531076..c65ae3b2078 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex ef78b2d28e1..4642afaeb77 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 1533b4ab43c..d9345efdb2b 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -4,6 +4,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 7eec4e3cbd1..6085f64d100 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex 778ca1e0f4f..eb6d7a2805b 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 2cc7d159bd6..1ff1cf51dad 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"refs.h\"\ndiff --git a/bundle.c b/bundle.c\nindex f5b3643b17e..efeaf6f7151 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"lockfile.h\"\n #include \"bundle.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 6f899beb041..231c3eb2ff6 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"tree.h\"\ndiff --git a/cache.h b/cache.h\nindex 31c722533f9..720c88f9fd6 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -452,98 +452,10 @@ static inline enum object_type object_type(unsigned int mode)\n \t\tOBJ_BLOB;\n }\n \n-/* Double-check local_repo_env below if you add to this list. */\n-#define GIT_DIR_ENVIRONMENT \"GIT_DIR\"\n-#define GIT_COMMON_DIR_ENVIRONMENT \"GIT_COMMON_DIR\"\n-#define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n-#define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n-#define GIT_PREFIX_ENVIRONMENT \"GIT_PREFIX\"\n-#define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n-#define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n-#define INDEX_ENVIRONMENT \"GIT_INDEX_FILE\"\n-#define GRAFT_ENVIRONMENT \"GIT_GRAFT_FILE\"\n-#define GIT_SHALLOW_FILE_ENVIRONMENT \"GIT_SHALLOW_FILE\"\n-#define TEMPLATE_DIR_ENVIRONMENT \"GIT_TEMPLATE_DIR\"\n-#define CONFIG_ENVIRONMENT \"GIT_CONFIG\"\n-#define CONFIG_DATA_ENVIRONMENT \"GIT_CONFIG_PARAMETERS\"\n-#define CONFIG_COUNT_ENVIRONMENT \"GIT_CONFIG_COUNT\"\n-#define EXEC_PATH_ENVIRONMENT \"GIT_EXEC_PATH\"\n-#define CEILING_DIRECTORIES_ENVIRONMENT \"GIT_CEILING_DIRECTORIES\"\n-#define NO_REPLACE_OBJECTS_ENVIRONMENT \"GIT_NO_REPLACE_OBJECTS\"\n-#define GIT_REPLACE_REF_BASE_ENVIRONMENT \"GIT_REPLACE_REF_BASE\"\n-#define GITATTRIBUTES_FILE \".gitattributes\"\n-#define INFOATTRIBUTES_FILE \"info/attributes\"\n-#define ATTRIBUTE_MACRO_PREFIX \"[attr]\"\n-#define GITMODULES_FILE \".gitmodules\"\n-#define GITMODULES_INDEX \":.gitmodules\"\n-#define GITMODULES_HEAD \"HEAD:.gitmodules\"\n-#define GIT_NOTES_REF_ENVIRONMENT \"GIT_NOTES_REF\"\n-#define GIT_NOTES_DEFAULT_REF \"refs/notes/commits\"\n-#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT \"GIT_NOTES_DISPLAY_REF\"\n-#define GIT_NOTES_REWRITE_REF_ENVIRONMENT \"GIT_NOTES_REWRITE_REF\"\n-#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT \"GIT_NOTES_REWRITE_MODE\"\n-#define GIT_LITERAL_PATHSPECS_ENVIRONMENT \"GIT_LITERAL_PATHSPECS\"\n-#define GIT_GLOB_PATHSPECS_ENVIRONMENT \"GIT_GLOB_PATHSPECS\"\n-#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT \"GIT_NOGLOB_PATHSPECS\"\n-#define GIT_ICASE_PATHSPECS_ENVIRONMENT \"GIT_ICASE_PATHSPECS\"\n-#define GIT_QUARANTINE_ENVIRONMENT \"GIT_QUARANTINE_PATH\"\n-#define GIT_OPTIONAL_LOCKS_ENVIRONMENT \"GIT_OPTIONAL_LOCKS\"\n-#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT \"GIT_TEXTDOMAINDIR\"\n-\n-/*\n- * Environment variable used in handshaking the wire protocol.\n- * Contains a colon ':' separated list of keys with optional values\n- * 'key[=value]'.  Presence of unknown keys and values must be\n- * ignored.\n- */\n-#define GIT_PROTOCOL_ENVIRONMENT \"GIT_PROTOCOL\"\n-/* HTTP header used to handshake the wire protocol */\n-#define GIT_PROTOCOL_HEADER \"Git-Protocol\"\n-\n-/*\n- * This environment variable is expected to contain a boolean indicating\n- * whether we should or should not treat:\n- *\n- *   GIT_DIR=foo.git git ...\n- *\n- * as if GIT_WORK_TREE=. was given. It's not expected that users will make use\n- * of this, but we use it internally to communicate to sub-processes that we\n- * are in a bare repo. If not set, defaults to true.\n- */\n-#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT \"GIT_IMPLICIT_WORK_TREE\"\n-\n-/*\n- * Repository-local GIT_* environment variables; these will be cleared\n- * when git spawns a sub-process that runs inside another repository.\n- * The array is NULL-terminated, which makes it easy to pass in the \"env\"\n- * parameter of a run-command invocation, or to do a simple walk.\n- */\n-extern const char * const local_repo_env[];\n-\n-void setup_git_env(const char *git_dir);\n-\n-/*\n- * Returns true iff we have a configured git repository (either via\n- * setup_git_directory, or in the environment via $GIT_DIR).\n- */\n-int have_git_dir(void);\n-\n-extern int is_bare_repository_cfg;\n-int is_bare_repository(void);\n int is_inside_git_dir(void);\n-extern char *git_work_tree_cfg;\n int is_inside_work_tree(void);\n-const char *get_git_dir(void);\n-const char *get_git_common_dir(void);\n-const char *get_object_directory(void);\n-char *get_index_file(void);\n-char *get_graft_file(struct repository *r);\n-void set_git_dir(const char *path, int make_realpath);\n int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n int get_common_dir(struct strbuf *sb, const char *gitdir);\n-const char *get_git_namespace(void);\n-const char *strip_namespace(const char *namespaced_ref);\n-const char *get_git_work_tree(void);\n \n /*\n  * Return true if the given path is a git directory; note that this _just_\n@@ -578,10 +490,6 @@ const char *read_gitfile_gently(const char *path, int *return_error_code);\n const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n #define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n \n-void set_git_work_tree(const char *tree);\n-\n-#define ALTERNATE_DB_ENVIRONMENT \"GIT_ALTERNATE_OBJECT_DIRECTORIES\"\n-\n void setup_work_tree(void);\n /*\n  * Find the commondir and gitdir of the repository that contains the current\n@@ -840,39 +748,7 @@ void set_alternate_index_output(const char *);\n extern int verify_index_checksum;\n extern int verify_ce_order;\n \n-/* Environment bits from configuration mechanism */\n-extern int trust_executable_bit;\n-extern int trust_ctime;\n-extern int check_stat;\n extern int quote_path_fully;\n-extern int has_symlinks;\n-extern int minimum_abbrev, default_abbrev;\n-extern int ignore_case;\n-extern int assume_unchanged;\n-extern int prefer_symlink_refs;\n-extern int warn_ambiguous_refs;\n-extern int warn_on_object_refname_ambiguity;\n-extern char *apply_default_whitespace;\n-extern char *apply_default_ignorewhitespace;\n-extern const char *git_attributes_file;\n-extern const char *git_hooks_path;\n-extern int zlib_compression_level;\n-extern int pack_compression_level;\n-extern size_t packed_git_window_size;\n-extern size_t packed_git_limit;\n-extern size_t delta_base_cache_limit;\n-extern unsigned long big_file_threshold;\n-extern unsigned long pack_size_limit_cfg;\n-\n-/*\n- * Accessors for the core.sharedrepository config which lazy-load the value\n- * from the config (if not already set). The \"reset\" function can be\n- * used to unset \"set\" or cached value, meaning that the value will be loaded\n- * fresh from the config file on the next call to get_shared_repository().\n- */\n-void set_shared_repository(int value);\n-int get_shared_repository(void);\n-void reset_shared_repository(void);\n \n /*\n  * These values are used to help identify parts of a repository to fsync.\n@@ -930,57 +806,6 @@ enum fsync_method {\n };\n \n extern enum fsync_method fsync_method;\n-extern int core_preload_index;\n-extern int precomposed_unicode;\n-extern int protect_hfs;\n-extern int protect_ntfs;\n-\n-extern int core_apply_sparse_checkout;\n-extern int core_sparse_checkout_cone;\n-extern int sparse_expect_files_outside_of_patterns;\n-\n-/*\n- * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).\n- */\n-int use_optional_locks(void);\n-\n-enum log_refs_config {\n-\tLOG_REFS_UNSET = -1,\n-\tLOG_REFS_NONE = 0,\n-\tLOG_REFS_NORMAL,\n-\tLOG_REFS_ALWAYS\n-};\n-extern enum log_refs_config log_all_ref_updates;\n-\n-enum rebase_setup_type {\n-\tAUTOREBASE_NEVER = 0,\n-\tAUTOREBASE_LOCAL,\n-\tAUTOREBASE_REMOTE,\n-\tAUTOREBASE_ALWAYS\n-};\n-\n-enum push_default_type {\n-\tPUSH_DEFAULT_NOTHING = 0,\n-\tPUSH_DEFAULT_MATCHING,\n-\tPUSH_DEFAULT_SIMPLE,\n-\tPUSH_DEFAULT_UPSTREAM,\n-\tPUSH_DEFAULT_CURRENT,\n-\tPUSH_DEFAULT_UNSPECIFIED\n-};\n-\n-extern enum rebase_setup_type autorebase;\n-extern enum push_default_type push_default;\n-\n-enum object_creation_mode {\n-\tOBJECT_CREATION_USES_HARDLINKS = 0,\n-\tOBJECT_CREATION_USES_RENAMES = 1\n-};\n-\n-extern enum object_creation_mode object_creation_mode;\n-\n-extern char *notes_ref_name;\n-\n-extern int grafts_replace_parents;\n \n /*\n  * GIT_REPO_VERSION is the version we write by default. The\n@@ -989,8 +814,6 @@ extern int grafts_replace_parents;\n  */\n #define GIT_REPO_VERSION 0\n #define GIT_REPO_VERSION_READ 1\n-extern int repository_format_precious_objects;\n-extern int repository_format_worktree_config;\n \n /*\n  * You _have_ to initialize a `struct repository_format` using\n@@ -1362,21 +1185,6 @@ struct pack_entry {\n \tstruct packed_git *p;\n };\n \n-/*\n- * Create a temporary file rooted in the object database directory, or\n- * die on failure. The filename is taken from \"pattern\", which should have the\n- * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n- * \"template\" buffer. Returns the open descriptor.\n- */\n-int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n-\n-/*\n- * Create a pack .keep file named \"name\" (which should generally be the output\n- * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on\n- * error.\n- */\n-int odb_pack_keep(const char *name);\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.\n@@ -1388,11 +1196,6 @@ extern int fetch_if_missing;\n /* Dumb servers support */\n int update_server_info(int);\n \n-const char *get_log_output_encoding(void);\n-const char *get_commit_output_encoding(void);\n-\n-extern const char *git_commit_encoding;\n-extern const char *git_log_output_encoding;\n extern const char *git_mailmap_file;\n extern const char *git_mailmap_blob;\n \n@@ -1429,10 +1232,6 @@ int decimal_width(uintmax_t);\n int check_pager_config(const char *cmd);\n void prepare_pager_args(struct child_process *, const char *pager);\n \n-extern const char *editor_program;\n-extern const char *askpass_program;\n-extern const char *excludes_file;\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@@ -1536,10 +1335,4 @@ void stat_validity_update(struct stat_validity *sv, int fd);\n \n int versioncmp(const char *s1, const char *s2);\n \n-/*\n- * Should we print an ellipsis after an abbreviated SHA-1 value\n- * when doing diff-raw output or indicating a detached HEAD?\n- */\n-int print_sha1_ellipsis(void);\n-\n #endif /* CACHE_H */\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 91051dc3258..3758e47c4f4 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -4,6 +4,7 @@\n #include \"blob.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"quote.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex d48899bf7b4..94c5a1daa40 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"../alloc.h\"\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n+#include \"../environment.h\"\n #include \"../wrapper.h\"\n #include \"dir.h\"\n #include \"gettext.h\"\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 56d36cdf22a..8a9881db077 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\ndiff --git a/connect.c b/connect.c\nindex f3b159bf441..737dd906f72 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\ndiff --git a/daemon.c b/daemon.c\nindex e35604e194c..b56a8f9717d 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/diff.c b/diff.c\nindex 1b0b24c21c3..dcf1a940942 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -5,6 +5,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\ndiff --git a/dir.c b/dir.c\nindex b57c770e68b..06f8aa3c01b 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -10,6 +10,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\ndiff --git a/editor.c b/editor.c\nindex 2d3e6be64e4..d632d790660 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\ndiff --git a/entry.c b/entry.c\nindex 70212af260b..750c1f6b2f4 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -2,6 +2,7 @@\n #include \"blob.h\"\n #include \"object-store.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\ndiff --git a/environment.h b/environment.h\nindex a26931556af..a63f0c6a24f 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -3,6 +3,8 @@\n \n #include \"strvec.h\"\n \n+struct repository;\n+\n /*\n  * The character that begins a commented line in user-editable file\n  * that is subject to stripspace.\n@@ -16,4 +18,215 @@ extern int auto_comment_line_char;\n  */\n const char *getenv_safe(struct strvec *argv, const char *name);\n \n+/* Double-check local_repo_env below if you add to this list. */\n+#define GIT_DIR_ENVIRONMENT \"GIT_DIR\"\n+#define GIT_COMMON_DIR_ENVIRONMENT \"GIT_COMMON_DIR\"\n+#define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n+#define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n+#define GIT_PREFIX_ENVIRONMENT \"GIT_PREFIX\"\n+#define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n+#define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n+#define INDEX_ENVIRONMENT \"GIT_INDEX_FILE\"\n+#define GRAFT_ENVIRONMENT \"GIT_GRAFT_FILE\"\n+#define GIT_SHALLOW_FILE_ENVIRONMENT \"GIT_SHALLOW_FILE\"\n+#define TEMPLATE_DIR_ENVIRONMENT \"GIT_TEMPLATE_DIR\"\n+#define CONFIG_ENVIRONMENT \"GIT_CONFIG\"\n+#define CONFIG_DATA_ENVIRONMENT \"GIT_CONFIG_PARAMETERS\"\n+#define CONFIG_COUNT_ENVIRONMENT \"GIT_CONFIG_COUNT\"\n+#define EXEC_PATH_ENVIRONMENT \"GIT_EXEC_PATH\"\n+#define CEILING_DIRECTORIES_ENVIRONMENT \"GIT_CEILING_DIRECTORIES\"\n+#define NO_REPLACE_OBJECTS_ENVIRONMENT \"GIT_NO_REPLACE_OBJECTS\"\n+#define GIT_REPLACE_REF_BASE_ENVIRONMENT \"GIT_REPLACE_REF_BASE\"\n+#define GITATTRIBUTES_FILE \".gitattributes\"\n+#define INFOATTRIBUTES_FILE \"info/attributes\"\n+#define ATTRIBUTE_MACRO_PREFIX \"[attr]\"\n+#define GITMODULES_FILE \".gitmodules\"\n+#define GITMODULES_INDEX \":.gitmodules\"\n+#define GITMODULES_HEAD \"HEAD:.gitmodules\"\n+#define GIT_NOTES_REF_ENVIRONMENT \"GIT_NOTES_REF\"\n+#define GIT_NOTES_DEFAULT_REF \"refs/notes/commits\"\n+#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT \"GIT_NOTES_DISPLAY_REF\"\n+#define GIT_NOTES_REWRITE_REF_ENVIRONMENT \"GIT_NOTES_REWRITE_REF\"\n+#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT \"GIT_NOTES_REWRITE_MODE\"\n+#define GIT_LITERAL_PATHSPECS_ENVIRONMENT \"GIT_LITERAL_PATHSPECS\"\n+#define GIT_GLOB_PATHSPECS_ENVIRONMENT \"GIT_GLOB_PATHSPECS\"\n+#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT \"GIT_NOGLOB_PATHSPECS\"\n+#define GIT_ICASE_PATHSPECS_ENVIRONMENT \"GIT_ICASE_PATHSPECS\"\n+#define GIT_QUARANTINE_ENVIRONMENT \"GIT_QUARANTINE_PATH\"\n+#define GIT_OPTIONAL_LOCKS_ENVIRONMENT \"GIT_OPTIONAL_LOCKS\"\n+#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT \"GIT_TEXTDOMAINDIR\"\n+\n+/*\n+ * Environment variable used in handshaking the wire protocol.\n+ * Contains a colon ':' separated list of keys with optional values\n+ * 'key[=value]'.  Presence of unknown keys and values must be\n+ * ignored.\n+ */\n+#define GIT_PROTOCOL_ENVIRONMENT \"GIT_PROTOCOL\"\n+/* HTTP header used to handshake the wire protocol */\n+#define GIT_PROTOCOL_HEADER \"Git-Protocol\"\n+\n+/*\n+ * This environment variable is expected to contain a boolean indicating\n+ * whether we should or should not treat:\n+ *\n+ *   GIT_DIR=foo.git git ...\n+ *\n+ * as if GIT_WORK_TREE=. was given. It's not expected that users will make use\n+ * of this, but we use it internally to communicate to sub-processes that we\n+ * are in a bare repo. If not set, defaults to true.\n+ */\n+#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT \"GIT_IMPLICIT_WORK_TREE\"\n+\n+/*\n+ * Repository-local GIT_* environment variables; these will be cleared\n+ * when git spawns a sub-process that runs inside another repository.\n+ * The array is NULL-terminated, which makes it easy to pass in the \"env\"\n+ * parameter of a run-command invocation, or to do a simple walk.\n+ */\n+extern const char * const local_repo_env[];\n+\n+void setup_git_env(const char *git_dir);\n+\n+/*\n+ * Returns true iff we have a configured git repository (either via\n+ * setup_git_directory, or in the environment via $GIT_DIR).\n+ */\n+int have_git_dir(void);\n+\n+extern int is_bare_repository_cfg;\n+int is_bare_repository(void);\n+extern char *git_work_tree_cfg;\n+const char *get_git_dir(void);\n+const char *get_git_common_dir(void);\n+const char *get_object_directory(void);\n+char *get_index_file(void);\n+char *get_graft_file(struct repository *r);\n+void set_git_dir(const char *path, int make_realpath);\n+const char *get_git_namespace(void);\n+const char *strip_namespace(const char *namespaced_ref);\n+const char *get_git_work_tree(void);\n+void set_git_work_tree(const char *tree);\n+\n+#define ALTERNATE_DB_ENVIRONMENT \"GIT_ALTERNATE_OBJECT_DIRECTORIES\"\n+\n+/* Environment bits from configuration mechanism */\n+extern int trust_executable_bit;\n+extern int trust_ctime;\n+extern int check_stat;\n+extern int has_symlinks;\n+extern int minimum_abbrev, default_abbrev;\n+extern int ignore_case;\n+extern int assume_unchanged;\n+extern int prefer_symlink_refs;\n+extern int warn_ambiguous_refs;\n+extern int warn_on_object_refname_ambiguity;\n+extern char *apply_default_whitespace;\n+extern char *apply_default_ignorewhitespace;\n+extern const char *git_attributes_file;\n+extern const char *git_hooks_path;\n+extern int zlib_compression_level;\n+extern int pack_compression_level;\n+extern size_t packed_git_window_size;\n+extern size_t packed_git_limit;\n+extern size_t delta_base_cache_limit;\n+extern unsigned long big_file_threshold;\n+extern unsigned long pack_size_limit_cfg;\n+\n+/*\n+ * Accessors for the core.sharedrepository config which lazy-load the value\n+ * from the config (if not already set). The \"reset\" function can be\n+ * used to unset \"set\" or cached value, meaning that the value will be loaded\n+ * fresh from the config file on the next call to get_shared_repository().\n+ */\n+void set_shared_repository(int value);\n+int get_shared_repository(void);\n+void reset_shared_repository(void);\n+\n+extern int core_preload_index;\n+extern int precomposed_unicode;\n+extern int protect_hfs;\n+extern int protect_ntfs;\n+\n+extern int core_apply_sparse_checkout;\n+extern int core_sparse_checkout_cone;\n+extern int sparse_expect_files_outside_of_patterns;\n+\n+/*\n+ * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).\n+ */\n+int use_optional_locks(void);\n+\n+enum log_refs_config {\n+\tLOG_REFS_UNSET = -1,\n+\tLOG_REFS_NONE = 0,\n+\tLOG_REFS_NORMAL,\n+\tLOG_REFS_ALWAYS\n+};\n+extern enum log_refs_config log_all_ref_updates;\n+\n+enum rebase_setup_type {\n+\tAUTOREBASE_NEVER = 0,\n+\tAUTOREBASE_LOCAL,\n+\tAUTOREBASE_REMOTE,\n+\tAUTOREBASE_ALWAYS\n+};\n+\n+enum push_default_type {\n+\tPUSH_DEFAULT_NOTHING = 0,\n+\tPUSH_DEFAULT_MATCHING,\n+\tPUSH_DEFAULT_SIMPLE,\n+\tPUSH_DEFAULT_UPSTREAM,\n+\tPUSH_DEFAULT_CURRENT,\n+\tPUSH_DEFAULT_UNSPECIFIED\n+};\n+\n+extern enum rebase_setup_type autorebase;\n+extern enum push_default_type push_default;\n+\n+enum object_creation_mode {\n+\tOBJECT_CREATION_USES_HARDLINKS = 0,\n+\tOBJECT_CREATION_USES_RENAMES = 1\n+};\n+\n+extern enum object_creation_mode object_creation_mode;\n+\n+extern char *notes_ref_name;\n+\n+extern int grafts_replace_parents;\n+\n+extern int repository_format_precious_objects;\n+extern int repository_format_worktree_config;\n+\n+/*\n+ * Create a temporary file rooted in the object database directory, or\n+ * die on failure. The filename is taken from \"pattern\", which should have the\n+ * usual \"XXXXXX\" trailer, and the resulting filename is written into the\n+ * \"template\" buffer. Returns the open descriptor.\n+ */\n+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);\n+\n+/*\n+ * Create a pack .keep file named \"name\" (which should generally be the output\n+ * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on\n+ * error.\n+ */\n+int odb_pack_keep(const char *name);\n+\n+const char *get_log_output_encoding(void);\n+const char *get_commit_output_encoding(void);\n+\n+extern const char *git_commit_encoding;\n+extern const char *git_log_output_encoding;\n+\n+extern const char *editor_program;\n+extern const char *askpass_program;\n+extern const char *excludes_file;\n+\n+/*\n+ * Should we print an ellipsis after an abbreviated SHA-1 value\n+ * when doing diff-raw output or indicating a detached HEAD?\n+ */\n+int print_sha1_ellipsis(void);\n+\n #endif\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 042d9247a5b..fae0d4b244a 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex c1190801405..c453a4168f9 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 \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/fsmonitor.c b/fsmonitor.c\nindex a5b9e75437b..c956a347a27 100644\n--- a/fsmonitor.c\n+++ b/fsmonitor.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/gettext.c b/gettext.c\nindex 3e7b3baabc6..85d3d3424eb 100644\n--- a/gettext.c\n+++ b/gettext.c\n@@ -4,6 +4,7 @@\n \n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"strbuf.h\"\ndiff --git a/git.c b/git.c\nindex 22ce4f14b65..b24c105e83f 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"help.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex 42e6c2596e9..042ccf12e8c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 88aa045ecba..40373bc4863 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex 3adcb576e4c..e2bf8d6df75 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -2,6 +2,7 @@\n #include \"commit-reach.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/ls-refs.c b/ls-refs.c\nindex ae38889bf04..12cbb40a198 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/mailmap.c b/mailmap.c\nindex da2589b0822..2c6e9b238dd 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"string-list.h\"\n #include \"mailmap.h\"\n #include \"object-store.h\"\ndiff --git a/merge-ort.c b/merge-ort.c\nindex a26cad5f910..f3d7c202f52 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -26,6 +26,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"entry.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex f918cea4c69..d5f37724911 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -17,6 +17,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"ll-merge.h\"\ndiff --git a/name-hash.c b/name-hash.c\nindex bb9eae55aca..2c2861efd1c 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2008 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex da08e2e8e5c..8797271faf1 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\ndiff --git a/notes.c b/notes.c\nindex a7187236e98..9288c1a0705 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"notes.h\"\n #include \"object-store.h\"\ndiff --git a/object-file.c b/object-file.c\nindex bdf68763a50..3da6cd68861 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -10,6 +10,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"string-list.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 2c927bbded3..3b0ce8ef05a 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 7dc7f0ba55e..63f16080c9b 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/pack-check.c b/pack-check.c\nindex 7ed594d6679..6974e40a958 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"pack.h\"\ndiff --git a/pack-write.c b/pack-write.c\nindex 87156f89d2b..f1714054951 100644\n--- a/pack-write.c\n+++ b/pack-write.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\ndiff --git a/packfile.c b/packfile.c\nindex 8c117ccee27..4b5b841d046 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"list.h\"\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex fbf4b010195..15d008c3daf 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\ndiff --git a/path.c b/path.c\nindex 3976c0d7ace..5d5a15c13d6 100644\n--- a/path.c\n+++ b/path.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 53763e272f5..5fb7b5f26c9 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\ndiff --git a/preload-index.c b/preload-index.c\nindex 4b45e1d6912..52544d004e7 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"fsmonitor.h\"\n #include \"gettext.h\"\n #include \"config.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 9d7922dcc60..2b6d0f52c9f 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"utf8.h\"\ndiff --git a/prompt.c b/prompt.c\nindex 50df17279d1..ba10813b313 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"prompt.h\"\ndiff --git a/protocol.c b/protocol.c\nindex c53f7df5be4..bdb32e1eeb6 100644\n--- a/protocol.c\n+++ b/protocol.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"protocol.h\"\n \n static enum protocol_version parse_protocol_version(const char *value)\ndiff --git a/prune-packed.c b/prune-packed.c\nindex cff5ad569c7..5a57072a7ac 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex 1bfc612e274..815fb24c9ce 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"range-diff.h\"\n #include \"string-list.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex 9a8d5fe97ed..34567c1d550 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -18,6 +18,7 @@\n #include \"tree.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"resolve-undo.h\"\n #include \"run-command.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7c885c35bfd..a83334dd564 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 9a830bedef0..1489fbfe4ae 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\ndiff --git a/refs.c b/refs.c\nindex 385051752f1..04520e5a6b8 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hashmap.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex eb14d124e3f..0c3138ede8f 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 \"../environment.h\"\n #include \"../gettext.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 943cd6fe6cd..eb382a1e35d 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\ndiff --git a/remote.c b/remote.c\nindex 2bae247a0a4..aeca3ff8136 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2,6 +2,7 @@\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\ndiff --git a/revision.c b/revision.c\nindex 7423e23327b..53fdeef0787 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/run-command.c b/run-command.c\nindex 2c8b4cd9bfc..614d48fa9a2 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"run-command.h\"\n+#include \"environment.h\"\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"sigchain.h\"\ndiff --git a/server-info.c b/server-info.c\nindex ae96d784e53..355b6e01a52 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/setup.c b/setup.c\nindex 8f385d9f29b..cfdc849a78c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/sparse-index.c b/sparse-index.c\nindex fdae9011b8e..886054729e5 100644\n--- a/sparse-index.c\n+++ b/sparse-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"sparse-index.h\"\ndiff --git a/streaming.c b/streaming.c\nindex 6c69f595045..024fd796b7d 100644\n--- a/streaming.c\n+++ b/streaming.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2011, Google Inc.\n  */\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"streaming.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 38663801aa4..28fdfddccfb 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 13ff333f68c..acf030b95e4 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -8,6 +8,7 @@\n #include \"dir.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 68bbc41b330..627a6bdc3d0 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex ab86c14c8ba..2b678a45793 100644\n--- a/t/helper/test-lazy-init-name-hash.c\n+++ b/t/helper/test-lazy-init-name-hash.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"parse-options.h\"\n \n static int single;\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex d3d00dc34fa..cc266e3ec09 100644\n--- a/t/helper/test-path-utils.c\n+++ b/t/helper/test-path-utils.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex 10a6dfc2160..c444775eb0f 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -3,6 +3,7 @@\n #include \"commit-graph.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"object.h\"\ndiff --git a/tag.c b/tag.c\nindex 3408bb9433f..39434231799 100644\n--- a/tag.c\n+++ b/tag.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"environment.h\"\n #include \"tag.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/tmp-objdir.c b/tmp-objdir.c\nindex fff15cb6b5c..5adad1925d1 100644\n--- a/tmp-objdir.c\n+++ b/tmp-objdir.c\n@@ -3,6 +3,7 @@\n #include \"abspath.h\"\n #include \"chdir-notify.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"sigchain.h\"\n #include \"string-list.h\"\n #include \"strbuf.h\"\ndiff --git a/trace.c b/trace.c\nindex de004f62988..9c85b71ec6a 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -23,6 +23,7 @@\n \n #include \"cache.h\"\n #include \"abspath.h\"\n+#include \"environment.h\"\n #include \"quote.h\"\n #include \"wrapper.h\"\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 09048eab484..3313bb74099 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -4,6 +4,7 @@\n #include \"run-command.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\ndiff --git a/transport.c b/transport.c\nindex c6179b801e8..4f06ccbee05 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n #include \"hook.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 84e0d2e8afe..0ff4bbc6b96 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -3,6 +3,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex eea9e6a6e8c..1155f795382 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\ndiff --git a/worktree.c b/worktree.c\nindex fe4345012c4..c2671b0cdf3 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n+#include \"environment.h\"\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n-- \ngitgitgadget\n\n"},{"id":"473834","messageId":"6e80396e861177802a095fe4cb8289646699ed77.1679379970.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 02/16] treewide: be explicit about dependence on gettext.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:25:54Z","receivedAt":"2023-03-21T06:26: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\nDozens of files made use of gettext functions, without explicitly\nincluding gettext.h.  This made it more difficult to find which files\ncould remove a dependence on cache.h.  Make C files explicitly include\ngettext.h if they are using it.\n\nHowever, while compat/fsmonitor/fsm-ipc-darwin.c should also gain an\ninclude of gettext.h, it was left out to avoid conflicting with an\nin-flight topic.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n add-interactive.c                        | 1 +\n add-patch.c                              | 1 +\n apply.c                                  | 1 +\n archive-tar.c                            | 1 +\n archive-zip.c                            | 1 +\n archive.c                                | 1 +\n attr.c                                   | 1 +\n bisect.c                                 | 1 +\n blame.c                                  | 1 +\n branch.c                                 | 1 +\n builtin/add.c                            | 1 +\n builtin/am.c                             | 1 +\n builtin/apply.c                          | 1 +\n builtin/archive.c                        | 1 +\n builtin/bisect.c                         | 1 +\n builtin/blame.c                          | 1 +\n builtin/branch.c                         | 1 +\n builtin/bugreport.c                      | 1 +\n builtin/bundle.c                         | 1 +\n builtin/cat-file.c                       | 1 +\n builtin/check-attr.c                     | 1 +\n builtin/check-ignore.c                   | 1 +\n builtin/check-mailmap.c                  | 1 +\n builtin/checkout--worker.c               | 1 +\n builtin/checkout-index.c                 | 1 +\n builtin/checkout.c                       | 1 +\n builtin/clean.c                          | 1 +\n builtin/clone.c                          | 1 +\n builtin/column.c                         | 1 +\n builtin/commit-graph.c                   | 1 +\n builtin/commit-tree.c                    | 1 +\n builtin/commit.c                         | 1 +\n builtin/config.c                         | 1 +\n builtin/count-objects.c                  | 1 +\n builtin/credential-cache--daemon.c       | 1 +\n builtin/credential-cache.c               | 1 +\n builtin/credential-store.c               | 1 +\n builtin/describe.c                       | 1 +\n builtin/diagnose.c                       | 1 +\n builtin/diff-tree.c                      | 1 +\n builtin/diff.c                           | 1 +\n builtin/difftool.c                       | 1 +\n builtin/fast-export.c                    | 1 +\n builtin/fast-import.c                    | 1 +\n builtin/fetch-pack.c                     | 1 +\n builtin/fetch.c                          | 1 +\n builtin/fmt-merge-msg.c                  | 1 +\n builtin/for-each-ref.c                   | 1 +\n builtin/for-each-repo.c                  | 1 +\n builtin/fsck.c                           | 1 +\n builtin/fsmonitor--daemon.c              | 1 +\n builtin/gc.c                             | 1 +\n builtin/grep.c                           | 1 +\n builtin/hash-object.c                    | 1 +\n builtin/help.c                           | 1 +\n builtin/hook.c                           | 1 +\n builtin/index-pack.c                     | 1 +\n builtin/init-db.c                        | 1 +\n builtin/interpret-trailers.c             | 1 +\n builtin/log.c                            | 1 +\n builtin/ls-files.c                       | 1 +\n builtin/ls-remote.c                      | 1 +\n builtin/ls-tree.c                        | 1 +\n builtin/mailinfo.c                       | 1 +\n builtin/mailsplit.c                      | 1 +\n builtin/merge-base.c                     | 1 +\n builtin/merge-file.c                     | 1 +\n builtin/merge-recursive.c                | 1 +\n builtin/merge-tree.c                     | 1 +\n builtin/merge.c                          | 1 +\n builtin/mktag.c                          | 1 +\n builtin/mktree.c                         | 1 +\n builtin/multi-pack-index.c               | 1 +\n builtin/mv.c                             | 1 +\n builtin/name-rev.c                       | 1 +\n builtin/notes.c                          | 1 +\n builtin/pack-objects.c                   | 1 +\n builtin/pack-redundant.c                 | 1 +\n builtin/pack-refs.c                      | 1 +\n builtin/patch-id.c                       | 1 +\n builtin/prune-packed.c                   | 1 +\n builtin/prune.c                          | 1 +\n builtin/pull.c                           | 1 +\n builtin/push.c                           | 1 +\n builtin/range-diff.c                     | 1 +\n builtin/read-tree.c                      | 1 +\n builtin/rebase.c                         | 1 +\n builtin/receive-pack.c                   | 1 +\n builtin/reflog.c                         | 1 +\n builtin/remote.c                         | 1 +\n builtin/repack.c                         | 1 +\n builtin/replace.c                        | 1 +\n builtin/rerere.c                         | 1 +\n builtin/reset.c                          | 1 +\n builtin/rev-list.c                       | 1 +\n builtin/rev-parse.c                      | 1 +\n builtin/revert.c                         | 1 +\n builtin/rm.c                             | 1 +\n builtin/shortlog.c                       | 1 +\n builtin/show-branch.c                    | 1 +\n builtin/show-index.c                     | 1 +\n builtin/show-ref.c                       | 1 +\n builtin/sparse-checkout.c                | 1 +\n builtin/stash.c                          | 1 +\n builtin/stripspace.c                     | 1 +\n builtin/submodule--helper.c              | 1 +\n builtin/symbolic-ref.c                   | 1 +\n builtin/tag.c                            | 1 +\n builtin/unpack-objects.c                 | 1 +\n builtin/update-index.c                   | 1 +\n builtin/update-ref.c                     | 1 +\n builtin/update-server-info.c             | 1 +\n builtin/upload-pack.c                    | 1 +\n builtin/verify-commit.c                  | 1 +\n builtin/verify-pack.c                    | 1 +\n builtin/verify-tag.c                     | 1 +\n builtin/worktree.c                       | 1 +\n builtin/write-tree.c                     | 1 +\n bulk-checkin.c                           | 1 +\n bundle-uri.c                             | 1 +\n bundle.c                                 | 1 +\n chunk-format.c                           | 1 +\n color.c                                  | 1 +\n commit-graph.c                           | 1 +\n commit.c                                 | 1 +\n common-main.c                            | 1 +\n compat/disk.h                            | 1 +\n compat/fsmonitor/fsm-health-win32.c      | 1 +\n compat/fsmonitor/fsm-listen-darwin.c     | 1 +\n compat/fsmonitor/fsm-listen-win32.c      | 1 +\n compat/fsmonitor/fsm-path-utils-darwin.c | 1 +\n compat/fsmonitor/fsm-path-utils-win32.c  | 1 +\n compat/mingw.c                           | 1 +\n compat/precompose_utf8.c                 | 1 +\n compat/simple-ipc/ipc-unix-socket.c      | 1 +\n compat/simple-ipc/ipc-win32.c            | 1 +\n compat/terminal.c                        | 1 +\n config.c                                 | 1 +\n connect.c                                | 1 +\n connected.c                              | 1 +\n convert.c                                | 1 +\n credential.c                             | 1 +\n date.c                                   | 1 +\n delta-islands.c                          | 1 +\n diagnose.c                               | 1 +\n diff-lib.c                               | 1 +\n diff-no-index.c                          | 1 +\n diff.c                                   | 1 +\n dir.c                                    | 1 +\n editor.c                                 | 1 +\n entry.c                                  | 1 +\n environment.c                            | 1 +\n exec-cmd.c                               | 1 +\n fetch-pack.c                             | 1 +\n fsmonitor-ipc.c                          | 1 +\n git.c                                    | 1 +\n gpg-interface.c                          | 1 +\n grep.c                                   | 1 +\n http-fetch.c                             | 1 +\n imap-send.c                              | 1 +\n list-objects-filter-options.h            | 1 +\n list-objects-filter.c                    | 1 +\n list-objects.c                           | 1 +\n lockfile.c                               | 1 +\n ls-refs.c                                | 1 +\n merge-ort-wrappers.c                     | 1 +\n merge-ort.c                              | 1 +\n merge-recursive.c                        | 1 +\n merge.c                                  | 1 +\n midx.c                                   | 1 +\n name-hash.c                              | 1 +\n notes-merge.c                            | 1 +\n notes-utils.c                            | 1 +\n object-file.c                            | 1 +\n object-name.c                            | 1 +\n object.c                                 | 1 +\n pack-bitmap-write.c                      | 1 +\n pack-bitmap.c                            | 1 +\n pack-mtimes.c                            | 1 +\n pack-revindex.c                          | 1 +\n pack-write.c                             | 1 +\n packfile.c                               | 1 +\n parallel-checkout.c                      | 1 +\n parse-options-cb.c                       | 1 +\n parse-options.c                          | 1 +\n parse-options.h                          | 2 ++\n path.c                                   | 1 +\n pathspec.c                               | 1 +\n pkt-line.c                               | 1 +\n preload-index.c                          | 1 +\n pretty.c                                 | 1 +\n promisor-remote.c                        | 1 +\n prune-packed.c                           | 1 +\n range-diff.c                             | 1 +\n reachable.c                              | 1 +\n read-cache.c                             | 1 +\n rebase-interactive.c                     | 1 +\n ref-filter.c                             | 1 +\n ref-filter.h                             | 1 +\n reflog.c                                 | 1 +\n refs.c                                   | 1 +\n refs/files-backend.c                     | 1 +\n refs/packed-backend.c                    | 1 +\n remote-curl.c                            | 1 +\n remote.c                                 | 1 +\n replace-object.c                         | 1 +\n rerere.c                                 | 1 +\n rerere.h                                 | 1 +\n reset.c                                  | 1 +\n revision.c                               | 1 +\n run-command.c                            | 1 +\n send-pack.c                              | 1 +\n sequencer.c                              | 1 +\n setup.c                                  | 1 +\n sideband.c                               | 1 +\n sparse-index.c                           | 1 +\n split-index.c                            | 1 +\n strbuf.c                                 | 1 +\n submodule-config.c                       | 1 +\n submodule.c                              | 1 +\n symlinks.c                               | 1 +\n t/helper/test-cache-tree.c               | 1 +\n t/helper/test-fast-rebase.c              | 1 +\n t/helper/test-reach.c                    | 1 +\n t/helper/test-serve-v2.c                 | 1 +\n trailer.c                                | 1 +\n transport-helper.c                       | 1 +\n tree-walk.c                              | 1 +\n unpack-trees.c                           | 1 +\n upload-pack.c                            | 1 +\n usage.c                                  | 2 +-\n walker.c                                 | 1 +\n worktree.c                               | 1 +\n wrapper.c                                | 1 +\n wt-status.c                              | 1 +\n 235 files changed, 236 insertions(+), 1 deletion(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex ae25ec50bce..b750543bd87 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -3,6 +3,7 @@\n #include \"color.h\"\n #include \"config.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"refs.h\"\ndiff --git a/add-patch.c b/add-patch.c\nindex e6c34b9c381..4c803a5f4db 100644\n--- a/add-patch.c\n+++ b/add-patch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"add-interactive.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\n #include \"strvec.h\"\ndiff --git a/apply.c b/apply.c\nindex 8776ab939ad..e0bdd43a68e 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -15,6 +15,7 @@\n #include \"delta.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"xdiff-interface.h\"\n #include \"ll-merge.h\"\ndiff --git a/archive-tar.c b/archive-tar.c\nindex ee27fa0b39b..16ee133bbf5 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tar.h\"\n #include \"archive.h\"\ndiff --git a/archive-zip.c b/archive-zip.c\nindex c5d1f72eb80..c02dc33e406 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"archive.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"utf8.h\"\ndiff --git a/archive.c b/archive.c\nindex 1c2ca78e52a..2c3da1cff30 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/attr.c b/attr.c\nindex 657ee52229e..48e2d646187 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"quote.h\"\n #include \"revision.h\"\ndiff --git a/bisect.c b/bisect.c\nindex 1409150c5c3..5a3a8182d83 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"refs.h\"\ndiff --git a/blame.c b/blame.c\nindex e45d8a3bf92..b7cd849bb6b 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -5,6 +5,7 @@\n #include \"mergesort.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"blame.h\"\ndiff --git a/branch.c b/branch.c\nindex eacef62b7c9..66d32c68564 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"branch.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 61dd386d109..f12054d9be1 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -9,6 +9,7 @@\n #include \"builtin.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"exec-cmd.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5e6b237c424..cc1fdf4f75d 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -8,6 +8,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"dir.h\"\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 555219de40f..fe72c0ec3eb 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"apply.h\"\n \ndiff --git a/builtin/archive.c b/builtin/archive.c\nindex d0a583ea958..d13934f1a80 100644\n--- a/builtin/archive.c\n+++ b/builtin/archive.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"archive.h\"\n+#include \"gettext.h\"\n #include \"transport.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/bisect.c b/builtin/bisect.c\nindex c64c8d715a5..09188e554b3 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"bisect.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fdd9f0c0fc7..21f6b523a6d 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -10,6 +10,7 @@\n #include \"config.h\"\n #include \"color.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex f63fd45edb9..a67a8334d5c 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -11,6 +11,7 @@\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"remote.h\"\n #include \"parse-options.h\"\n #include \"branch.h\"\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex 5bc254be80f..b61cfa9464f 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n #include \"help.h\"\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 666f01bccd0..de3898ffa41 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 9e7e03ade41..9f1bf8f0e96 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex d7a40e674ca..ad27255e2cb 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"attr.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex ab776061c7c..a45d001e353 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex 96db3ddb4bb..fa86fd9423d 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"mailmap.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c\nindex 0a7d762573c..2120dd1d300 100644\n--- a/builtin/checkout--worker.c\n+++ b/builtin/checkout--worker.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"gettext.h\"\n #include \"parallel-checkout.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex cf6fba97ba7..828c0363f8a 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -8,6 +8,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 734d730980c..47d4c369a16 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -9,6 +9,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"hook.h\"\n #include \"ll-merge.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 10aaa8c603f..46c51029ab4 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 462c286274c..d605fcafa0f 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -11,6 +11,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/column.c b/builtin/column.c\nindex 158fdf53d9f..de623a16c2d 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex d3be7f3b318..311e0106810 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex e805da5bb1c..0ef55d83d49 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex f71ed41bf59..25575435ad7 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -16,6 +16,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"wt-status.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 49d832d4093..33b17b40b41 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex bb21bc43e42..48edc86c240 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c\nindex 6e509d02c37..0f00ba4d741 100644\n--- a/builtin/credential-cache--daemon.c\n+++ b/builtin/credential-cache--daemon.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n #ifndef NO_UNIX_SOCKETS\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex 78c02ad5319..25f2f71c216 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n #ifndef NO_UNIX_SOCKETS\ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex 62a4f3c2653..da32cfd89e2 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n #include \"credential.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 5b5930f5c8c..fcacdf8a693 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\ndiff --git a/builtin/diagnose.c b/builtin/diagnose.c\nindex d52015c67a4..5b12d1fb963 100644\n--- a/builtin/diagnose.c\n+++ b/builtin/diagnose.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"diagnose.h\"\n \ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex a393efa4f08..385c2d0230c 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"log-tree.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 26f1e532c66..20bdb6e6cec 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -11,6 +11,7 @@\n #include \"color.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"diff.h\"\n #include \"diff-merges.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 01681d0fb88..f7380dd1cc7 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -17,6 +17,7 @@\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"strvec.h\"\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 78493c6d2bf..9ab2e34ef05 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -6,6 +6,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex f7548ff4a35..f3635c7aefd 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex 702c9a3397e..60e5a10ffc5 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"fetch-pack.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 7221e57f352..990f81f6d1a 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"refs.h\"\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 8d8fd393f89..0f9855b680e 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"fmt-merge-msg.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 6f62f40d126..7a8ff5902cf 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c\nindex 6aeac371488..27425c2fc9e 100644\n--- a/builtin/for-each-repo.c\n+++ b/builtin/for-each-repo.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex c4a633c0329..1375e32d2a1 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c\nindex cae804a1908..215e3813d7d 100644\n--- a/builtin/fsmonitor--daemon.c\n+++ b/builtin/fsmonitor--daemon.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-ipc.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex c58fe8c936c..32cabad7cf6 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -32,6 +32,7 @@\n #include \"refs.h\"\n #include \"remote.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hook.h\"\n \n #define FAILED_RUN \"failed to run %s\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex c590fcb19dd..3c9c6b38031 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex 1848768b97c..f233eda7590 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -6,6 +6,7 @@\n  */\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 53f2812dfb1..3fde5c4fd35 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -5,6 +5,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n #include \"config-list.h\"\ndiff --git a/builtin/hook.c b/builtin/hook.c\nindex f95b7965c58..88051795c7f 100644\n--- a/builtin/hook.c\n+++ b/builtin/hook.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hook.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex b451755f405..bae5b054039 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"delta.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex dcaaf102eaf..e182bc7e839 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c\nindex e58627c72a9..107ac28f0e8 100644\n--- a/builtin/interpret-trailers.c\n+++ b/builtin/interpret-trailers.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"trailer.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex bc204ea76ff..e702cf126e5 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -7,6 +7,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex a03b559ecaa..09deb752ab3 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -11,6 +11,7 @@\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex 2dfbd8ed9b9..11d9424804a 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"transport.h\"\n #include \"ref-filter.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 64d8e54318c..b4835f1d4cc 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"blob.h\"\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex 01d16ef9e5a..e8bb011cfb4 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -4,6 +4,7 @@\n  */\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\n #include \"mailinfo.h\"\ndiff --git a/builtin/mailsplit.c b/builtin/mailsplit.c\nindex 73509f651bd..b08069ce60a 100644\n--- a/builtin/mailsplit.c\n+++ b/builtin/mailsplit.c\n@@ -6,6 +6,7 @@\n  */\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex be8f3b221c9..e0995f3219f 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"diff.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex c923bbf2abb..ae45f523b95 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex b9acbf5d342..a49fab9bcb1 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"merge-recursive.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex e7825181648..89b807388a4 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -3,6 +3,7 @@\n #include \"tree-walk.h\"\n #include \"xdiff-interface.h\"\n #include \"help.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"commit.h\"\n #include \"commit-reach.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 19c31d4ff48..a90ae5d2ddc 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 42c2457c705..e93aee72258 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"tag.h\"\ndiff --git a/builtin/mktree.c b/builtin/mktree.c\nindex 848c7b47476..09a7bd5c5c2 100644\n--- a/builtin/mktree.c\n+++ b/builtin/mktree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"quote.h\"\n #include \"tree.h\"\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 9a18a82b057..e6757a44470 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"midx.h\"\n #include \"trace2.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 81290503775..c02dddb72b5 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 723ba616a88..6977a5f580b 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 75ce7f3f574..8e9be33ddbb 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"notes.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 545b8bddc8e..1ca800c7c50 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c\nindex 82115c5808c..3451971b564 100644\n--- a/builtin/pack-redundant.c\n+++ b/builtin/pack-redundant.c\n@@ -7,6 +7,7 @@\n */\n \n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"packfile.h\"\ndiff --git a/builtin/pack-refs.c b/builtin/pack-refs.c\nindex 27c2ca06acb..9833815fb30 100644\n--- a/builtin/pack-refs.c\n+++ b/builtin/pack-refs.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\n #include \"repository.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 338b15cd7b0..9d5585d3a72 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -2,6 +2,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/prune-packed.c b/builtin/prune-packed.c\nindex da3273a268b..ca3578e1588 100644\n--- a/builtin/prune-packed.c\n+++ b/builtin/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"prune-packed.h\"\n \ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 119a253a2ad..ff62a0adb8f 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 56f679d94a0..1a1a89af055 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 12a402aea3d..2d76fa68376 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"refspec.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex aecfae12d3a..97724fd0ed7 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"range-diff.h\"\n #include \"config.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 11759c415f3..ec66008d07e 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -7,6 +7,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex dd31d5ab91e..a2c68b8ff7b 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -6,6 +6,7 @@\n \n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 6a24ab4f451..006565f8513 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"repository.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 270681dcdf4..0879d4d2246 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"reachable.h\"\n #include \"worktree.h\"\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 729f6f3643a..2074d6be28c 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"transport.h\"\n #include \"remote.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 87f73c8923a..771ca01527d 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 71d8e949e35..cf85e590d9f 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -11,6 +11,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 94ffb8c21ab..24c78755723 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 24b04aeecb9..4335c1a6e1b 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -10,6 +10,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"tag.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 85e522dff8a..f2f6a0d3e67 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -2,6 +2,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"list-objects.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex e1fa9c6348c..5a932a861b4 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -8,6 +8,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"quote.h\"\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 62986a7b1b0..dd6587a99d8 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -4,6 +4,7 @@\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"rerere.h\"\n #include \"dir.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex dc198f79082..5982c3d8122 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -11,6 +11,7 @@\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"cache-tree.h\"\n+#include \"gettext.h\"\n #include \"tree-walk.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 27a87167e19..d8c4379ea16 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"revision.h\"\n #include \"utf8.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 8342b68aef7..8d569629726 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pretty.h\"\n #include \"refs.h\"\ndiff --git a/builtin/show-index.c b/builtin/show-index.c\nindex 98ec40ddf46..d4bbbbcd6ce 100644\n--- a/builtin/show-index.c\n+++ b/builtin/show-index.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 1f28d7fe4b9..a5df7587d51 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex 8d5ae6f2a60..3976d8e86b8 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"repository.h\"\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 6a12fed2713..65817d0b763 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 1e34cf2bebd..d8e61459333 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex d05d1a84623..a4bdd44daa3 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"builtin.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"cache.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex e00768a8b7e..10198a74fae 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex adcaa547b0d..c2ea89c4754 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -9,6 +9,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 1908dcfcffb..f7c4b531076 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"object.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 11dc1352716..ef78b2d28e1 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -7,6 +7,7 @@\n #include \"cache.h\"\n #include \"bulk-checkin.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex a84e7b47a20..fdf51495b51 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex d2239c9ef4d..e7bff27ae40 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n \n static const char * const update_server_info_usage[] = {\ndiff --git a/builtin/upload-pack.c b/builtin/upload-pack.c\nindex 7a3c68720f1..beb9dd08610 100644\n--- a/builtin/upload-pack.c\n+++ b/builtin/upload-pack.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"pkt-line.h\"\n #include \"parse-options.h\"\n #include \"protocol.h\"\ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 7aedf10e856..22e5afc069e 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n #include \"commit.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex 27d6f75fd8a..190fd695409 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5c00b0b0f77..850e1a11c7b 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -8,6 +8,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n+#include \"gettext.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 80d05e246d8..ed89b7e9725 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"strvec.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 7ad0d059453..7eec4e3cbd1 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -7,6 +7,7 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex d64cd5c52d0..778ca1e0f4f 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"repository.h\"\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 177c1810402..2cc7d159bd6 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 \"gettext.h\"\n #include \"object-store.h\"\n #include \"refs.h\"\n #include \"run-command.h\"\ndiff --git a/bundle.c b/bundle.c\nindex 99d7de97f6c..f5b3643b17e 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"lockfile.h\"\n #include \"bundle.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/chunk-format.c b/chunk-format.c\nindex f65e9a1e429..6d1071729df 100644\n--- a/chunk-format.c\n+++ b/chunk-format.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"chunk-format.h\"\n #include \"csum-file.h\"\n+#include \"gettext.h\"\n \n /*\n  * When writing a chunk-based file format, collect the chunks in\ndiff --git a/color.c b/color.c\nindex 6b577ce0a75..672dcbb73a6 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 5e6098ff356..8f21a0a0c20 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\ndiff --git a/commit.c b/commit.c\nindex 7b63d3b0e1c..3fdfb325117 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -2,6 +2,7 @@\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"commit-graph.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/common-main.c b/common-main.c\nindex 0a22861f1ce..184d1534d2d 100644\n--- a/common-main.c\n+++ b/common-main.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"attr.h\"\n \n /*\ndiff --git a/compat/disk.h b/compat/disk.h\nindex 50a32e3d8a4..a04a8d294af 100644\n--- a/compat/disk.h\n+++ b/compat/disk.h\n@@ -2,6 +2,7 @@\n #define COMPAT_DISK_H\n \n #include \"git-compat-util.h\"\n+#include \"gettext.h\"\n \n static int get_disk_info(struct strbuf *out)\n {\ndiff --git a/compat/fsmonitor/fsm-health-win32.c b/compat/fsmonitor/fsm-health-win32.c\nindex 2ea08c1d4e8..fe11bdd9ce6 100644\n--- a/compat/fsmonitor/fsm-health-win32.c\n+++ b/compat/fsmonitor/fsm-health-win32.c\n@@ -3,6 +3,7 @@\n #include \"fsmonitor.h\"\n #include \"fsm-health.h\"\n #include \"fsmonitor--daemon.h\"\n+#include \"gettext.h\"\n \n /*\n  * Every minute wake up and test our health.\ndiff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c\nindex 97a55a6f0a4..5eb6402ab82 100644\n--- a/compat/fsmonitor/fsm-listen-darwin.c\n+++ b/compat/fsmonitor/fsm-listen-darwin.c\n@@ -28,6 +28,7 @@\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n \n struct fsm_listen_data\n {\ndiff --git a/compat/fsmonitor/fsm-listen-win32.c b/compat/fsmonitor/fsm-listen-win32.c\nindex 03df8d951b8..7b07b74ba5b 100644\n--- a/compat/fsmonitor/fsm-listen-win32.c\n+++ b/compat/fsmonitor/fsm-listen-win32.c\n@@ -3,6 +3,7 @@\n #include \"fsmonitor.h\"\n #include \"fsm-listen.h\"\n #include \"fsmonitor--daemon.h\"\n+#include \"gettext.h\"\n \n /*\n  * The documentation of ReadDirectoryChangesW() states that the maximum\ndiff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/compat/fsmonitor/fsm-path-utils-darwin.c\nindex ce5a8febe09..45eb4a9b9e7 100644\n--- a/compat/fsmonitor/fsm-path-utils-darwin.c\n+++ b/compat/fsmonitor/fsm-path-utils-darwin.c\n@@ -1,5 +1,6 @@\n #include \"fsmonitor.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n #include <dirent.h>\n #include <errno.h>\n #include <fcntl.h>\ndiff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/compat/fsmonitor/fsm-path-utils-win32.c\nindex 0d95bbb416f..4024baafb97 100644\n--- a/compat/fsmonitor/fsm-path-utils-win32.c\n+++ b/compat/fsmonitor/fsm-path-utils-win32.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"fsmonitor.h\"\n #include \"fsmonitor-path-utils.h\"\n+#include \"gettext.h\"\n \n /*\n  * Check remote working directory protocol.\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 3afbde78944..a9e5570288c 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -11,6 +11,7 @@\n #include \"win32/lazyload.h\"\n #include \"../config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #define SECURITY_WIN32\n #include <sspi.h>\n \ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex cce1d57a464..56d36cdf22a 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -7,6 +7,7 @@\n \n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\n \ndiff --git a/compat/simple-ipc/ipc-unix-socket.c b/compat/simple-ipc/ipc-unix-socket.c\nindex 28a79289d4f..152db60a311 100644\n--- a/compat/simple-ipc/ipc-unix-socket.c\n+++ b/compat/simple-ipc/ipc-unix-socket.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c\nindex 20ea7b65e0b..f011e5cead8 100644\n--- a/compat/simple-ipc/ipc-win32.c\n+++ b/compat/simple-ipc/ipc-win32.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"strbuf.h\"\n #include \"pkt-line.h\"\ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex ea490a7ced4..afebe6b2496 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"compat/terminal.h\"\n+#include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strbuf.h\"\n #include \"run-command.h\"\ndiff --git a/config.c b/config.c\nindex 983c45fc37b..f30a6d8e686 100644\n--- a/config.c\n+++ b/config.c\n@@ -11,6 +11,7 @@\n #include \"branch.h\"\n #include \"config.h\"\n #include \"environment.h\"\n+#include \"gettext.h\"\n #include \"ident.h\"\n #include \"repository.h\"\n #include \"lockfile.h\"\ndiff --git a/connect.c b/connect.c\nindex 000865bc33e..f3b159bf441 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pkt-line.h\"\n #include \"quote.h\"\ndiff --git a/connected.c b/connected.c\nindex 39cb1e1074d..a4c0aece757 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"run-command.h\"\ndiff --git a/convert.c b/convert.c\nindex 349c7e4af15..2bd54244b55 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\ndiff --git a/credential.c b/credential.c\nindex ea40a2a410b..5244f3c12c0 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"credential.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"url.h\"\ndiff --git a/date.c b/date.c\nindex 6f45eeb3568..1fb2cd1b538 100644\n--- a/date.c\n+++ b/date.c\n@@ -6,6 +6,7 @@\n \n #include \"cache.h\"\n #include \"date.h\"\n+#include \"gettext.h\"\n \n /*\n  * This is like mktime, but without normalization of tm_wday and tm_yday.\ndiff --git a/delta-islands.c b/delta-islands.c\nindex fe12c93005b..1222b6a6cd1 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -4,6 +4,7 @@\n #include \"object.h\"\n #include \"blob.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"tree.h\"\ndiff --git a/diagnose.c b/diagnose.c\nindex 5b398f0cffc..169a55407fd 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -4,6 +4,7 @@\n #include \"archive.h\"\n #include \"dir.h\"\n #include \"help.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strvec.h\"\n #include \"object-store.h\"\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 70b3578b907..a7e04009873 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -6,6 +6,7 @@\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"cache-tree.h\"\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex a3cf358baf0..287a113badd 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -11,6 +11,7 @@\n #include \"tag.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"revision.h\"\n #include \"log-tree.h\"\n #include \"parse-options.h\"\ndiff --git a/diff.c b/diff.c\nindex 00d47281a1d..00746f2f86e 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\n #include \"diff.h\"\ndiff --git a/dir.c b/dir.c\nindex d5bb199f4b4..46f1bb6e5b7 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -9,6 +9,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"attr.h\"\n #include \"refs.h\"\ndiff --git a/editor.c b/editor.c\nindex 008c04fe2f6..58e790548d2 100644\n--- a/editor.c\n+++ b/editor.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"strbuf.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\ndiff --git a/entry.c b/entry.c\nindex c97cfa833bb..acb76a61aca 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -2,6 +2,7 @@\n #include \"blob.h\"\n #include \"object-store.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"streaming.h\"\n #include \"submodule.h\"\ndiff --git a/environment.c b/environment.c\nindex 89d89110e41..82a1fc17d0b 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -10,6 +10,7 @@\n #include \"cache.h\"\n #include \"branch.h\"\n #include \"environment.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"refs.h\"\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 0232bbc9905..282d95af081 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"quote.h\"\n #include \"strvec.h\"\n \ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 4ddabb4ec76..359dce6afed 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\ndiff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c\nindex 19d772f0f3a..866828e2992 100644\n--- a/fsmonitor-ipc.c\n+++ b/fsmonitor-ipc.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"fsmonitor.h\"\n+#include \"gettext.h\"\n #include \"simple-ipc.h\"\n #include \"fsmonitor-ipc.h\"\n #include \"run-command.h\"\ndiff --git a/git.c b/git.c\nindex ae2134f29a8..22ce4f14b65 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"config.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"help.h\"\n #include \"run-command.h\"\n #include \"alias.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 855970bb939..632265691e5 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"dir.h\"\ndiff --git a/grep.c b/grep.c\nindex 68e9328dfd4..febb076a7e6 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"grep.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 8db35b9767d..454933351b2 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"http.h\"\n #include \"walker.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex 93e9018439c..c65a27219c6 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -25,6 +25,7 @@\n #include \"config.h\"\n #include \"credential.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\ndiff --git a/list-objects-filter-options.h b/list-objects-filter-options.h\nindex ef03b45132e..65c6119e9d3 100644\n--- a/list-objects-filter-options.h\n+++ b/list-objects-filter-options.h\n@@ -1,6 +1,7 @@\n #ifndef LIST_OBJECTS_FILTER_OPTIONS_H\n #define LIST_OBJECTS_FILTER_OPTIONS_H\n \n+#include \"gettext.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/list-objects-filter.c b/list-objects-filter.c\nindex 5d7b3316608..298ca08711e 100644\n--- a/list-objects-filter.c\n+++ b/list-objects-filter.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"commit.h\"\ndiff --git a/list-objects.c b/list-objects.c\nindex ab5745bbfe4..3906ac442dd 100644\n--- a/list-objects.c\n+++ b/list-objects.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"tag.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"blob.h\"\ndiff --git a/lockfile.c b/lockfile.c\nindex cc9a4b84283..ab6490a391d 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"lockfile.h\"\n \n /*\ndiff --git a/ls-refs.c b/ls-refs.c\nindex 8091b0cca8c..ae38889bf04 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.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 748924a69ba..c00dfbab1cd 100644\n--- a/merge-ort-wrappers.c\n+++ b/merge-ort-wrappers.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"merge-ort.h\"\n #include \"merge-ort-wrappers.h\"\n \ndiff --git a/merge-ort.c b/merge-ort.c\nindex 4c5be8ed910..a26cad5f910 100644\n--- a/merge-ort.c\n+++ b/merge-ort.c\n@@ -26,6 +26,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"entry.h\"\n #include \"ll-merge.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 89731f40908..0b0255ebc80 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -17,6 +17,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"ll-merge.h\"\n #include \"lockfile.h\"\ndiff --git a/merge.c b/merge.c\nindex 2c8b8456842..da7fa652c27 100644\n--- a/merge.c\n+++ b/merge.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"diff.h\"\n #include \"diffcore.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\ndiff --git a/midx.c b/midx.c\nindex 47989f7ea70..e132ef250e4 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"csum-file.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"packfile.h\"\ndiff --git a/name-hash.c b/name-hash.c\nindex cd009c7c8ae..bb9eae55aca 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2008 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"sparse-index.h\"\ndiff --git a/notes-merge.c b/notes-merge.c\nindex 5b1a9ff13f7..c8d0020b1a2 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex d7d18e30f5a..da08e2e8e5c 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\n #include \"repository.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 8fab8dbe80b..39660d49dbc 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -9,6 +9,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"string-list.h\"\n #include \"lockfile.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 69db1ec498a..2c927bbded3 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"commit.h\"\ndiff --git a/object.c b/object.c\nindex 609fed1b73d..45c9721b8c8 100644\n--- a/object.c\n+++ b/object.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object.h\"\n #include \"replace-object.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 891d9d2772e..7dc7f0ba55e 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex ca7c81b5c9f..241ac9166c1 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"tag.h\"\ndiff --git a/pack-mtimes.c b/pack-mtimes.c\nindex cd92fc1d86c..afed6321906 100644\n--- a/pack-mtimes.c\n+++ b/pack-mtimes.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"pack-mtimes.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/pack-revindex.c b/pack-revindex.c\nindex 08dc1601679..03c7e81f9da 100644\n--- a/pack-revindex.c\n+++ b/pack-revindex.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"pack-revindex.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\ndiff --git a/pack-write.c b/pack-write.c\nindex 041e573bc16..87156f89d2b 100644\n--- a/pack-write.c\n+++ b/pack-write.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/packfile.c b/packfile.c\nindex 2023df1b75b..3290fde15a1 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"list.h\"\n #include \"pack.h\"\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 2455aa356db..38c4dc665d5 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"entry.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parallel-checkout.h\"\n #include \"pkt-line.h\"\ndiff --git a/parse-options-cb.c b/parse-options-cb.c\nindex d346dbe2100..fbf4b010195 100644\n--- a/parse-options-cb.c\n+++ b/parse-options-cb.c\n@@ -4,6 +4,7 @@\n #include \"cache.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\n #include \"oid-array.h\"\ndiff --git a/parse-options.c b/parse-options.c\nindex 6dd4c090e03..084b4f10621 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -4,6 +4,7 @@\n #include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n+#include \"gettext.h\"\n #include \"utf8.h\"\n \n static int disallow_abbreviated_options;\ndiff --git a/parse-options.h b/parse-options.h\nindex 50d852f2991..d57868eff93 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -1,6 +1,8 @@\n #ifndef PARSE_OPTIONS_H\n #define PARSE_OPTIONS_H\n \n+#include \"gettext.h\"\n+\n /**\n  * Refer to Documentation/technical/api-parse-options.txt for the API doc.\n  */\ndiff --git a/path.c b/path.c\nindex 632a051809a..3f2702cbe49 100644\n--- a/path.c\n+++ b/path.c\n@@ -2,6 +2,7 @@\n  * Utilities for paths and pathnames\n  */\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"strbuf.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex ab70fcbe613..868b4d280ca 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\n #include \"strvec.h\"\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 1ea7f8600ec..c8b90b2242e 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"pkt-line.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"run-command.h\"\n \ndiff --git a/preload-index.c b/preload-index.c\nindex 100f7a374dc..4b45e1d6912 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -5,6 +5,7 @@\n #include \"pathspec.h\"\n #include \"dir.h\"\n #include \"fsmonitor.h\"\n+#include \"gettext.h\"\n #include \"config.h\"\n #include \"progress.h\"\n #include \"thread-utils.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 05b557d0961..9d7922dcc60 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -2,6 +2,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"utf8.h\"\n #include \"diff.h\"\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex 1db566982ec..a8dbb788e8f 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"promisor-remote.h\"\ndiff --git a/prune-packed.c b/prune-packed.c\nindex e02f466c2ee..cff5ad569c7 100644\n--- a/prune-packed.c\n+++ b/prune-packed.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"progress.h\"\ndiff --git a/range-diff.c b/range-diff.c\nindex 4bd65ab7496..1bfc612e274 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"range-diff.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/reachable.c b/reachable.c\nindex c9dab2a66b9..b0f85046e9c 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"tag.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex 1bcf6732718..63789ea5e21 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -18,6 +18,7 @@\n #include \"tree.h\"\n #include \"commit.h\"\n #include \"blob.h\"\n+#include \"gettext.h\"\n #include \"resolve-undo.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/rebase-interactive.c b/rebase-interactive.c\nindex 7407c593191..649c94e69a6 100644\n--- a/rebase-interactive.c\n+++ b/rebase-interactive.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"sequencer.h\"\n #include \"rebase-interactive.h\"\n #include \"strbuf.h\"\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 38141bce8db..9a830bedef0 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/ref-filter.h b/ref-filter.h\nindex aa0eea4ecf5..cc811c2cadd 100644\n--- a/ref-filter.h\n+++ b/ref-filter.h\n@@ -1,6 +1,7 @@\n #ifndef REF_FILTER_H\n #define REF_FILTER_H\n \n+#include \"gettext.h\"\n #include \"oid-array.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/reflog.c b/reflog.c\nindex 04630f56ec6..d1c39374318 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"object-store.h\"\n #include \"reflog.h\"\n #include \"refs.h\"\ndiff --git a/refs.c b/refs.c\nindex 4e5cc73fb10..8684f4610f5 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -6,6 +6,7 @@\n #include \"alloc.h\"\n #include \"config.h\"\n #include \"hashmap.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"iterator.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 31bc5c45ee6..de3628ff3f1 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 \"../gettext.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 6f975185995..3334c07003c 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1,6 +1,7 @@\n #include \"../cache.h\"\n #include \"../alloc.h\"\n #include \"../config.h\"\n+#include \"../gettext.h\"\n #include \"../hex.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex ed7e3a043ac..943cd6fe6cd 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\n #include \"connect.h\"\ndiff --git a/remote.c b/remote.c\nindex 2daddb85cb7..edb1e07497c 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"remote.h\"\n #include \"urlmatch.h\"\ndiff --git a/replace-object.c b/replace-object.c\nindex 0cf056c4fbf..9e30e0362ba 100644\n--- a/replace-object.c\n+++ b/replace-object.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\n #include \"object-store.h\"\ndiff --git a/rerere.c b/rerere.c\nindex a67abaab077..9428cbca7b2 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\ndiff --git a/rerere.h b/rerere.h\nindex c32d79c3bd8..7899dc21747 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -1,6 +1,7 @@\n #ifndef RERERE_H\n #define RERERE_H\n \n+#include \"gettext.h\"\n #include \"string-list.h\"\n \n struct pathspec;\ndiff --git a/reset.c b/reset.c\nindex 58b3829ff73..604d9325b78 100644\n--- a/reset.c\n+++ b/reset.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache-tree.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\ndiff --git a/revision.c b/revision.c\nindex e4c066e90b7..7423e23327b 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"tag.h\"\ndiff --git a/run-command.c b/run-command.c\nindex ba617655b23..2c8b4cd9bfc 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"run-command.h\"\n #include \"exec-cmd.h\"\n+#include \"gettext.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"thread-utils.h\"\ndiff --git a/send-pack.c b/send-pack.c\nindex 423a5cfe22d..f531cb48212 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 \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 3be23d7ca20..0df51726306 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/setup.c b/setup.c\nindex cefd5f63c46..8a4ccee4c2c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\ndiff --git a/sideband.c b/sideband.c\nindex 85bddfdcd4f..4905cf9b32a 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"color.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"sideband.h\"\n #include \"help.h\"\n #include \"pkt-line.h\"\ndiff --git a/sparse-index.c b/sparse-index.c\nindex 63216b3e57f..fdae9011b8e 100644\n--- a/sparse-index.c\n+++ b/sparse-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"sparse-index.h\"\n #include \"tree.h\"\ndiff --git a/split-index.c b/split-index.c\nindex 95ecfa53195..c98807c655b 100644\n--- a/split-index.c\n+++ b/split-index.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"split-index.h\"\n #include \"ewah/ewok.h\"\n \ndiff --git a/strbuf.c b/strbuf.c\nindex 8800830ebf8..15209777d5a 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"string-list.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 89a7bf0a93d..38663801aa4 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/submodule.c b/submodule.c\nindex 0baf97cf770..8b551e53274 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -7,6 +7,7 @@\n #include \"dir.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"run-command.h\"\ndiff --git a/symlinks.c b/symlinks.c\nindex c667baa949b..c35c8d4408d 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.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/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex 615e648e555..8b7a8fce1ee 100644\n--- a/t/helper/test-cache-tree.c\n+++ b/t/helper/test-cache-tree.c\n@@ -1,6 +1,7 @@\n #define USE_THE_INDEX_VARIABLE\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 1e975df9041..68bbc41b330 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -15,6 +15,7 @@\n #include \"cache.h\"\n #include \"cache-tree.h\"\n #include \"commit.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"lockfile.h\"\n #include \"merge-ort.h\"\ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 05d56267a9f..09c711038ce 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -4,6 +4,7 @@\n #include \"commit.h\"\n #include \"commit-reach.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"ref-filter.h\"\ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 824e5c0a958..497d72058de 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\n \ndiff --git a/trailer.c b/trailer.c\nindex 72c3fed5c6e..9eb1b761190 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"commit.h\"\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 82ac63e2609..105bb801c21 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -4,6 +4,7 @@\n #include \"run-command.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"remote.h\"\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 0e2f5ceb71d..38b6556478d 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -2,6 +2,7 @@\n #include \"tree-walk.h\"\n #include \"alloc.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"object-store.h\"\n #include \"tree.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex a75fb9f05b4..84e0d2e8afe 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -3,6 +3,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 41b9362cf1b..eea9e6a6e8c 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/usage.c b/usage.c\nindex 5a7c6c346c1..40a1c5a4339 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -3,8 +3,8 @@\n  *\n  * Copyright (C) Linus Torvalds, 2005\n  */\n-#include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"gettext.h\"\n \n static void vreportf(const char *prefix, const char *err, va_list params)\n {\ndiff --git a/walker.c b/walker.c\nindex c0469363789..b642fd2c3bc 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"walker.h\"\n #include \"repository.h\"\ndiff --git a/worktree.c b/worktree.c\nindex cbb0db2d7cc..09eb522e5a9 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"alloc.h\"\n+#include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n #include \"strbuf.h\"\ndiff --git a/wrapper.c b/wrapper.c\nindex 299d6489a6b..0d4ceba6fc5 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -3,6 +3,7 @@\n  */\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"gettext.h\"\n \n static intmax_t count_fsync_writeout_only;\n static intmax_t count_fsync_hardware_flush;\ndiff --git a/wt-status.c b/wt-status.c\nindex 90525bd26fd..d15f2b0e7e8 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -4,6 +4,7 @@\n #include \"dir.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n+#include \"gettext.h\"\n #include \"hex.h\"\n #include \"revision.h\"\n #include \"diffcore.h\"\n-- \ngitgitgadget\n\n"},{"id":"473835","messageId":"30b21691265a57bb3c6db0c5e2e117731c795daa.1679379973.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 14/16] treewide: remove cache.h inclusion due to setup.h changes","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:06Z","receivedAt":"2023-03-21T06:26: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\nBy moving several declarations to setup.h, the previous patch made it\npossible to remove the include of cache.h in several source files.  Do\nso.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n line-log.c                                   | 1 -\n path.c                                       | 2 +-\n t/helper/test-advise.c                       | 1 -\n t/helper/test-bloom.c                        | 3 +--\n t/helper/test-config.c                       | 1 -\n t/helper/test-pack-mtimes.c                  | 1 -\n t/helper/test-partial-clone.c                | 3 +--\n t/helper/test-proc-receive.c                 | 3 +--\n t/helper/test-read-graph.c                   | 1 -\n t/helper/test-ref-store.c                    | 1 -\n t/helper/test-repository.c                   | 1 -\n t/helper/test-revision-walking.c             | 1 -\n t/helper/test-serve-v2.c                     | 1 -\n t/helper/test-submodule-nested-repo-config.c | 1 -\n t/helper/test-submodule.c                    | 1 -\n t/helper/test-subprocess.c                   | 1 -\n t/helper/test-userdiff.c                     | 1 -\n worktree.c                                   | 2 +-\n 18 files changed, 5 insertions(+), 21 deletions(-)\n\ndiff --git a/line-log.c b/line-log.c\nindex 84c8093c517..10c19daec4a 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -1,7 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"alloc.h\"\n #include \"line-range.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"tag.h\"\n #include \"blob.h\"\ndiff --git a/path.c b/path.c\nindex a1702434979..dff215ac693 100644\n--- a/path.c\n+++ b/path.c\n@@ -1,7 +1,7 @@\n /*\n  * Utilities for paths and pathnames\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\ndiff --git a/t/helper/test-advise.c b/t/helper/test-advise.c\nindex 4e6ed30afa1..8a3fd0009a0 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"advice.h\"\n #include \"config.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex e5754b8da62..d2b30d644da 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -1,7 +1,6 @@\n-#include \"cache.h\"\n+#include \"test-tool.h\"\n #include \"bloom.h\"\n #include \"hex.h\"\n-#include \"test-tool.h\"\n #include \"commit.h\"\n #include \"setup.h\"\n \ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 5877188f3ad..32d170ec303 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"config.h\"\n #include \"setup.h\"\n #include \"string-list.h\"\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex 75ca1505a37..0f3fbeec532 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"strbuf.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c\nindex cce496944ac..362bd64a4c2 100644\n--- a/t/helper/test-partial-clone.c\n+++ b/t/helper/test-partial-clone.c\n@@ -1,6 +1,5 @@\n-#include \"cache.h\"\n-#include \"hex.h\"\n #include \"test-tool.h\"\n+#include \"hex.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c\nindex 7c8de7b562a..f30022d2225 100644\n--- a/t/helper/test-proc-receive.c\n+++ b/t/helper/test-proc-receive.c\n@@ -1,11 +1,10 @@\n-#include \"cache.h\"\n+#include \"test-tool.h\"\n #include \"connect.h\"\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n #include \"setup.h\"\n #include \"sigchain.h\"\n-#include \"test-tool.h\"\n \n static const char *proc_receive_usage[] = {\n \t\"test-tool proc-receive [<options>]\",\ndiff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c\nindex e21b0805f3c..78965a6ebdc 100644\n--- a/t/helper/test-read-graph.c\n+++ b/t/helper/test-read-graph.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit-graph.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 8717b95e84f..d1192c8c039 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex 6774f6245f0..bafd2a5bf95 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit-graph.h\"\n #include \"commit.h\"\n #include \"config.h\"\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex f2df4334063..7750afb2866 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -9,7 +9,6 @@\n  */\n \n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 7d590ab7227..054cbcf5d83 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex aaffd422d6e..d31f5e48ab5 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.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 f18ca46dce4..0e34581b209 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -1,6 +1,5 @@\n #include \"test-tool.h\"\n #include \"test-tool-utils.h\"\n-#include \"cache.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n #include \"setup.h\"\ndiff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c\nindex 65a355cc590..c344f1694df 100644\n--- a/t/helper/test-subprocess.c\n+++ b/t/helper/test-subprocess.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"run-command.h\"\n #include \"setup.h\"\n \ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex 0cd7ee12b7e..680124a6760 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -1,5 +1,4 @@\n #include \"test-tool.h\"\n-#include \"cache.h\"\n #include \"setup.h\"\n #include \"userdiff.h\"\n #include \"config.h\"\ndiff --git a/worktree.c b/worktree.c\nindex 7f0f04eab56..b5ee71c5ebd 100644\n--- a/worktree.c\n+++ b/worktree.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 \"environment.h\"\n-- \ngitgitgadget\n\n"},{"id":"473836","messageId":"6e40d1d783d8643da23b5f1a524ebdba12f7e7dc.1679379973.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:07Z","receivedAt":"2023-03-21T06:27: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 archive-tar.c              |  1 +\n archive-zip.c              |  1 +\n builtin/blame.c            |  1 +\n builtin/cat-file.c         |  1 +\n builtin/check-attr.c       |  1 +\n builtin/check-ignore.c     |  1 +\n builtin/check-mailmap.c    |  1 +\n builtin/credential-cache.c |  1 +\n builtin/credential-store.c |  1 +\n builtin/grep.c             |  1 +\n builtin/hash-object.c      |  1 +\n builtin/log.c              |  1 +\n builtin/notes.c            |  1 +\n builtin/send-pack.c        |  1 +\n builtin/stripspace.c       |  1 +\n builtin/tag.c              |  1 +\n builtin/update-index.c     |  1 +\n bundle.c                   |  1 +\n cache.h                    | 74 ------------------------------------\n config.c                   |  1 +\n csum-file.h                |  1 +\n diagnose.c                 |  1 +\n environment.c              |  1 +\n http-backend.c             |  1 +\n log-tree.c                 |  1 +\n pkt-line.c                 |  1 +\n refs/files-backend.c       |  1 +\n refs/packed-backend.c      |  1 +\n remote-curl.c              |  1 +\n send-pack.c                |  3 +-\n sideband.c                 |  1 +\n t/helper/test-pkt-line.c   |  3 +-\n upload-pack.c              |  1 +\n write-or-die.c             |  3 +-\n write-or-die.h             | 78 ++++++++++++++++++++++++++++++++++++++\n 35 files changed, 114 insertions(+), 77 deletions(-)\n create mode 100644 write-or-die.h\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 16ee133bbf5..497dad0b3af 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -11,6 +11,7 @@\n #include \"object-store.h\"\n #include \"streaming.h\"\n #include \"run-command.h\"\n+#include \"write-or-die.h\"\n \n #define RECORDSIZE\t(512)\n #define BLOCKSIZE\t(RECORDSIZE * 20)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex c02dc33e406..e6f5c10a14f 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -10,6 +10,7 @@\n #include \"utf8.h\"\n #include \"object-store.h\"\n #include \"userdiff.h\"\n+#include \"write-or-die.h\"\n #include \"xdiff-interface.h\"\n #include \"date.h\"\n \ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fb271bae70e..0a3cc019059 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -33,6 +33,7 @@\n #include \"refs.h\"\n #include \"setup.h\"\n #include \"tag.h\"\n+#include \"write-or-die.h\"\n \n static char blame_usage[] = N_(\"git blame [<options>] [<rev-opts>] [<rev>] [--] <file>\");\n static char annotate_usage[] = N_(\"git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>\");\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 365d9234bdb..cf73d187912 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -23,6 +23,7 @@\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n #include \"mailmap.h\"\n+#include \"write-or-die.h\"\n \n enum batch_mode {\n \tBATCH_MODE_CONTENTS,\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex ec37b8164af..1dbe9d6ca88 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -8,6 +8,7 @@\n #include \"quote.h\"\n #include \"setup.h\"\n #include \"parse-options.h\"\n+#include \"write-or-die.h\"\n \n static int all_attrs;\n static int cached_attrs;\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex a45d001e353..9401dad0070 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -8,6 +8,7 @@\n #include \"pathspec.h\"\n #include \"parse-options.h\"\n #include \"submodule.h\"\n+#include \"write-or-die.h\"\n \n static int quiet, verbose, stdin_paths, show_non_matching, no_index;\n static const char * const check_ignore_usage[] = {\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex fa86fd9423d..002d2941e93 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -5,6 +5,7 @@\n #include \"mailmap.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n+#include \"write-or-die.h\"\n \n static int use_stdin;\n static const char * const check_mailmap_usage[] = {\ndiff --git a/builtin/credential-cache.c b/builtin/credential-cache.c\nindex af56a44923d..508da4c6e4d 100644\n--- a/builtin/credential-cache.c\n+++ b/builtin/credential-cache.c\n@@ -2,6 +2,7 @@\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n #ifndef NO_UNIX_SOCKETS\n \ndiff --git a/builtin/credential-store.c b/builtin/credential-store.c\nindex da32cfd89e2..8977604eb9d 100644\n--- a/builtin/credential-store.c\n+++ b/builtin/credential-store.c\n@@ -5,6 +5,7 @@\n #include \"credential.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"write-or-die.h\"\n \n static struct lock_file credential_lock;\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex b8ebf014f40..d858bf0bea6 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -28,6 +28,7 @@\n #include \"submodule-config.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n+#include \"write-or-die.h\"\n \n static const char *grep_prefix;\n \ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex a2e160db026..a15fe4fd3f4 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -15,6 +15,7 @@\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\n #include \"setup.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * This is to create corrupt objects for debugging and as such it\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 1b92dee196e..b28a24c3093 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -40,6 +40,7 @@\n #include \"commit-reach.h\"\n #include \"range-diff.h\"\n #include \"tmp-objdir.h\"\n+#include \"write-or-die.h\"\n \n #define MAIL_DEFAULT_WRAP 72\n #define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 8e9be33ddbb..26cbb564a8e 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -25,6 +25,7 @@\n #include \"notes-merge.h\"\n #include \"notes-utils.h\"\n #include \"worktree.h\"\n+#include \"write-or-die.h\"\n \n static const char * const git_notes_usage[] = {\n \tN_(\"git notes [--ref <notes-ref>] [list [<object>]]\"),\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex fb5b2bad2cc..2b360fee426 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -16,6 +16,7 @@\n #include \"gpg-interface.h\"\n #include \"gettext.h\"\n #include \"protocol.h\"\n+#include \"write-or-die.h\"\n \n static const char * const send_pack_usage[] = {\n \tN_(\"git send-pack [--mirror] [--dry-run] [--force]\\n\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 53930458ffa..9451eb69ff4 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -5,6 +5,7 @@\n #include \"parse-options.h\"\n #include \"setup.h\"\n #include \"strbuf.h\"\n+#include \"write-or-die.h\"\n \n static void comment_lines(struct strbuf *buf)\n {\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 0611b3bd600..531631a36c2 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -24,6 +24,7 @@\n #include \"column.h\"\n #include \"ref-filter.h\"\n #include \"date.h\"\n+#include \"write-or-die.h\"\n \n static const char * const git_tag_usage[] = {\n \tN_(\"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\\n\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex f97f8d4c9d5..03cda5e60d2 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -23,6 +23,7 @@\n #include \"setup.h\"\n #include \"split-index.h\"\n #include \"fsmonitor.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * Default to not allowing changes to the list of files. The\ndiff --git a/bundle.c b/bundle.c\nindex efeaf6f7151..dac82e2f2d9 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -16,6 +16,7 @@\n #include \"strvec.h\"\n #include \"list-objects-filter-options.h\"\n #include \"connected.h\"\n+#include \"write-or-die.h\"\n \n static const char v2_bundle_signature[] = \"# v2 git bundle\\n\";\n static const char v3_bundle_signature[] = \"# v3 git bundle\\n\";\ndiff --git a/cache.h b/cache.h\nindex bffedd240e7..c43051d7928 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -686,63 +686,6 @@ extern int verify_ce_order;\n \n extern int quote_path_fully;\n \n-/*\n- * These values are used to help identify parts of a repository to fsync.\n- * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the\n- * repository and so shouldn't be fsynced.\n- */\n-enum fsync_component {\n-\tFSYNC_COMPONENT_NONE,\n-\tFSYNC_COMPONENT_LOOSE_OBJECT\t\t= 1 << 0,\n-\tFSYNC_COMPONENT_PACK\t\t\t= 1 << 1,\n-\tFSYNC_COMPONENT_PACK_METADATA\t\t= 1 << 2,\n-\tFSYNC_COMPONENT_COMMIT_GRAPH\t\t= 1 << 3,\n-\tFSYNC_COMPONENT_INDEX\t\t\t= 1 << 4,\n-\tFSYNC_COMPONENT_REFERENCE\t\t= 1 << 5,\n-};\n-\n-#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n-\t\t\t\t  FSYNC_COMPONENT_PACK)\n-\n-#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \\\n-\t\t\t\t\t   FSYNC_COMPONENT_COMMIT_GRAPH)\n-\n-#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \\\n-\t\t\t\t   FSYNC_COMPONENTS_DERIVED_METADATA) & \\\n-\t\t\t\t  ~FSYNC_COMPONENT_LOOSE_OBJECT)\n-\n-#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \\\n-\t\t\t\t    FSYNC_COMPONENT_REFERENCE)\n-\n-#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \\\n-\t\t\t\tFSYNC_COMPONENT_INDEX)\n-\n-#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n-\t\t\t      FSYNC_COMPONENT_PACK | \\\n-\t\t\t      FSYNC_COMPONENT_PACK_METADATA | \\\n-\t\t\t      FSYNC_COMPONENT_COMMIT_GRAPH | \\\n-\t\t\t      FSYNC_COMPONENT_INDEX | \\\n-\t\t\t      FSYNC_COMPONENT_REFERENCE)\n-\n-#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT\n-#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT\n-#endif\n-\n-/*\n- * A bitmask indicating which components of the repo should be fsynced.\n- */\n-extern enum fsync_component fsync_components;\n-extern int fsync_object_files;\n-extern int use_fsync;\n-\n-enum fsync_method {\n-\tFSYNC_METHOD_FSYNC,\n-\tFSYNC_METHOD_WRITEOUT_ONLY,\n-\tFSYNC_METHOD_BATCH,\n-};\n-\n-extern enum fsync_method fsync_method;\n-\n #define MTIME_CHANGED\t0x0001\n #define CTIME_CHANGED\t0x0002\n #define OWNER_CHANGED\t0x0004\n@@ -1045,29 +988,12 @@ int update_server_info(int);\n extern const char *git_mailmap_file;\n extern const char *git_mailmap_blob;\n \n-/* IO helper functions */\n-void maybe_flush_or_die(FILE *, const char *);\n-__attribute__((format (printf, 2, 3)))\n-void fprintf_or_die(FILE *, const char *fmt, ...);\n-void fwrite_or_die(FILE *f, const void *buf, size_t count);\n-void fflush_or_die(FILE *f);\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-void write_or_die(int fd, const void *buf, size_t count);\n-void fsync_or_die(int fd, const char *);\n-int fsync_component(enum fsync_component component, int fd);\n-void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);\n-\n-static inline int batch_fsync_enabled(enum fsync_component component)\n-{\n-\treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n-}\n-\n /* pager.c */\n void setup_pager(void);\n int pager_in_use(void);\ndiff --git a/config.c b/config.c\nindex 03a4fcaba5b..5ad9ae91436 100644\n--- a/config.c\n+++ b/config.c\n@@ -30,6 +30,7 @@\n #include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n struct config_source {\n \tstruct config_source *prev;\ndiff --git a/csum-file.h b/csum-file.h\nindex 793a59da12b..4cd9014e367 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -3,6 +3,7 @@\n \n #include \"cache.h\"\n #include \"hash.h\"\n+#include \"write-or-die.h\"\n \n struct progress;\n \ndiff --git a/diagnose.c b/diagnose.c\nindex 169a55407fd..f9a2496c7ff 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -9,6 +9,7 @@\n #include \"strvec.h\"\n #include \"object-store.h\"\n #include \"packfile.h\"\n+#include \"write-or-die.h\"\n \n struct archive_dir {\n \tconst char *path;\ndiff --git a/environment.c b/environment.c\nindex 649d16ac27c..63c697e7e97 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -25,6 +25,7 @@\n #include \"setup.h\"\n #include \"shallow.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\ndiff --git a/http-backend.c b/http-backend.c\nindex 042ccf12e8c..89aad1b42c7 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -18,6 +18,7 @@\n #include \"protocol.h\"\n #include \"date.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n static const char content_type[] = \"Content-Type\";\n static const char content_length[] = \"Content-Length\";\ndiff --git a/log-tree.c b/log-tree.c\nindex e2bf8d6df75..ba7b885984f 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -23,6 +23,7 @@\n #include \"help.h\"\n #include \"range-diff.h\"\n #include \"strmap.h\"\n+#include \"write-or-die.h\"\n \n static struct decoration name_decoration = { \"object names\" };\n static int decoration_loaded;\ndiff --git a/pkt-line.c b/pkt-line.c\nindex 30469eb4d8d..36ae0fea4a3 100644\n--- a/pkt-line.c\n+++ b/pkt-line.c\n@@ -4,6 +4,7 @@\n #include \"hex.h\"\n #include \"run-command.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n char packet_buffer[LARGE_PACKET_MAX];\n static const char *packet_trace_prefix = \"git\";\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d2b8925ebd0..e6a6971381e 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -17,6 +17,7 @@\n #include \"../setup.h\"\n #include \"../worktree.h\"\n #include \"../wrapper.h\"\n+#include \"../write-or-die.h\"\n \n /*\n  * This backend uses the following flags in `ref_update::flags` for\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 3334c07003c..1eba1015dd5 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 \"../write-or-die.h\"\n \n enum mmap_strategy {\n \t/*\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 260ea200bb0..0f2410da8e7 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -22,6 +22,7 @@\n #include \"protocol.h\"\n #include \"quote.h\"\n #include \"transport.h\"\n+#include \"write-or-die.h\"\n \n static struct remote *remote;\n /* always ends with a trailing slash */\ndiff --git a/send-pack.c b/send-pack.c\nindex f531cb48212..11f41a8d81e 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -16,8 +16,9 @@\n #include \"version.h\"\n #include \"oid-array.h\"\n #include \"gpg-interface.h\"\n-#include \"cache.h\"\n #include \"shallow.h\"\n+#include \"trace2.h\"\n+#include \"write-or-die.h\"\n \n int option_parse_push_signed(const struct option *opt,\n \t\t\t     const char *arg, int unset)\ndiff --git a/sideband.c b/sideband.c\nindex 4905cf9b32a..0af582858bf 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -5,6 +5,7 @@\n #include \"sideband.h\"\n #include \"help.h\"\n #include \"pkt-line.h\"\n+#include \"write-or-die.h\"\n \n struct keyword_entry {\n \t/*\ndiff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c\nindex c5e052e5378..f4d134a1452 100644\n--- a/t/helper/test-pkt-line.c\n+++ b/t/helper/test-pkt-line.c\n@@ -1,6 +1,7 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"test-tool.h\"\n #include \"pkt-line.h\"\n+#include \"write-or-die.h\"\n \n static void pack_line(const char *line)\n {\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 1155f795382..eb3d0b3fa36 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -30,6 +30,7 @@\n #include \"commit-graph.h\"\n #include \"commit-reach.h\"\n #include \"shallow.h\"\n+#include \"write-or-die.h\"\n \n /* Remember to update object flag allocation in object.h */\n #define THEY_HAVE\t(1u << 11)\ndiff --git a/write-or-die.c b/write-or-die.c\nindex a7afc303db2..cc9e0787a1d 100644\n--- a/write-or-die.c\n+++ b/write-or-die.c\n@@ -1,7 +1,8 @@\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n #include \"config.h\"\n #include \"run-command.h\"\n #include \"wrapper.h\"\n+#include \"write-or-die.h\"\n \n /*\n  * Some cases use stdio, but want to flush after the write\ndiff --git a/write-or-die.h b/write-or-die.h\nnew file mode 100644\nindex 00000000000..65a5c42a47a\n--- /dev/null\n+++ b/write-or-die.h\n@@ -0,0 +1,78 @@\n+#ifndef WRITE_OR_DIE_H\n+#define WRITE_OR_DIE_H\n+\n+void maybe_flush_or_die(FILE *, const char *);\n+__attribute__((format (printf, 2, 3)))\n+void fprintf_or_die(FILE *, const char *fmt, ...);\n+void fwrite_or_die(FILE *f, const void *buf, size_t count);\n+void fflush_or_die(FILE *f);\n+void write_or_die(int fd, const void *buf, size_t count);\n+\n+/*\n+ * These values are used to help identify parts of a repository to fsync.\n+ * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the\n+ * repository and so shouldn't be fsynced.\n+ */\n+enum fsync_component {\n+\tFSYNC_COMPONENT_NONE,\n+\tFSYNC_COMPONENT_LOOSE_OBJECT\t\t= 1 << 0,\n+\tFSYNC_COMPONENT_PACK\t\t\t= 1 << 1,\n+\tFSYNC_COMPONENT_PACK_METADATA\t\t= 1 << 2,\n+\tFSYNC_COMPONENT_COMMIT_GRAPH\t\t= 1 << 3,\n+\tFSYNC_COMPONENT_INDEX\t\t\t= 1 << 4,\n+\tFSYNC_COMPONENT_REFERENCE\t\t= 1 << 5,\n+};\n+\n+#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n+\t\t\t\t  FSYNC_COMPONENT_PACK)\n+\n+#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \\\n+\t\t\t\t\t   FSYNC_COMPONENT_COMMIT_GRAPH)\n+\n+#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \\\n+\t\t\t\t   FSYNC_COMPONENTS_DERIVED_METADATA) & \\\n+\t\t\t\t  ~FSYNC_COMPONENT_LOOSE_OBJECT)\n+\n+#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \\\n+\t\t\t\t    FSYNC_COMPONENT_REFERENCE)\n+\n+#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \\\n+\t\t\t\tFSYNC_COMPONENT_INDEX)\n+\n+#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \\\n+\t\t\t      FSYNC_COMPONENT_PACK | \\\n+\t\t\t      FSYNC_COMPONENT_PACK_METADATA | \\\n+\t\t\t      FSYNC_COMPONENT_COMMIT_GRAPH | \\\n+\t\t\t      FSYNC_COMPONENT_INDEX | \\\n+\t\t\t      FSYNC_COMPONENT_REFERENCE)\n+\n+#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT\n+#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT\n+#endif\n+\n+/* IO helper functions */\n+void fsync_or_die(int fd, const char *);\n+int fsync_component(enum fsync_component component, int fd);\n+void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);\n+\n+/*\n+ * A bitmask indicating which components of the repo should be fsynced.\n+ */\n+extern enum fsync_component fsync_components;\n+extern int fsync_object_files;\n+extern int use_fsync;\n+\n+enum fsync_method {\n+\tFSYNC_METHOD_FSYNC,\n+\tFSYNC_METHOD_WRITEOUT_ONLY,\n+\tFSYNC_METHOD_BATCH,\n+};\n+\n+extern enum fsync_method fsync_method;\n+\n+static inline int batch_fsync_enabled(enum fsync_component component)\n+{\n+\treturn (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);\n+}\n+\n+#endif /* WRITE_OR_DIE_H */\n-- \ngitgitgadget\n\n"},{"id":"473837","messageId":"72d58b391a1335315cf62bea4bcd5c7d80f89226.1679379973.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 16/16] csum-file.h: remove unnecessary inclusion of cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:08Z","receivedAt":"2023-03-21T06:27: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\nWith the change in the last commit to move several functions to\nwrite-or-die.h, csum-file.h no longer needs to include cache.h.\nHowever, removing that include forces several other C files, which\ndirectly or indirectly dependend upon csum-file.h's inclusion of\ncache.h, to now be more explicit about their dependencies.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n bulk-checkin.c      | 2 +-\n chunk-format.c      | 1 +\n commit-graph.c      | 2 +-\n csum-file.h         | 1 -\n delta-islands.c     | 2 +-\n fetch-pack.c        | 2 +-\n midx.c              | 2 +-\n object-file.c       | 2 +-\n pack-bitmap-write.c | 3 ++-\n pack-bitmap.c       | 2 +-\n pack.h              | 2 ++\n packfile.c          | 2 +-\n 12 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/bulk-checkin.c b/bulk-checkin.c\nindex eb6d7a2805b..d2428b86111 100644\n--- a/bulk-checkin.c\n+++ b/bulk-checkin.c\n@@ -1,7 +1,7 @@\n /*\n  * Copyright (c) 2011, Google Inc.\n  */\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"bulk-checkin.h\"\n #include \"environment.h\"\ndiff --git a/chunk-format.c b/chunk-format.c\nindex 6d1071729df..60a73c1b140 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 \"trace2.h\"\n \n /*\n  * When writing a chunk-based file format, collect the chunks in\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 5481736c76c..f0cd2e7a2a3 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\ndiff --git a/csum-file.h b/csum-file.h\nindex 4cd9014e367..566e05cbd25 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -1,7 +1,6 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n-#include \"cache.h\"\n #include \"hash.h\"\n #include \"write-or-die.h\"\n \ndiff --git a/delta-islands.c b/delta-islands.c\nindex 1222b6a6cd1..73a01179e83 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"attr.h\"\n #include \"object.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex c453a4168f9..10f759532ce 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"repository.h\"\n #include \"config.h\"\ndiff --git a/midx.c b/midx.c\nindex b111665dcab..9af3e5de889 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/object-file.c b/object-file.c\nindex 05fff230f73..397596e3c8f 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 \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"abspath.h\"\n #include \"alloc.h\"\n #include \"config.h\"\ndiff --git a/pack-bitmap-write.c b/pack-bitmap-write.c\nindex 63f16080c9b..0fddeb1298b 100644\n--- a/pack-bitmap-write.c\n+++ b/pack-bitmap-write.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n@@ -17,6 +17,7 @@\n #include \"pack-objects.h\"\n #include \"commit-reach.h\"\n #include \"prio-queue.h\"\n+#include \"trace2.h\"\n \n struct bitmapped_commit {\n \tstruct commit *commit;\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex 241ac9166c1..23d87e71bd9 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"commit.h\"\n #include \"gettext.h\"\ndiff --git a/pack.h b/pack.h\nindex 01d385903ad..3ab9e3f60c0 100644\n--- a/pack.h\n+++ b/pack.h\n@@ -4,6 +4,8 @@\n #include \"object.h\"\n #include \"csum-file.h\"\n \n+struct packed_git;\n+struct pack_window;\n struct repository;\n \n /*\ndiff --git a/packfile.c b/packfile.c\nindex 4b5b841d046..61672d50bdf 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,4 +1,4 @@\n-#include \"git-compat-util.h\"\n+#include \"cache.h\"\n #include \"alloc.h\"\n #include \"environment.h\"\n #include \"gettext.h\"\n-- \ngitgitgadget\n"},{"id":"473838","messageId":"1d5cd11516148c587ef9ea814c0d4c484ddb7261.1679379972.git.gitgitgadget@gmail.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"[PATCH v2 13/16] setup.h: move declarations for setup.c functions from cache.h","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-03-21T06:26:05Z","receivedAt":"2023-03-21T06:27: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 apply.c                                      |   1 +\n archive.c                                    |   1 +\n attr.c                                       |   1 +\n blame.c                                      |   1 +\n builtin/blame.c                              |   1 +\n builtin/bugreport.c                          |   1 +\n builtin/bundle.c                             |   1 +\n builtin/check-attr.c                         |   1 +\n builtin/check-ref-format.c                   |   1 +\n builtin/checkout-index.c                     |   1 +\n builtin/checkout.c                           |   1 +\n builtin/clean.c                              |   1 +\n builtin/clone.c                              |   1 +\n builtin/config.c                             |   1 +\n builtin/describe.c                           |   1 +\n builtin/diff-index.c                         |   1 +\n builtin/diff.c                               |   1 +\n builtin/difftool.c                           |   1 +\n builtin/gc.c                                 |   1 +\n builtin/grep.c                               |   1 +\n builtin/hash-object.c                        |   1 +\n builtin/help.c                               |   1 +\n builtin/index-pack.c                         |   1 +\n builtin/init-db.c                            |   1 +\n builtin/ls-files.c                           |   1 +\n builtin/merge-file.c                         |   1 +\n builtin/mv.c                                 |   1 +\n builtin/read-tree.c                          |   1 +\n builtin/reset.c                              |   1 +\n builtin/rev-parse.c                          |   1 +\n builtin/rm.c                                 |   1 +\n builtin/shortlog.c                           |   1 +\n builtin/sparse-checkout.c                    |   1 +\n builtin/stash.c                              |   1 +\n builtin/stripspace.c                         |   1 +\n builtin/submodule--helper.c                  |   1 +\n builtin/update-index.c                       |   1 +\n cache.h                                      | 163 ------------------\n commit.c                                     |   1 +\n common-main.c                                |   1 +\n config.c                                     |   1 +\n daemon.c                                     |   1 +\n diff.c                                       |   1 +\n dir.c                                        |   1 +\n environment.c                                |   1 +\n git.c                                        |   1 +\n http-fetch.c                                 |   1 +\n http-push.c                                  |   1 +\n imap-send.c                                  |   1 +\n line-log.c                                   |   1 +\n mailmap.c                                    |   1 +\n object-file.c                                |   1 +\n object-name.c                                |   1 +\n path.c                                       |   1 +\n pathspec.c                                   |   1 +\n refs.c                                       |   1 +\n refs/files-backend.c                         |   1 +\n remote-curl.c                                |   1 +\n remote.c                                     |   1 +\n repository.c                                 |   1 +\n revision.c                                   |   1 +\n scalar.c                                     |   1 +\n setup.c                                      |   1 +\n setup.h                                      | 168 +++++++++++++++++++\n submodule.c                                  |   1 +\n symlinks.c                                   |   1 +\n t/helper/test-advise.c                       |   1 +\n t/helper/test-bitmap.c                       |   1 +\n t/helper/test-bloom.c                        |   1 +\n t/helper/test-cache-tree.c                   |   1 +\n t/helper/test-config.c                       |   1 +\n t/helper/test-dump-cache-tree.c              |   2 +-\n t/helper/test-dump-fsmonitor.c               |   1 +\n t/helper/test-dump-split-index.c             |   1 +\n t/helper/test-dump-untracked-cache.c         |   1 +\n t/helper/test-fast-rebase.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-oid-array.c                    |   1 +\n t/helper/test-oidmap.c                       |   1 +\n t/helper/test-oidtree.c                      |   1 +\n t/helper/test-pack-mtimes.c                  |   1 +\n t/helper/test-partial-clone.c                |   1 +\n t/helper/test-path-utils.c                   |   1 +\n t/helper/test-proc-receive.c                 |   1 +\n t/helper/test-reach.c                        |   1 +\n t/helper/test-read-cache.c                   |   1 +\n t/helper/test-read-graph.c                   |   1 +\n t/helper/test-read-midx.c                    |   1 +\n t/helper/test-ref-store.c                    |   1 +\n t/helper/test-repository.c                   |   1 +\n t/helper/test-revision-walking.c             |   1 +\n t/helper/test-scrap-cache-tree.c             |   1 +\n t/helper/test-serve-v2.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-subprocess.c                   |   1 +\n t/helper/test-userdiff.c                     |   1 +\n t/helper/test-write-cache.c                  |   1 +\n trace.c                                      |   1 +\n unpack-trees.c                               |   1 +\n worktree.c                                   |   1 +\n wt-status.c                                  |   1 +\n 105 files changed, 271 insertions(+), 164 deletions(-)\n create mode 100644 setup.h\n\ndiff --git a/apply.c b/apply.c\nindex a7c0bccb15c..caa2e0a3bc6 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -27,6 +27,7 @@\n #include \"rerere.h\"\n #include \"apply.h\"\n #include \"entry.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n struct gitdiff_data {\ndiff --git a/archive.c b/archive.c\nindex 7aeaaf368f4..cdce5b783a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -5,6 +5,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"refs.h\"\n #include \"object-store.h\"\n #include \"commit.h\"\ndiff --git a/attr.c b/attr.c\nindex 62127196cb1..2d8aeb8b58c 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -18,6 +18,7 @@\n #include \"quote.h\"\n #include \"revision.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n #include \"thread-utils.h\"\n \n const char git_attr__true[] = \"(builtin)true\";\ndiff --git a/blame.c b/blame.c\nindex b7cd849bb6b..838eb128f01 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -7,6 +7,7 @@\n #include \"diffcore.h\"\n #include \"gettext.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"tag.h\"\n #include \"blame.h\"\n #include \"alloc.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 9ec82edcbde..fb271bae70e 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -31,6 +31,7 @@\n #include \"object-store.h\"\n #include \"blame.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"tag.h\"\n \n static char blame_usage[] = N_(\"git blame [<options>] [<rev-opts>] [<rev>] [--] <file>\");\ndiff --git a/builtin/bugreport.c b/builtin/bugreport.c\nindex 160590e4ef6..52955e1d389 100644\n--- a/builtin/bugreport.c\n+++ b/builtin/bugreport.c\n@@ -8,6 +8,7 @@\n #include \"hook.h\"\n #include \"hook-list.h\"\n #include \"diagnose.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static void get_system_info(struct strbuf *sys_info)\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex 9e2aecadf7d..e68fc83d943 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -1,6 +1,7 @@\n #include \"builtin.h\"\n #include \"abspath.h\"\n #include \"gettext.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 5870c4683ab..ec37b8164af 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -6,6 +6,7 @@\n #include \"environment.h\"\n #include \"gettext.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"parse-options.h\"\n \n static int all_attrs;\ndiff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c\nindex fd0e5f86832..b0263467424 100644\n--- a/builtin/check-ref-format.c\n+++ b/builtin/check-ref-format.c\n@@ -5,6 +5,7 @@\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n static const char builtin_check_ref_format_usage[] =\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 828c0363f8a..7df673e3e70 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -15,6 +15,7 @@\n #include \"parse-options.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"setup.h\"\n \n #define CHECKOUT_ALL 4\n static int nul_term_line;\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 5541e76c337..73b6e581f39 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -23,6 +23,7 @@\n #include \"resolve-undo.h\"\n #include \"revision.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"tree.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex fdcf62c5dfe..14c0d555eac 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 \"setup.h\"\n #include \"string-list.h\"\n #include \"quote.h\"\n #include \"column.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 15dc15408ed..34f46965b95 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -33,6 +33,7 @@\n #include \"branch.h\"\n #include \"remote.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"connected.h\"\n #include \"packfile.h\"\n #include \"list-objects-filter-options.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex cf994a216c0..fe79fb60c43 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -9,6 +9,7 @@\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 27c6670e934..43b62348bc7 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -15,6 +15,7 @@\n #include \"revision.h\"\n #include \"diff.h\"\n #include \"hashmap.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"run-command.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 35dc9b23eef..b9a19bb7d38 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -5,6 +5,7 @@\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n \n static const char diff_cache_usage[] =\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 20bdb6e6cec..3945683bfe4 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -19,6 +19,7 @@\n #include \"revision.h\"\n #include \"log-tree.h\"\n #include \"builtin.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"oid-array.h\"\n \ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex 3613de6389f..176437d6da3 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -28,6 +28,7 @@\n #include \"object-store.h\"\n #include \"dir.h\"\n #include \"entry.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static int trust_exit_code;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 525c5de5b27..a85f9e3ed3d 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -36,6 +36,7 @@\n #include \"exec-cmd.h\"\n #include \"gettext.h\"\n #include \"hook.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n #define FAILED_RUN \"failed to run %s\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 3c9c6b38031..b8ebf014f40 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -23,6 +23,7 @@\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"pathspec.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"object-store.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex 7651a7a5f56..a2e160db026 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -14,6 +14,7 @@\n #include \"quote.h\"\n #include \"parse-options.h\"\n #include \"exec-cmd.h\"\n+#include \"setup.h\"\n \n /*\n  * This is to create corrupt objects for debugging and as such it\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 3fde5c4fd35..87333a02ec4 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -11,6 +11,7 @@\n #include \"config-list.h\"\n #include \"help.h\"\n #include \"alias.h\"\n+#include \"setup.h\"\n \n #ifndef DEFAULT_HELP_FORMAT\n #define DEFAULT_HELP_FORMAT \"man\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex fdce8f88724..823dc5aefb5 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -20,6 +20,7 @@\n #include \"object-store.h\"\n #include \"replace-object.h\"\n #include \"promisor-remote.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n static const char index_pack_usage[] =\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 2ebc9023f56..ba6e0b20fa5 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -12,6 +12,7 @@\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 09deb752ab3..4a8de95ddc4 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -20,6 +20,7 @@\n #include \"string-list.h\"\n #include \"pathspec.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex c0096ee0810..781818d08f5 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"gettext.h\"\n+#include \"setup.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex c2dd42efbf2..b7c5ffbd8c7 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -16,6 +16,7 @@\n #include \"cache-tree.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"entry.h\"\n \ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex ec66008d07e..5f24453dcd7 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -19,6 +19,7 @@\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"resolve-undo.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n \ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex b5dfce1159e..af2afc2c982 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -26,6 +26,7 @@\n #include \"parse-options.h\"\n #include \"unpack-trees.h\"\n #include \"cache-tree.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"dir.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex bba49d56b9f..3a5a2ee5b2d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -18,6 +18,7 @@\n #include \"parse-options.h\"\n #include \"diff.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"submodule.h\"\n #include \"commit-reach.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 5982c3d8122..97775e4c4d0 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -15,6 +15,7 @@\n #include \"tree-walk.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"pathspec.h\"\n \ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 31f81c25ea2..59d9c440fb5 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -9,6 +9,7 @@\n #include \"revision.h\"\n #include \"utf8.h\"\n #include \"mailmap.h\"\n+#include \"setup.h\"\n #include \"shortlog.h\"\n #include \"parse-options.h\"\n #include \"trailer.h\"\ndiff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c\nindex f6a120c7c45..512df0f8f54 100644\n--- a/builtin/sparse-checkout.c\n+++ b/builtin/sparse-checkout.c\n@@ -16,6 +16,7 @@\n #include \"unpack-trees.h\"\n #include \"wt-status.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"sparse-index.h\"\n #include \"worktree.h\"\n \ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex 94f81d75d03..30d547fff1f 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -18,6 +18,7 @@\n #include \"entry.h\"\n #include \"rerere.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n #include \"log-tree.h\"\n #include \"diffcore.h\"\n #include \"exec-cmd.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex d8e61459333..53930458ffa 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -3,6 +3,7 @@\n #include \"config.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n static void comment_lines(struct strbuf *buf)\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 2bf2a1a8be5..3cb4a3ce217 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -12,6 +12,7 @@\n #include \"quote.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"submodule-config.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 4642afaeb77..f97f8d4c9d5 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -20,6 +20,7 @@\n #include \"parse-options.h\"\n #include \"pathspec.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"fsmonitor.h\"\n \ndiff --git a/cache.h b/cache.h\nindex 720c88f9fd6..bffedd240e7 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -452,67 +452,6 @@ static inline enum object_type object_type(unsigned int mode)\n \t\tOBJ_BLOB;\n }\n \n-int is_inside_git_dir(void);\n-int is_inside_work_tree(void);\n-int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n-int get_common_dir(struct strbuf *sb, const char *gitdir);\n-\n-/*\n- * Return true if the given path is a git directory; note that this _just_\n- * looks at the directory itself. If you want to know whether \"foo/.git\"\n- * is a repository, you must feed that path, not just \"foo\".\n- */\n-int is_git_directory(const char *path);\n-\n-/*\n- * Return 1 if the given path is the root of a git repository or\n- * submodule, else 0. Will not return 1 for bare repositories with the\n- * exception of creating a bare repository in \"foo/.git\" and calling\n- * is_git_repository(\"foo\").\n- *\n- * If we run into read errors, we err on the side of saying \"yes, it is\",\n- * as we usually consider sub-repos precious, and would prefer to err on the\n- * side of not disrupting or deleting them.\n- */\n-int is_nonbare_repository_dir(struct strbuf *path);\n-\n-#define READ_GITFILE_ERR_STAT_FAILED 1\n-#define READ_GITFILE_ERR_NOT_A_FILE 2\n-#define READ_GITFILE_ERR_OPEN_FAILED 3\n-#define READ_GITFILE_ERR_READ_FAILED 4\n-#define READ_GITFILE_ERR_INVALID_FORMAT 5\n-#define READ_GITFILE_ERR_NO_PATH 6\n-#define READ_GITFILE_ERR_NOT_A_REPO 7\n-#define READ_GITFILE_ERR_TOO_LARGE 8\n-void read_gitfile_error_die(int error_code, const char *path, const char *dir);\n-const char *read_gitfile_gently(const char *path, int *return_error_code);\n-#define read_gitfile(path) read_gitfile_gently((path), NULL)\n-const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n-#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n-\n-void setup_work_tree(void);\n-/*\n- * Find the commondir and gitdir of the repository that contains the current\n- * working directory, without changing the working directory or other global\n- * state. The result is appended to commondir and gitdir.  If the discovered\n- * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will\n- * both have the same result appended to the buffer.  The return value is\n- * either 0 upon success and non-zero if no repository was found.\n- */\n-int discover_git_directory(struct strbuf *commondir,\n-\t\t\t   struct strbuf *gitdir);\n-const char *setup_git_directory_gently(int *);\n-const char *setup_git_directory(void);\n-char *prefix_path(const char *prefix, int len, const char *path);\n-char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n-\n-int check_filename(const char *prefix, const char *name);\n-void verify_filename(const char *prefix,\n-\t\t     const char *name,\n-\t\t     int diagnose_misspelt_rev);\n-void verify_non_filename(const char *prefix, const char *name);\n-int path_inside_repo(const char *prefix, const char *path);\n-\n #define INIT_DB_QUIET 0x0001\n #define INIT_DB_EXIST_OK 0x0002\n \n@@ -521,9 +460,6 @@ int init_db(const char *git_dir, const char *real_git_dir,\n \t    const char *initial_branch, unsigned int flags);\n void initialize_repository_version(int hash_algo, int reinit);\n \n-void sanitize_stdfds(void);\n-int daemonize(void);\n-\n /* Initialize and use the cache information */\n struct lock_file;\n void preload_index(struct index_state *index,\n@@ -807,79 +743,6 @@ enum fsync_method {\n \n extern enum fsync_method fsync_method;\n \n-/*\n- * GIT_REPO_VERSION is the version we write by default. The\n- * _READ variant is the highest number we know how to\n- * handle.\n- */\n-#define GIT_REPO_VERSION 0\n-#define GIT_REPO_VERSION_READ 1\n-\n-/*\n- * You _have_ to initialize a `struct repository_format` using\n- * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.\n- */\n-struct repository_format {\n-\tint version;\n-\tint precious_objects;\n-\tchar *partial_clone; /* value of extensions.partialclone */\n-\tint worktree_config;\n-\tint is_bare;\n-\tint hash_algo;\n-\tint sparse_index;\n-\tchar *work_tree;\n-\tstruct string_list unknown_extensions;\n-\tstruct string_list v1_only_extensions;\n-};\n-\n-/*\n- * Always use this to initialize a `struct repository_format`\n- * to a well-defined, default state before calling\n- * `read_repository()`.\n- */\n-#define REPOSITORY_FORMAT_INIT \\\n-{ \\\n-\t.version = -1, \\\n-\t.is_bare = -1, \\\n-\t.hash_algo = GIT_HASH_SHA1, \\\n-\t.unknown_extensions = STRING_LIST_INIT_DUP, \\\n-\t.v1_only_extensions = STRING_LIST_INIT_DUP, \\\n-}\n-\n-/*\n- * Read the repository format characteristics from the config file \"path\" into\n- * \"format\" struct. Returns the numeric version. On error, or if no version is\n- * found in the configuration, -1 is returned, format->version is set to -1,\n- * and all other fields in the struct are set to the default configuration\n- * (REPOSITORY_FORMAT_INIT). Always initialize the struct using\n- * REPOSITORY_FORMAT_INIT before calling this function.\n- */\n-int read_repository_format(struct repository_format *format, const char *path);\n-\n-/*\n- * Free the memory held onto by `format`, but not the struct itself.\n- * (No need to use this after `read_repository_format()` fails.)\n- */\n-void clear_repository_format(struct repository_format *format);\n-\n-/*\n- * Verify that the repository described by repository_format is something we\n- * can read. If it is, return 0. Otherwise, return -1, and \"err\" will describe\n- * any errors encountered.\n- */\n-int verify_repository_format(const struct repository_format *format,\n-\t\t\t     struct strbuf *err);\n-\n-/*\n- * Check the repository format version in the path found in get_git_dir(),\n- * and die if it is a version we don't understand. Generally one would\n- * set_git_dir() before calling this, and use it only for \"are we in a valid\n- * repo?\".\n- *\n- * If successful and fmt is not NULL, fill fmt with data.\n- */\n-void check_repository_format(struct repository_format *fmt);\n-\n #define MTIME_CHANGED\t0x0001\n #define CTIME_CHANGED\t0x0002\n #define OWNER_CHANGED\t0x0004\n@@ -908,23 +771,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id\n int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);\n #define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)\n \n-/*\n- * NOTE NOTE NOTE!!\n- *\n- * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must\n- * not be changed. Old repositories have core.sharedrepository written in\n- * numeric format, and therefore these values are preserved for compatibility\n- * reasons.\n- */\n-enum sharedrepo {\n-\tPERM_UMASK          = 0,\n-\tOLD_PERM_GROUP      = 1,\n-\tOLD_PERM_EVERYBODY  = 2,\n-\tPERM_GROUP          = 0660,\n-\tPERM_EVERYBODY      = 0664\n-};\n-int git_config_perm(const char *var, const char *value);\n-\n /*\n  * Create the directory containing the named path, using care to be\n  * somewhat safe against races. Return one of the scld_error values to\n@@ -1283,15 +1129,6 @@ int ws_blank_line(const char *line, int len);\n void overlay_tree_on_index(struct index_state *istate,\n \t\t\t   const char *tree_name, const char *prefix);\n \n-/* setup.c */\n-struct startup_info {\n-\tint have_repository;\n-\tconst char *prefix;\n-\tconst char *original_cwd;\n-};\n-extern struct startup_info *startup_info;\n-extern const char *tmp_original_cwd;\n-\n /* merge.c */\n struct commit_list;\n int try_merge_command(struct repository *r,\ndiff --git a/commit.c b/commit.c\nindex f88fc5e1a2c..3868f047f1b 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -23,6 +23,7 @@\n #include \"refs.h\"\n #include \"commit-reach.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n #include \"hook.h\"\n \ndiff --git a/common-main.c b/common-main.c\nindex 184d1534d2d..b83cb5cf066 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 \"setup.h\"\n \n /*\n  * Many parts of Git have subprograms communicate via pipe, expect the\ndiff --git a/config.c b/config.c\nindex 5b1a5d52052..03a4fcaba5b 100644\n--- a/config.c\n+++ b/config.c\n@@ -27,6 +27,7 @@\n #include \"color.h\"\n #include \"replace-object.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"wrapper.h\"\n \ndiff --git a/daemon.c b/daemon.c\nindex b56a8f9717d..db8a31a6ea2 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -5,6 +5,7 @@\n #include \"environment.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"string-list.h\"\n #include \"wrapper.h\"\ndiff --git a/diff.c b/diff.c\nindex dcf1a940942..b858e59c5ae 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -33,6 +33,7 @@\n #include \"help.h\"\n #include \"promisor-remote.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"strmap.h\"\n #include \"wrapper.h\"\n \ndiff --git a/dir.c b/dir.c\nindex 06f8aa3c01b..4cc2b1ead47 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -21,6 +21,7 @@\n #include \"varint.h\"\n #include \"ewah/ewok.h\"\n #include \"fsmonitor.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"wrapper.h\"\n \ndiff --git a/environment.c b/environment.c\nindex bf02f3cf487..649d16ac27c 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -22,6 +22,7 @@\n #include \"replace-object.h\"\n #include \"tmp-objdir.h\"\n #include \"chdir-notify.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n #include \"wrapper.h\"\n \ndiff --git a/git.c b/git.c\nindex b24c105e83f..77f920a6f6f 100644\n--- a/git.c\n+++ b/git.c\n@@ -7,6 +7,7 @@\n #include \"run-command.h\"\n #include \"alias.h\"\n #include \"replace-object.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n \n #define RUN_SETUP\t\t(1<<0)\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 454933351b2..c874d3402dd 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -5,6 +5,7 @@\n #include \"hex.h\"\n #include \"http.h\"\n #include \"walker.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"urlmatch.h\"\n #include \"trace2.h\"\ndiff --git a/http-push.c b/http-push.c\nindex 40373bc4863..e73864b51f5 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -12,6 +12,7 @@\n #include \"exec-cmd.h\"\n #include \"remote.h\"\n #include \"list-objects.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"strvec.h\"\n #include \"packfile.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex aa5b2f252d2..a62424e90a4 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,6 +28,7 @@\n #include \"gettext.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)\n typedef void *SSL;\ndiff --git a/line-log.c b/line-log.c\nindex 6e7fc4b2e0b..84c8093c517 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -16,6 +16,7 @@\n #include \"graph.h\"\n #include \"userdiff.h\"\n #include \"line-log.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"bloom.h\"\n \ndiff --git a/mailmap.c b/mailmap.c\nindex 2c6e9b238dd..c24a16eaf48 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -3,6 +3,7 @@\n #include \"string-list.h\"\n #include \"mailmap.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n \n #define DEBUG_MAILMAP 0\n #if DEBUG_MAILMAP\ndiff --git a/object-file.c b/object-file.c\nindex 3da6cd68861..05fff230f73 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -37,6 +37,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"promisor-remote.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"fsck.h\"\n #include \"wrapper.h\"\ndiff --git a/object-name.c b/object-name.c\nindex 3b0ce8ef05a..ce973e01505 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -15,6 +15,7 @@\n #include \"packfile.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"submodule.h\"\n #include \"midx.h\"\n #include \"commit-reach.h\"\ndiff --git a/path.c b/path.c\nindex 5d5a15c13d6..a1702434979 100644\n--- a/path.c\n+++ b/path.c\n@@ -11,6 +11,7 @@\n #include \"string-list.h\"\n #include \"dir.h\"\n #include \"worktree.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"path.h\"\n #include \"packfile.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 5fb7b5f26c9..6972d515f0c 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 \"setup.h\"\n #include \"strvec.h\"\n #include \"quote.h\"\n \ndiff --git a/refs.c b/refs.c\nindex 04520e5a6b8..21b317e8153 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -22,6 +22,7 @@\n #include \"worktree.h\"\n #include \"strvec.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"date.h\"\n #include \"commit.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 0c3138ede8f..d2b8925ebd0 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -14,6 +14,7 @@\n #include \"../object.h\"\n #include \"../dir.h\"\n #include \"../chdir-notify.h\"\n+#include \"../setup.h\"\n #include \"../worktree.h\"\n #include \"../wrapper.h\"\n \ndiff --git a/remote-curl.c b/remote-curl.c\nindex eb382a1e35d..260ea200bb0 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -18,6 +18,7 @@\n #include \"credential.h\"\n #include \"oid-array.h\"\n #include \"send-pack.h\"\n+#include \"setup.h\"\n #include \"protocol.h\"\n #include \"quote.h\"\n #include \"transport.h\"\ndiff --git a/remote.c b/remote.c\nindex aeca3ff8136..c29e2f52981 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -15,6 +15,7 @@\n #include \"revision.h\"\n #include \"dir.h\"\n #include \"tag.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"strvec.h\"\n #include \"commit-reach.h\"\ndiff --git a/repository.c b/repository.c\nindex 4412f633224..f6d9f5db08e 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -11,6 +11,7 @@\n #include \"object.h\"\n #include \"lockfile.h\"\n #include \"remote.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"sparse-index.h\"\n #include \"promisor-remote.h\"\ndiff --git a/revision.c b/revision.c\nindex 53fdeef0787..f98691a3531 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -29,6 +29,7 @@\n #include \"bisect.h\"\n #include \"packfile.h\"\n #include \"worktree.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"commit-reach.h\"\n #include \"commit-graph.h\"\ndiff --git a/scalar.c b/scalar.c\nindex fe61a3ebdd7..27635658c01 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -15,6 +15,7 @@\n #include \"dir.h\"\n #include \"packfile.h\"\n #include \"help.h\"\n+#include \"setup.h\"\n \n static void setup_enlistment_directory(int argc, const char **argv,\n \t\t\t\t       const char * const *usagestr,\ndiff --git a/setup.c b/setup.c\nindex cfdc849a78c..6c5b85e96c1 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -5,6 +5,7 @@\n #include \"repository.h\"\n #include \"config.h\"\n #include \"dir.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"chdir-notify.h\"\n #include \"promisor-remote.h\"\ndiff --git a/setup.h b/setup.h\nnew file mode 100644\nindex 00000000000..4c1ca9d0c94\n--- /dev/null\n+++ b/setup.h\n@@ -0,0 +1,168 @@\n+#ifndef SETUP_H\n+#define SETUP_H\n+\n+#include \"string-list.h\"\n+\n+int is_inside_git_dir(void);\n+int is_inside_work_tree(void);\n+int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);\n+int get_common_dir(struct strbuf *sb, const char *gitdir);\n+\n+/*\n+ * Return true if the given path is a git directory; note that this _just_\n+ * looks at the directory itself. If you want to know whether \"foo/.git\"\n+ * is a repository, you must feed that path, not just \"foo\".\n+ */\n+int is_git_directory(const char *path);\n+\n+/*\n+ * Return 1 if the given path is the root of a git repository or\n+ * submodule, else 0. Will not return 1 for bare repositories with the\n+ * exception of creating a bare repository in \"foo/.git\" and calling\n+ * is_git_repository(\"foo\").\n+ *\n+ * If we run into read errors, we err on the side of saying \"yes, it is\",\n+ * as we usually consider sub-repos precious, and would prefer to err on the\n+ * side of not disrupting or deleting them.\n+ */\n+int is_nonbare_repository_dir(struct strbuf *path);\n+\n+#define READ_GITFILE_ERR_STAT_FAILED 1\n+#define READ_GITFILE_ERR_NOT_A_FILE 2\n+#define READ_GITFILE_ERR_OPEN_FAILED 3\n+#define READ_GITFILE_ERR_READ_FAILED 4\n+#define READ_GITFILE_ERR_INVALID_FORMAT 5\n+#define READ_GITFILE_ERR_NO_PATH 6\n+#define READ_GITFILE_ERR_NOT_A_REPO 7\n+#define READ_GITFILE_ERR_TOO_LARGE 8\n+void read_gitfile_error_die(int error_code, const char *path, const char *dir);\n+const char *read_gitfile_gently(const char *path, int *return_error_code);\n+#define read_gitfile(path) read_gitfile_gently((path), NULL)\n+const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);\n+#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)\n+\n+void setup_work_tree(void);\n+/*\n+ * Find the commondir and gitdir of the repository that contains the current\n+ * working directory, without changing the working directory or other global\n+ * state. The result is appended to commondir and gitdir.  If the discovered\n+ * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will\n+ * both have the same result appended to the buffer.  The return value is\n+ * either 0 upon success and non-zero if no repository was found.\n+ */\n+int discover_git_directory(struct strbuf *commondir,\n+\t\t\t   struct strbuf *gitdir);\n+const char *setup_git_directory_gently(int *);\n+const char *setup_git_directory(void);\n+char *prefix_path(const char *prefix, int len, const char *path);\n+char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);\n+\n+int check_filename(const char *prefix, const char *name);\n+void verify_filename(const char *prefix,\n+\t\t     const char *name,\n+\t\t     int diagnose_misspelt_rev);\n+void verify_non_filename(const char *prefix, const char *name);\n+int path_inside_repo(const char *prefix, const char *path);\n+\n+void sanitize_stdfds(void);\n+int daemonize(void);\n+\n+/*\n+ * GIT_REPO_VERSION is the version we write by default. The\n+ * _READ variant is the highest number we know how to\n+ * handle.\n+ */\n+#define GIT_REPO_VERSION 0\n+#define GIT_REPO_VERSION_READ 1\n+\n+/*\n+ * You _have_ to initialize a `struct repository_format` using\n+ * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.\n+ */\n+struct repository_format {\n+\tint version;\n+\tint precious_objects;\n+\tchar *partial_clone; /* value of extensions.partialclone */\n+\tint worktree_config;\n+\tint is_bare;\n+\tint hash_algo;\n+\tint sparse_index;\n+\tchar *work_tree;\n+\tstruct string_list unknown_extensions;\n+\tstruct string_list v1_only_extensions;\n+};\n+\n+/*\n+ * Always use this to initialize a `struct repository_format`\n+ * to a well-defined, default state before calling\n+ * `read_repository()`.\n+ */\n+#define REPOSITORY_FORMAT_INIT \\\n+{ \\\n+\t.version = -1, \\\n+\t.is_bare = -1, \\\n+\t.hash_algo = GIT_HASH_SHA1, \\\n+\t.unknown_extensions = STRING_LIST_INIT_DUP, \\\n+\t.v1_only_extensions = STRING_LIST_INIT_DUP, \\\n+}\n+\n+/*\n+ * Read the repository format characteristics from the config file \"path\" into\n+ * \"format\" struct. Returns the numeric version. On error, or if no version is\n+ * found in the configuration, -1 is returned, format->version is set to -1,\n+ * and all other fields in the struct are set to the default configuration\n+ * (REPOSITORY_FORMAT_INIT). Always initialize the struct using\n+ * REPOSITORY_FORMAT_INIT before calling this function.\n+ */\n+int read_repository_format(struct repository_format *format, const char *path);\n+\n+/*\n+ * Free the memory held onto by `format`, but not the struct itself.\n+ * (No need to use this after `read_repository_format()` fails.)\n+ */\n+void clear_repository_format(struct repository_format *format);\n+\n+/*\n+ * Verify that the repository described by repository_format is something we\n+ * can read. If it is, return 0. Otherwise, return -1, and \"err\" will describe\n+ * any errors encountered.\n+ */\n+int verify_repository_format(const struct repository_format *format,\n+\t\t\t     struct strbuf *err);\n+\n+/*\n+ * Check the repository format version in the path found in get_git_dir(),\n+ * and die if it is a version we don't understand. Generally one would\n+ * set_git_dir() before calling this, and use it only for \"are we in a valid\n+ * repo?\".\n+ *\n+ * If successful and fmt is not NULL, fill fmt with data.\n+ */\n+void check_repository_format(struct repository_format *fmt);\n+\n+/*\n+ * NOTE NOTE NOTE!!\n+ *\n+ * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must\n+ * not be changed. Old repositories have core.sharedrepository written in\n+ * numeric format, and therefore these values are preserved for compatibility\n+ * reasons.\n+ */\n+enum sharedrepo {\n+\tPERM_UMASK          = 0,\n+\tOLD_PERM_GROUP      = 1,\n+\tOLD_PERM_EVERYBODY  = 2,\n+\tPERM_GROUP          = 0660,\n+\tPERM_EVERYBODY      = 0664\n+};\n+int git_config_perm(const char *var, const char *value);\n+\n+struct startup_info {\n+\tint have_repository;\n+\tconst char *prefix;\n+\tconst char *original_cwd;\n+};\n+extern struct startup_info *startup_info;\n+extern const char *tmp_original_cwd;\n+\n+#endif /* SETUP_H */\ndiff --git a/submodule.c b/submodule.c\nindex acf030b95e4..75e0d45cbcb 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -26,6 +26,7 @@\n #include \"parse-options.h\"\n #include \"object-store.h\"\n #include \"commit-reach.h\"\n+#include \"setup.h\"\n #include \"shallow.h\"\n \n static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;\ndiff --git a/symlinks.c b/symlinks.c\nindex c35c8d4408d..27ecc93693b 100644\n--- a/symlinks.c\n+++ b/symlinks.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"gettext.h\"\n+#include \"setup.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/t/helper/test-advise.c b/t/helper/test-advise.c\nindex cb881139f73..4e6ed30afa1 100644\n--- a/t/helper/test-advise.c\n+++ b/t/helper/test-advise.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"advice.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n \n int cmd__advise_if_enabled(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c\nindex 5bb489882da..af43ee1cb5e 100644\n--- a/t/helper/test-bitmap.c\n+++ b/t/helper/test-bitmap.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"git-compat-util.h\"\n #include \"pack-bitmap.h\"\n+#include \"setup.h\"\n \n static int bitmap_list_commits(void)\n {\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex 127f134a2a6..e5754b8da62 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"test-tool.h\"\n #include \"commit.h\"\n+#include \"setup.h\"\n \n static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\n \ndiff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c\nindex 8b7a8fce1ee..cdaf5046f5a 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 \"setup.h\"\n \n static char const * const test_cache_tree_usage[] = {\n \tN_(\"test-tool cache-tree <options> (control|prime|update)\"),\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 4ba9eb65606..5877188f3ad 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c\nindex 92dfc1aa8c4..715aabfbae7 100644\n--- a/t/helper/test-dump-cache-tree.c\n+++ b/t/helper/test-dump-cache-tree.c\n@@ -4,7 +4,7 @@\n #include \"hex.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n-\n+#include \"setup.h\"\n \n static void dump_one(struct cache_tree *it, const char *pfx, const char *x)\n {\ndiff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c\nindex 975f0ac8905..7e9de296db3 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 \"setup.h\"\n \n int cmd__dump_fsmonitor(int ac, const char **av)\n {\ndiff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c\nindex 813d0a38fae..289a01c10ac 100644\n--- a/t/helper/test-dump-split-index.c\n+++ b/t/helper/test-dump-split-index.c\n@@ -2,6 +2,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"hex.h\"\n+#include \"setup.h\"\n #include \"split-index.h\"\n #include \"ewah/ewok.h\"\n \ndiff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c\nindex af953fabe87..415f55f31da 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 \"setup.h\"\n \n static int compare_untracked(const void *a_, const void *b_)\n {\ndiff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c\nindex 627a6bdc3d0..e402c35a702 100644\n--- a/t/helper/test-fast-rebase.c\n+++ b/t/helper/test-fast-rebase.c\n@@ -23,6 +23,7 @@\n #include \"refs.h\"\n #include \"revision.h\"\n #include \"sequencer.h\"\n+#include \"setup.h\"\n #include \"strvec.h\"\n #include \"tree.h\"\n \ndiff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c\nindex c43fc976b82..a37236cd0a6 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 \"setup.h\"\n #include \"thread-utils.h\"\n #include \"trace2.h\"\n #include \"wrapper.h\"\ndiff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c\nindex 2b678a45793..06ce3a47ccf 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 \"setup.h\"\n \n static int single;\n static int multi;\ndiff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c\nindex 04bc2563f3e..64705734dfe 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 \"setup.h\"\n #include \"tree.h\"\n \n int cmd__match_trees(int ac, const char **av)\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex 0906993ad59..fd6f73ea03b 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oid-array.h\"\n+#include \"setup.h\"\n \n static int print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c\nindex 883d40efd45..f1b3dbe376b 100644\n--- a/t/helper/test-oidmap.c\n+++ b/t/helper/test-oidmap.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oidmap.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n \n /* key is an oid and value is a name (could be a refname for example) */\ndiff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c\nindex 0b82431a70f..edcb7e9f448 100644\n--- a/t/helper/test-oidtree.c\n+++ b/t/helper/test-oidtree.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"oidtree.h\"\n+#include \"setup.h\"\n \n static enum cb_next print_oid(const struct object_id *oid, void *data)\n {\ndiff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c\nindex 0e53dee9e57..75ca1505a37 100644\n--- a/t/helper/test-pack-mtimes.c\n+++ b/t/helper/test-pack-mtimes.c\n@@ -5,6 +5,7 @@\n #include \"object-store.h\"\n #include \"packfile.h\"\n #include \"pack-mtimes.h\"\n+#include \"setup.h\"\n \n static void dump_mtimes(struct packed_git *p)\n {\ndiff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c\nindex da17fd37eb1..cce496944ac 100644\n--- a/t/helper/test-partial-clone.c\n+++ b/t/helper/test-partial-clone.c\n@@ -3,6 +3,7 @@\n #include \"test-tool.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n+#include \"setup.h\"\n \n /*\n  * Prints the size of the object corresponding to the given hash in a specific\ndiff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c\nindex cc266e3ec09..4f5ac2fadce 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 \"setup.h\"\n #include \"string-list.h\"\n #include \"utf8.h\"\n \ndiff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c\nindex 7e12d4f9aa2..7c8de7b562a 100644\n--- a/t/helper/test-proc-receive.c\n+++ b/t/helper/test-proc-receive.c\n@@ -3,6 +3,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"pkt-line.h\"\n+#include \"setup.h\"\n #include \"sigchain.h\"\n #include \"test-tool.h\"\n \ndiff --git a/t/helper/test-reach.c b/t/helper/test-reach.c\nindex 09c711038ce..91bb2dec1df 100644\n--- a/t/helper/test-reach.c\n+++ b/t/helper/test-reach.c\n@@ -8,6 +8,7 @@\n #include \"hex.h\"\n #include \"parse-options.h\"\n #include \"ref-filter.h\"\n+#include \"setup.h\"\n #include \"string-list.h\"\n #include \"tag.h\"\n \ndiff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c\nindex 84818363d5b..a4c24d0e421 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 \"setup.h\"\n #include \"wrapper.h\"\n \n int cmd__read_cache(int argc, const char **argv)\ndiff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c\nindex 98b73bb8f25..e21b0805f3c 100644\n--- a/t/helper/test-read-graph.c\n+++ b/t/helper/test-read-graph.c\n@@ -4,6 +4,7 @@\n #include \"repository.h\"\n #include \"object-store.h\"\n #include \"bloom.h\"\n+#include \"setup.h\"\n \n int cmd__read_graph(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c\nindex 0a883cdf26b..05c4f2b2625 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 \"setup.h\"\n \n static int read_midx_file(const char *object_dir, int show_objects)\n {\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 1745b088b7c..8717b95e84f 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"hex.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"worktree.h\"\n #include \"object-store.h\"\n #include \"repository.h\"\ndiff --git a/t/helper/test-repository.c b/t/helper/test-repository.c\nindex c444775eb0f..6774f6245f0 100644\n--- a/t/helper/test-repository.c\n+++ b/t/helper/test-repository.c\n@@ -8,6 +8,7 @@\n #include \"object-store.h\"\n #include \"object.h\"\n #include \"repository.h\"\n+#include \"setup.h\"\n #include \"tree.h\"\n \n static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,\ndiff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c\nindex 4a45d5bac2a..f2df4334063 100644\n--- a/t/helper/test-revision-walking.c\n+++ b/t/helper/test-revision-walking.c\n@@ -13,6 +13,7 @@\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\n+#include \"setup.h\"\n \n static void print_commit(struct commit *commit)\n {\ndiff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c\nindex a26107ed70a..15b7688774c 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 \"setup.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n \ndiff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c\nindex 497d72058de..7d590ab7227 100644\n--- a/t/helper/test-serve-v2.c\n+++ b/t/helper/test-serve-v2.c\n@@ -3,6 +3,7 @@\n #include \"gettext.h\"\n #include \"parse-options.h\"\n #include \"serve.h\"\n+#include \"setup.h\"\n \n static char const * const serve_usage[] = {\n \tN_(\"test-tool serve-v2 [<options>]\"),\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 22a41c40926..256bfa6e9e1 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 \"cache.h\"\n #include \"config.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c\nindex a3848a8b668..aaffd422d6e 100644\n--- a/t/helper/test-submodule-nested-repo-config.c\n+++ b/t/helper/test-submodule-nested-repo-config.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n \n static void die_usage(const char **argv, const char *msg)\ndiff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c\nindex e060cc62268..f18ca46dce4 100644\n--- a/t/helper/test-submodule.c\n+++ b/t/helper/test-submodule.c\n@@ -3,6 +3,7 @@\n #include \"cache.h\"\n #include \"parse-options.h\"\n #include \"remote.h\"\n+#include \"setup.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c\nindex ff22f2fa2c5..65a355cc590 100644\n--- a/t/helper/test-subprocess.c\n+++ b/t/helper/test-subprocess.c\n@@ -1,6 +1,7 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n #include \"run-command.h\"\n+#include \"setup.h\"\n \n int cmd__subprocess(int argc, const char **argv)\n {\ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex a2b56b9cae5..0cd7ee12b7e 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -1,5 +1,6 @@\n #include \"test-tool.h\"\n #include \"cache.h\"\n+#include \"setup.h\"\n #include \"userdiff.h\"\n #include \"config.h\"\n \ndiff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c\nindex 7d45cd61e82..a93417ed3a9 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 \"setup.h\"\n \n int cmd__write_cache(int argc, const char **argv)\n {\ndiff --git a/trace.c b/trace.c\nindex 9c85b71ec6a..81318a2455d 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -25,6 +25,7 @@\n #include \"abspath.h\"\n #include \"environment.h\"\n #include \"quote.h\"\n+#include \"setup.h\"\n #include \"wrapper.h\"\n \n struct trace_key trace_default_key = { \"GIT_TRACE\", 0, 0, 0 };\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 0ff4bbc6b96..a26fda3493f 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -22,6 +22,7 @@\n #include \"promisor-remote.h\"\n #include \"entry.h\"\n #include \"parallel-checkout.h\"\n+#include \"setup.h\"\n \n /*\n  * Error messages expected by scripts out of plumbing commands such as\ndiff --git a/worktree.c b/worktree.c\nindex c2671b0cdf3..7f0f04eab56 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -5,6 +5,7 @@\n #include \"gettext.h\"\n #include \"repository.h\"\n #include \"refs.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"worktree.h\"\n #include \"dir.h\"\ndiff --git a/wt-status.c b/wt-status.c\nindex 106e46480a1..16e0df5736f 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -16,6 +16,7 @@\n #include \"refs.h\"\n #include \"submodule.h\"\n #include \"column.h\"\n+#include \"setup.h\"\n #include \"strbuf.h\"\n #include \"utf8.h\"\n #include \"worktree.h\"\n-- \ngitgitgadget\n\n"},{"id":"473888","messageId":"20230321215653.1615083-1-jonathantanmy@google.com","threadId":"59412","inReplyTo":"pull.1493.v2.git.1679379968.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/16] Header cleanups","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2023-03-21T21:56:53Z","receivedAt":"2023-03-21T21:58:25Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"\"Elijah Newren via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>  * Patch 1: leftover cleanup from en/header-cleanups (now in master) that\n>    should have been included in that series\n>  * Patches 2-4: cleanups around gettext.h. Without these patches, many\n>    gettext inclusions would have to be squashed into later patches and make\n>    them harder to review. Also, the implicit dependency on gettext.h was\n>    making it much harder to find other dependencies.\n>  * Patch 5: move some global var declarations from cache.h into the header\n>    associated with where the vars are declared\n>  * Patches 6-16: move header declarations from cache.h into a header named\n>    the same as the source file containing the actual functions (e.g. move\n>    declarations for abspath.c functions from cache.h into abspath.h), and\n>    reduce the dependencies on cache.h accordingly.\n\nThanks for the effort. All the changes look good to me. (As for whether\ngettext.h should go into cache.h/git-compat-util.h, I think that\nindividual files that use it should include it themselves, just as you\nhave done in this patch set. This means, among other things, that we can\nreuse Git code in other projects that do not use gettext.)\n \n"}]}