cache.h: remove dependence on hex.h; make other files include it explicitly

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/add-interactive.c b/add-interactive.c
index 00a0f6f..ae25ec5 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -3,6 +3,7 @@
 #include "color.h"
 #include "config.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "revision.h"
 #include "refs.h"
 #include "string-list.h"
diff --git a/apply.c b/apply.c
index 7f12ebf..8776ab9 100644
--- a/apply.c
+++ b/apply.c
@@ -15,6 +15,7 @@
 #include "delta.h"
 #include "diff.h"
 #include "dir.h"
+#include "hex.h"
 #include "xdiff-interface.h"
 #include "ll-merge.h"
 #include "lockfile.h"
diff --git a/archive-tar.c b/archive-tar.c
index 9406f03..ee27fa0 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -4,6 +4,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "tar.h"
 #include "archive.h"
 #include "object-store.h"
diff --git a/archive-zip.c b/archive-zip.c
index 0456f1e..c5d1f72 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -4,6 +4,7 @@
 #include "cache.h"
 #include "config.h"
 #include "archive.h"
+#include "hex.h"
 #include "streaming.h"
 #include "utf8.h"
 #include "object-store.h"
diff --git a/archive.c b/archive.c
index 35719e5..c7869ae 100644
--- a/archive.c
+++ b/archive.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "commit.h"
diff --git a/bisect.c b/bisect.c
index ef5ee5a..1409150 100644
--- a/bisect.c
+++ b/bisect.c
@@ -2,6 +2,7 @@
 #include "config.h"
 #include "commit.h"
 #include "diff.h"
+#include "hex.h"
 #include "revision.h"
 #include "refs.h"
 #include "list-objects.h"
diff --git a/blame.c b/blame.c
index 8bfeaa1..e45d8a3 100644
--- a/blame.c
+++ b/blame.c
@@ -5,6 +5,7 @@
 #include "mergesort.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "tag.h"
 #include "blame.h"
 #include "alloc.h"
diff --git a/branch.c b/branch.c
index e5614b5..5aaf073 100644
--- a/branch.c
+++ b/branch.c
@@ -2,6 +2,7 @@
 #include "cache.h"
 #include "config.h"
 #include "branch.h"
+#include "hex.h"
 #include "refs.h"
 #include "refspec.h"
 #include "remote.h"
diff --git a/builtin/am.c b/builtin/am.c
index e0848dd..3b5ea50 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -8,6 +8,7 @@
 #include "config.h"
 #include "builtin.h"
 #include "exec-cmd.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "dir.h"
 #include "run-command.h"
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 7301740..e8ee4a4 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "bisect.h"
 #include "refs.h"
diff --git a/builtin/blame.c b/builtin/blame.c
index 4d1609c..fdd9f0c 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -10,6 +10,7 @@
 #include "config.h"
 #include "color.h"
 #include "builtin.h"
+#include "hex.h"
 #include "repository.h"
 #include "commit.h"
 #include "diff.h"
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 5b8be7c..3040016 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -9,6 +9,7 @@
 #include "config.h"
 #include "builtin.h"
 #include "diff.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
diff --git a/builtin/checkout.c b/builtin/checkout.c
index a5155cf..21a4335 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -9,6 +9,7 @@
 #include "config.h"
 #include "diff.h"
 #include "dir.h"
+#include "hex.h"
 #include "hook.h"
 #include "ll-merge.h"
 #include "lockfile.h"
diff --git a/builtin/clone.c b/builtin/clone.c
index 65b5b7d..462c286 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -11,6 +11,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "parse-options.h"
 #include "fetch-pack.h"
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 93704f9..6dc83dc 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "config.h"
 #include "dir.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "parse-options.h"
 #include "repository.h"
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index cc8d584..fefeed5 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -5,6 +5,7 @@
  */
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "repository.h"
 #include "commit.h"
diff --git a/builtin/describe.c b/builtin/describe.c
index eea1e33..5b5930f 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "commit.h"
 #include "tag.h"
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 25b853b..a393efa 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -3,6 +3,7 @@
 #include "config.h"
 #include "diff.h"
 #include "commit.h"
+#include "hex.h"
 #include "log-tree.h"
 #include "builtin.h"
 #include "submodule.h"
diff --git a/builtin/difftool.c b/builtin/difftool.c
index dbbfb19..01681d0 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -17,6 +17,7 @@
 #include "builtin.h"
 #include "run-command.h"
 #include "exec-cmd.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "strvec.h"
 #include "strbuf.h"
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 39a890f..78493c6 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -6,6 +6,7 @@
 #include "builtin.h"
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "refspec.h"
 #include "object-store.h"
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 7134683..160e2ee 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "lockfile.h"
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 113f22c..702c9a3 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "alloc.h"
+#include "hex.h"
 #include "pkt-line.h"
 #include "fetch-pack.h"
 #include "remote.h"
diff --git a/builtin/fetch.c b/builtin/fetch.c
index a21ce89..a77099b 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -3,6 +3,7 @@
  */
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "repository.h"
 #include "refs.h"
 #include "refspec.h"
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d207bd9..af0fab6 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "commit.h"
diff --git a/builtin/gc.c b/builtin/gc.c
index 02455fd..67c7fe8 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -11,6 +11,7 @@
  */
 
 #include "builtin.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "tempfile.h"
diff --git a/builtin/grep.c b/builtin/grep.c
index a08e584..c590fcb 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -5,6 +5,7 @@
  */
 #include "cache.h"
 #include "alloc.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "blob.h"
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 44db83f..1848768 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -6,6 +6,7 @@
  */
 #include "builtin.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "blob.h"
 #include "quote.h"
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 7e4b69f..21c0e10 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "delta.h"
+#include "hex.h"
 #include "pack.h"
 #include "csum-file.h"
 #include "blob.h"
diff --git a/builtin/log.c b/builtin/log.c
index 8554096..99489bc 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -7,6 +7,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "color.h"
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 6516177..2dfbd8e 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "hex.h"
 #include "transport.h"
 #include "ref-filter.h"
 #include "remote.h"
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index 8cc8c99..64d8e54 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -5,6 +5,7 @@
  */
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "blob.h"
 #include "tree.h"
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index 6f3941f..be8f3b2 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -2,6 +2,7 @@
 #include "cache.h"
 #include "config.h"
 #include "commit.h"
+#include "hex.h"
 #include "refs.h"
 #include "diff.h"
 #include "revision.h"
diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index 452f833..c875f5d 100644
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
@@ -1,5 +1,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
+#include "hex.h"
 #include "run-command.h"
 
 static const char *pgm;
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 828dc81..e782518 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -3,6 +3,7 @@
 #include "tree-walk.h"
 #include "xdiff-interface.h"
 #include "help.h"
+#include "hex.h"
 #include "commit.h"
 #include "commit-reach.h"
 #include "merge-ort.h"
diff --git a/builtin/merge.c b/builtin/merge.c
index 716a23f..7347b73 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -10,6 +10,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "builtin.h"
 #include "lockfile.h"
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 5d22909..42c2457 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "tag.h"
 #include "replace-object.h"
diff --git a/builtin/mktree.c b/builtin/mktree.c
index ec721ff..848c7b4 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -5,6 +5,7 @@
  */
 #include "builtin.h"
 #include "alloc.h"
+#include "hex.h"
 #include "quote.h"
 #include "tree.h"
 #include "parse-options.h"
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 29752e7..723ba61 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "alloc.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "commit.h"
diff --git a/builtin/notes.c b/builtin/notes.c
index 80d9dfd..bba4c2e 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -10,6 +10,7 @@
 #include "cache.h"
 #include "config.h"
 #include "builtin.h"
+#include "hex.h"
 #include "notes.h"
 #include "object-store.h"
 #include "repository.h"
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 72c33fd..2b5e859 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "alloc.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "attr.h"
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index ecd49ca..82115c5 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -7,6 +7,7 @@
 */
 
 #include "builtin.h"
+#include "hex.h"
 #include "repository.h"
 #include "packfile.h"
 #include "object-store.h"
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index f840fbf..338b15c 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -2,6 +2,7 @@
 #include "builtin.h"
 #include "config.h"
 #include "diff.h"
+#include "hex.h"
 #include "parse-options.h"
 
 static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
diff --git a/builtin/prune.c b/builtin/prune.c
index 2719220..db767b7 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "commit.h"
 #include "diff.h"
+#include "hex.h"
 #include "revision.h"
 #include "builtin.h"
 #include "reachable.h"
diff --git a/builtin/pull.c b/builtin/pull.c
index 1ab4de0..963a47f 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -9,6 +9,7 @@
 #include "cache.h"
 #include "config.h"
 #include "builtin.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "exec-cmd.h"
 #include "run-command.h"
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 3ce7541..018fa9c 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -7,6 +7,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "object.h"
 #include "tree.h"
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 6635f10..ef8ce2f 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -6,6 +6,7 @@
 
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
+#include "hex.h"
 #include "run-command.h"
 #include "exec-cmd.h"
 #include "strvec.h"
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index cd5c7a2..3d2b4c8 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "repository.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "pack.h"
 #include "refs.h"
diff --git a/builtin/repack.c b/builtin/repack.c
index 545b368..966430a 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "dir.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "run-command.h"
 #include "sigchain.h"
diff --git a/builtin/replace.c b/builtin/replace.c
index a29e911..cdcb39f 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -11,6 +11,7 @@
 #include "cache.h"
 #include "config.h"
 #include "builtin.h"
+#include "hex.h"
 #include "refs.h"
 #include "parse-options.h"
 #include "run-command.h"
diff --git a/builtin/reset.c b/builtin/reset.c
index 0697fa8..58f567a 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -10,6 +10,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "tag.h"
 #include "object.h"
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index d42db0b..e4c9b74 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -2,6 +2,7 @@
 #include "config.h"
 #include "commit.h"
 #include "diff.h"
+#include "hex.h"
 #include "revision.h"
 #include "list-objects.h"
 #include "list-objects-filter.h"
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index fd4f59f..e1fa9c6 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -8,6 +8,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "commit.h"
+#include "hex.h"
 #include "refs.h"
 #include "quote.h"
 #include "builtin.h"
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 4c5d125..127ced4 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "config.h"
 #include "commit.h"
+#include "hex.h"
 #include "refs.h"
 #include "pkt-line.h"
 #include "sideband.h"
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 358ac3e..8342b68 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "pretty.h"
 #include "refs.h"
 #include "builtin.h"
diff --git a/builtin/show-index.c b/builtin/show-index.c
index 0e0b9fb..98ec40d 100644
--- a/builtin/show-index.c
+++ b/builtin/show-index.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "hex.h"
 #include "pack.h"
 #include "parse-options.h"
 
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 3af6a53..1f28d7f 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "object.h"
diff --git a/builtin/stash.c b/builtin/stash.c
index 3a4f9fd..6a12fed 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "config.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "refs.h"
 #include "lockfile.h"
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 9edc785..2bbabbb 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "alloc.h"
+#include "hex.h"
 #include "repository.h"
 #include "cache.h"
 #include "config.h"
diff --git a/builtin/tag.c b/builtin/tag.c
index d428c45..be09488 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -9,6 +9,7 @@
 #include "cache.h"
 #include "config.h"
 #include "builtin.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "tag.h"
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 88de32b..e9b105a 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 
 static char *create_temp_file(struct object_id *oid)
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 43789b8..e125b12 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -2,6 +2,7 @@
 #include "cache.h"
 #include "bulk-checkin.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "object.h"
 #include "delta.h"
diff --git a/builtin/update-index.c b/builtin/update-index.c
index bf38885..11dc135 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -7,6 +7,7 @@
 #include "cache.h"
 #include "bulk-checkin.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "quote.h"
 #include "cache-tree.h"
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 254283a..80d05e2 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -3,6 +3,7 @@
 #include "config.h"
 #include "builtin.h"
 #include "dir.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "strvec.h"
 #include "branch.h"
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 0780103..7ad0d05 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -7,6 +7,7 @@
 #include "builtin.h"
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "tree.h"
 #include "cache-tree.h"
 #include "parse-options.h"
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 62ed104..d64cd5c 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -4,6 +4,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "bulk-checkin.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "repository.h"
 #include "csum-file.h"
diff --git a/bundle.c b/bundle.c
index 6ab6cd7..99d7de9 100644
--- a/bundle.c
+++ b/bundle.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "lockfile.h"
 #include "bundle.h"
+#include "hex.h"
 #include "object-store.h"
 #include "repository.h"
 #include "object.h"
diff --git a/cache-tree.c b/cache-tree.c
index 256f98c..9d46ece 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "tree.h"
 #include "tree-walk.h"
diff --git a/cache.h b/cache.h
index d0619ce..0c631e7 100644
--- a/cache.h
+++ b/cache.h
@@ -13,7 +13,6 @@
 #include "string-list.h"
 #include "pack-revindex.h"
 #include "hash.h"
-#include "hex.h"
 #include "path.h"
 #include "oid-array.h"
 #include "repository.h"
diff --git a/color.c b/color.c
index f05d8a8..6b577ce 100644
--- a/color.c
+++ b/color.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "color.h"
+#include "hex.h"
 
 static int git_use_color_default = GIT_COLOR_AUTO;
 int color_stdout_is_tty = -1;
diff --git a/combine-diff.c b/combine-diff.c
index 1a39b5d..91051dc 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -4,6 +4,7 @@
 #include "blob.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "quote.h"
 #include "xdiff-interface.h"
 #include "xdiff/xmacros.h"
diff --git a/commit-graph.c b/commit-graph.c
index c11b59f..5e6098f 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "pack.h"
 #include "packfile.h"
diff --git a/commit-reach.c b/commit-reach.c
index 1f0ddc5..5ba822a 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -3,6 +3,7 @@
 #include "commit.h"
 #include "commit-graph.h"
 #include "decorate.h"
+#include "hex.h"
 #include "prio-queue.h"
 #include "tree.h"
 #include "ref-filter.h"
diff --git a/commit.c b/commit.c
index e433c33..cb683a6 100644
--- a/commit.c
+++ b/commit.c
@@ -2,6 +2,7 @@
 #include "tag.h"
 #include "commit.h"
 #include "commit-graph.h"
+#include "hex.h"
 #include "repository.h"
 #include "object-store.h"
 #include "pkt-line.h"
diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c
index d67b0ee..eb25123 100644
--- a/compat/fsmonitor/fsm-ipc-darwin.c
+++ b/compat/fsmonitor/fsm-ipc-darwin.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "strbuf.h"
 #include "fsmonitor.h"
 #include "fsmonitor-ipc.h"
diff --git a/connect.c b/connect.c
index 63e5964..1340695 100644
--- a/connect.c
+++ b/connect.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "pkt-line.h"
 #include "quote.h"
 #include "refs.h"
diff --git a/connected.c b/connected.c
index b90fd61..39cb1e1 100644
--- a/connected.c
+++ b/connected.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "object-store.h"
 #include "run-command.h"
 #include "sigchain.h"
diff --git a/convert.c b/convert.c
index a54d169..349c7e4 100644
--- a/convert.c
+++ b/convert.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "attr.h"
 #include "run-command.h"
diff --git a/delta-islands.c b/delta-islands.c
index 1cfdc2c..c378513 100644
--- a/delta-islands.c
+++ b/delta-islands.c
@@ -4,6 +4,7 @@
 #include "object.h"
 #include "blob.h"
 #include "commit.h"
+#include "hex.h"
 #include "tag.h"
 #include "tree.h"
 #include "delta.h"
diff --git a/diagnose.c b/diagnose.c
index 8f26569..4a8ee4e 100644
--- a/diagnose.c
+++ b/diagnose.c
@@ -4,6 +4,7 @@
 #include "archive.h"
 #include "dir.h"
 #include "help.h"
+#include "hex.h"
 #include "strvec.h"
 #include "object-store.h"
 #include "packfile.h"
diff --git a/diff-lib.c b/diff-lib.c
index dec040c..70b3578 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -6,6 +6,7 @@
 #include "commit.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "revision.h"
 #include "cache-tree.h"
 #include "unpack-trees.h"
diff --git a/diff.c b/diff.c
index 3c35659..ec911bd 100644
--- a/diff.c
+++ b/diff.c
@@ -9,6 +9,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "delta.h"
+#include "hex.h"
 #include "xdiff-interface.h"
 #include "color.h"
 #include "attr.h"
diff --git a/entry.c b/entry.c
index 971ab26..c97cfa8 100644
--- a/entry.c
+++ b/entry.c
@@ -2,6 +2,7 @@
 #include "blob.h"
 #include "object-store.h"
 #include "dir.h"
+#include "hex.h"
 #include "streaming.h"
 #include "submodule.h"
 #include "progress.h"
diff --git a/fetch-pack.c b/fetch-pack.c
index 271e2a6..95a992b 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "repository.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "refs.h"
 #include "pkt-line.h"
diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index d4d6fd3..9609eb3 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -5,6 +5,7 @@
 #include "object-store.h"
 #include "diff.h"
 #include "diff-merges.h"
+#include "hex.h"
 #include "revision.h"
 #include "tag.h"
 #include "string-list.h"
diff --git a/fsck.c b/fsck.c
index 20e1aac..871c0a9 100644
--- a/fsck.c
+++ b/fsck.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "object-store.h"
 #include "repository.h"
 #include "object.h"
diff --git a/grep.c b/grep.c
index cee44a7..68e9328 100644
--- a/grep.c
+++ b/grep.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "grep.h"
+#include "hex.h"
 #include "object-store.h"
 #include "userdiff.h"
 #include "xdiff-interface.h"
diff --git a/http-backend.c b/http-backend.c
index d756d12..4529003 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "repository.h"
 #include "refs.h"
 #include "pkt-line.h"
diff --git a/http-fetch.c b/http-fetch.c
index 258fec2..8db35b9 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "exec-cmd.h"
+#include "hex.h"
 #include "http.h"
 #include "walker.h"
 #include "strvec.h"
diff --git a/http-push.c b/http-push.c
index 7f71316..88aa045 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "commit.h"
 #include "tag.h"
diff --git a/http-walker.c b/http-walker.c
index b8f0f98..c3e902c 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "repository.h"
 #include "commit.h"
+#include "hex.h"
 #include "walker.h"
 #include "http.h"
 #include "list.h"
diff --git a/http.c b/http.c
index c4b6dde..86b0745 100644
--- a/http.c
+++ b/http.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "git-curl-compat.h"
+#include "hex.h"
 #include "http.h"
 #include "config.h"
 #include "pack.h"
diff --git a/line-log.c b/line-log.c
index 4956eae..1bf89c9 100644
--- a/line-log.c
+++ b/line-log.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "line-range.h"
 #include "cache.h"
+#include "hex.h"
 #include "tag.h"
 #include "blob.h"
 #include "tree.h"
diff --git a/list-objects-filter.c b/list-objects-filter.c
index e40ea9b..5d7b331 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "dir.h"
+#include "hex.h"
 #include "tag.h"
 #include "commit.h"
 #include "tree.h"
diff --git a/list-objects.c b/list-objects.c
index 7528fe1..ab5745b 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "tag.h"
 #include "commit.h"
+#include "hex.h"
 #include "tree.h"
 #include "blob.h"
 #include "diff.h"
diff --git a/log-tree.c b/log-tree.c
index 1dd5fcb..ee3dfb6 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -2,6 +2,7 @@
 #include "commit-reach.h"
 #include "config.h"
 #include "diff.h"
+#include "hex.h"
 #include "object-store.h"
 #include "repository.h"
 #include "tmp-objdir.h"
diff --git a/ls-refs.c b/ls-refs.c
index 697d4be..f4c6b9b 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "refs.h"
 #include "remote.h"
diff --git a/match-trees.c b/match-trees.c
index 49398e5..c38dcba 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "tree.h"
 #include "tree-walk.h"
 #include "object-store.h"
diff --git a/merge-ort.c b/merge-ort.c
index d1611ca..4c5be8e 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -26,6 +26,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "dir.h"
+#include "hex.h"
 #include "entry.h"
 #include "ll-merge.h"
 #include "object-store.h"
diff --git a/merge-recursive.c b/merge-recursive.c
index ae469f8..ee14467 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -18,6 +18,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "dir.h"
+#include "hex.h"
 #include "ll-merge.h"
 #include "lockfile.h"
 #include "object-store.h"
diff --git a/merge.c b/merge.c
index 445b4f1..2c8b845 100644
--- a/merge.c
+++ b/merge.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "commit.h"
 #include "run-command.h"
diff --git a/midx.c b/midx.c
index 84d7a53..24799be 100644
--- a/midx.c
+++ b/midx.c
@@ -3,6 +3,7 @@
 #include "config.h"
 #include "csum-file.h"
 #include "dir.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "packfile.h"
 #include "object-store.h"
diff --git a/negotiator/skipping.c b/negotiator/skipping.c
index 0f5ac48..28f8769 100644
--- a/negotiator/skipping.c
+++ b/negotiator/skipping.c
@@ -2,6 +2,7 @@
 #include "skipping.h"
 #include "../commit.h"
 #include "../fetch-negotiator.h"
+#include "../hex.h"
 #include "../prio-queue.h"
 #include "../refs.h"
 #include "../tag.h"
diff --git a/notes-merge.c b/notes-merge.c
index b4cc594..5b1a9ff 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -5,6 +5,7 @@
 #include "repository.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "xdiff-interface.h"
 #include "ll-merge.h"
 #include "dir.h"
diff --git a/notes.c b/notes.c
index f2805d5..c9e4b8b 100644
--- a/notes.c
+++ b/notes.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "notes.h"
 #include "object-store.h"
 #include "blob.h"
diff --git a/object-file.c b/object-file.c
index 18d6522..43a39dd 100644
--- a/object-file.c
+++ b/object-file.c
@@ -9,6 +9,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "string-list.h"
 #include "lockfile.h"
 #include "delta.h"
diff --git a/object-name.c b/object-name.c
index 2dd1a0f..97bb94d 100644
--- a/object-name.c
+++ b/object-name.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "tag.h"
 #include "commit.h"
 #include "tree.h"
diff --git a/object.c b/object.c
index 344087d..609fed1 100644
--- a/object.c
+++ b/object.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "object.h"
 #include "replace-object.h"
 #include "object-store.h"
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 155939e..891d9d2 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "object-store.h"
 #include "commit.h"
 #include "tag.h"
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 5a97834..a321d6f 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "commit.h"
+#include "hex.h"
 #include "strbuf.h"
 #include "tag.h"
 #include "diff.h"
diff --git a/pack-check.c b/pack-check.c
index bfb593b..7ed594d 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "pack.h"
 #include "pack-revindex.h"
diff --git a/pack-write.c b/pack-write.c
index 3363729..041e573 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "pack.h"
 #include "csum-file.h"
 #include "remote.h"
diff --git a/packfile.c b/packfile.c
index 3e3063d..4088735 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "list.h"
 #include "pack.h"
 #include "repository.h"
diff --git a/parallel-checkout.c b/parallel-checkout.c
index decdc8d..2455aa3 100644
--- a/parallel-checkout.c
+++ b/parallel-checkout.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "entry.h"
+#include "hex.h"
 #include "parallel-checkout.h"
 #include "pkt-line.h"
 #include "progress.h"
diff --git a/patch-ids.c b/patch-ids.c
index 3153446..a4473a8 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -2,6 +2,7 @@
 #include "diff.h"
 #include "commit.h"
 #include "hash-lookup.h"
+#include "hex.h"
 #include "patch-ids.h"
 
 static int patch_id_defined(struct commit *commit)
diff --git a/path.c b/path.c
index 492e17a..97561c3 100644
--- a/path.c
+++ b/path.c
@@ -2,6 +2,7 @@
  * Utilities for paths and pathnames
  */
 #include "cache.h"
+#include "hex.h"
 #include "repository.h"
 #include "strbuf.h"
 #include "string-list.h"
diff --git a/pkt-line.c b/pkt-line.c
index ce4e73b..1ea7f86 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "pkt-line.h"
+#include "hex.h"
 #include "run-command.h"
 
 char packet_buffer[LARGE_PACKET_MAX];
diff --git a/pretty.c b/pretty.c
index b608084..2401e3e 100644
--- a/pretty.c
+++ b/pretty.c
@@ -2,6 +2,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "commit.h"
+#include "hex.h"
 #include "utf8.h"
 #include "diff.h"
 #include "revision.h"
diff --git a/promisor-remote.c b/promisor-remote.c
index faa7612..1db5669 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "object-store.h"
 #include "promisor-remote.h"
 #include "config.h"
diff --git a/protocol-caps.c b/protocol-caps.c
index bbde918..f9bc2a8 100644
--- a/protocol-caps.c
+++ b/protocol-caps.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "protocol-caps.h"
 #include "gettext.h"
+#include "hex.h"
 #include "pkt-line.h"
 #include "strvec.h"
 #include "hash.h"
diff --git a/reachable.c b/reachable.c
index aba63eb..be9d409 100644
--- a/reachable.c
+++ b/reachable.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "refs.h"
 #include "tag.h"
 #include "commit.h"
diff --git a/read-cache.c b/read-cache.c
index 3cc8e31..1bcf673 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -8,6 +8,7 @@
 #include "config.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "tempfile.h"
 #include "lockfile.h"
 #include "cache-tree.h"
diff --git a/ref-filter.c b/ref-filter.c
index c8230a0..d862718 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "refs.h"
 #include "wildmatch.h"
diff --git a/refs.c b/refs.c
index f90f953..f22adf6 100644
--- a/refs.c
+++ b/refs.c
@@ -6,6 +6,7 @@
 #include "alloc.h"
 #include "config.h"
 #include "hashmap.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "iterator.h"
 #include "refs.h"
diff --git a/refs/debug.c b/refs/debug.c
index ff7766b..adc34c8 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "hex.h"
 #include "refs-internal.h"
 #include "trace.h"
 
diff --git a/refs/files-backend.c b/refs/files-backend.c
index b899543..6f257c7 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1,5 +1,6 @@
 #include "../cache.h"
 #include "../config.h"
+#include "../hex.h"
 #include "../refs.h"
 #include "refs-internal.h"
 #include "ref-cache.h"
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 186dcaf..b665d0f 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1,6 +1,7 @@
 #include "../git-compat-util.h"
 #include "../alloc.h"
 #include "../config.h"
+#include "../hex.h"
 #include "../refs.h"
 #include "refs-internal.h"
 #include "packed-backend.h"
diff --git a/refspec.c b/refspec.c
index ec336ec..28d9091 100644
--- a/refspec.c
+++ b/refspec.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "strvec.h"
 #include "refs.h"
 #include "refspec.h"
diff --git a/remote-curl.c b/remote-curl.c
index 380ef3f..ed7e3a0 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "remote.h"
 #include "connect.h"
 #include "strbuf.h"
diff --git a/remote.c b/remote.c
index daade49..b04e5da 100644
--- a/remote.c
+++ b/remote.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "remote.h"
 #include "urlmatch.h"
 #include "refs.h"
diff --git a/replace-object.c b/replace-object.c
index 320be25..0cf056c 100644
--- a/replace-object.c
+++ b/replace-object.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "oidmap.h"
 #include "object-store.h"
 #include "replace-object.h"
diff --git a/rerere.c b/rerere.c
index d4bcb90..a67abaa 100644
--- a/rerere.c
+++ b/rerere.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "string-list.h"
 #include "rerere.h"
diff --git a/reset.c b/reset.c
index 5ded236..58b3829 100644
--- a/reset.c
+++ b/reset.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "cache-tree.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "refs.h"
 #include "reset.h"
diff --git a/revision.c b/revision.c
index b8f925f..e356bc4 100644
--- a/revision.c
+++ b/revision.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "tag.h"
 #include "blob.h"
diff --git a/send-pack.c b/send-pack.c
index f2e1983..9541046 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "config.h"
 #include "commit.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "pkt-line.h"
diff --git a/sequencer.c b/sequencer.c
index fcf8740..af1e07f 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "dir.h"
 #include "object-store.h"
diff --git a/server-info.c b/server-info.c
index f07daa1..4043689 100644
--- a/server-info.c
+++ b/server-info.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "dir.h"
+#include "hex.h"
 #include "repository.h"
 #include "refs.h"
 #include "object.h"
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 5c300e8..7270960 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 
 #ifdef DC_SHA1_EXTERNAL
 /*
diff --git a/shallow.c b/shallow.c
index 7dc73fb..1cbb05b 100644
--- a/shallow.c
+++ b/shallow.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "repository.h"
 #include "tempfile.h"
 #include "lockfile.h"
diff --git a/strbuf.c b/strbuf.c
index bc4c2c0..1c57ac6 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "alloc.h"
+#include "hex.h"
 #include "refs.h"
 #include "string-list.h"
 #include "utf8.h"
diff --git a/strvec.c b/strvec.c
index 94d504e..17d54b6 100644
--- a/strvec.c
+++ b/strvec.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "strvec.h"
 #include "alloc.h"
+#include "hex.h"
 #include "strbuf.h"
 
 const char *empty_strvec[] = { NULL };
diff --git a/submodule-config.c b/submodule-config.c
index bb7c35f..89a7bf0 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "alloc.h"
 #include "dir.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "submodule-config.h"
diff --git a/submodule.c b/submodule.c
index 340ffad..9d89299 100644
--- a/submodule.c
+++ b/submodule.c
@@ -7,6 +7,7 @@
 #include "dir.h"
 #include "diff.h"
 #include "commit.h"
+#include "hex.h"
 #include "revision.h"
 #include "run-command.h"
 #include "diffcore.h"
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 6c900ca..787fd52 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "bloom.h"
+#include "hex.h"
 #include "test-tool.h"
 #include "commit.h"
 
diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c
index 9159a17..615e648 100644
--- a/t/helper/test-cache-tree.c
+++ b/t/helper/test-cache-tree.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "tree.h"
 #include "cache-tree.h"
 #include "parse-options.h"
diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index 454f17b..92dfc1a 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "tree.h"
 #include "cache-tree.h"
 
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index 0ea97b8..813d0a3 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,6 +1,7 @@
 #define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "split-index.h"
 #include "ewah/ewok.h"
 
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index 6d53683..af953fa 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -2,6 +2,7 @@
 #include "test-tool.h"
 #include "cache.h"
 #include "dir.h"
+#include "hex.h"
 
 static int compare_untracked(const void *a_, const void *b_)
 {
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
index efc82dd..b1edb92 100644
--- a/t/helper/test-fast-rebase.c
+++ b/t/helper/test-fast-rebase.c
@@ -15,6 +15,7 @@
 
 #include "cache-tree.h"
 #include "commit.h"
+#include "hex.h"
 #include "lockfile.h"
 #include "merge-ort.h"
 #include "refs.h"
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 5860dab..0162481 100644
--- a/t/helper/test-hash.c
+++ b/t/helper/test-hash.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 
 int cmd_hash_impl(int ac, const char **av, int algo)
 {
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index 4079fde..04bc256 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "tree.h"
 
 int cmd__match_trees(int ac, const char **av)
diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c
index d1324d0..0906993 100644
--- a/t/helper/test-oid-array.c
+++ b/t/helper/test-oid-array.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "oid-array.h"
 
 static int print_oid(const struct object_id *oid, void *data)
diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c
index 0acf999..883d40e 100644
--- a/t/helper/test-oidmap.c
+++ b/t/helper/test-oidmap.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "oidmap.h"
 #include "strbuf.h"
 
diff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c
index d48a409..0b82431 100644
--- a/t/helper/test-oidtree.c
+++ b/t/helper/test-oidtree.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "oidtree.h"
 
 static enum cb_next print_oid(const struct object_id *oid, void *data)
diff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c
index f7b79da..f68b376 100644
--- a/t/helper/test-pack-mtimes.c
+++ b/t/helper/test-pack-mtimes.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "test-tool.h"
+#include "hex.h"
 #include "strbuf.h"
 #include "object-store.h"
 #include "packfile.h"
diff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c
index 3f102cf..da17fd3 100644
--- a/t/helper/test-partial-clone.c
+++ b/t/helper/test-partial-clone.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "test-tool.h"
 #include "repository.h"
 #include "object-store.h"
diff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c
index a4b305f..7e12d4f 100644
--- a/t/helper/test-proc-receive.c
+++ b/t/helper/test-proc-receive.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "connect.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "pkt-line.h"
 #include "sigchain.h"
diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c
index 883d8e2..de8f266 100644
--- a/t/helper/test-reach.c
+++ b/t/helper/test-reach.c
@@ -3,6 +3,7 @@
 #include "commit.h"
 #include "commit-reach.h"
 #include "config.h"
+#include "hex.h"
 #include "parse-options.h"
 #include "ref-filter.h"
 #include "string-list.h"
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c
index 27072ba..0a883cd 100644
--- a/t/helper/test-read-midx.c
+++ b/t/helper/test-read-midx.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "midx.h"
 #include "repository.h"
 #include "object-store.h"
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index ae8a564..1745b08 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,5 +1,6 @@
 #include "test-tool.h"
 #include "cache.h"
+#include "hex.h"
 #include "refs.h"
 #include "worktree.h"
 #include "object-store.h"
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index 56f0e3c..10a6dfc 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -3,6 +3,7 @@
 #include "commit-graph.h"
 #include "commit.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "object.h"
 #include "repository.h"
diff --git a/tag.c b/tag.c
index dfbcd7f..18b718c 100644
--- a/tag.c
+++ b/tag.c
@@ -6,6 +6,7 @@
 #include "blob.h"
 #include "alloc.h"
 #include "gpg-interface.h"
+#include "hex.h"
 #include "packfile.h"
 
 const char *tag_type = "tag";
diff --git a/trace2/tr2_sid.c b/trace2/tr2_sid.c
index dc6e75e..5f1ce6f 100644
--- a/trace2/tr2_sid.c
+++ b/trace2/tr2_sid.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "trace2/tr2_tbuf.h"
 #include "trace2/tr2_sid.h"
 
diff --git a/transport-helper.c b/transport-helper.c
index 3ea7c2b..82ac63e 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -4,6 +4,7 @@
 #include "run-command.h"
 #include "commit.h"
 #include "diff.h"
+#include "hex.h"
 #include "revision.h"
 #include "remote.h"
 #include "string-list.h"
diff --git a/transport.c b/transport.c
index ac9e06a..906dbad 100644
--- a/transport.c
+++ b/transport.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "transport.h"
 #include "hook.h"
 #include "pkt-line.h"
diff --git a/tree-walk.c b/tree-walk.c
index d22f3fe..0e2f5ce 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -2,6 +2,7 @@
 #include "tree-walk.h"
 #include "alloc.h"
 #include "dir.h"
+#include "hex.h"
 #include "object-store.h"
 #include "tree.h"
 #include "pathspec.h"
diff --git a/tree.c b/tree.c
index 410e3b4..76a6534 100644
--- a/tree.c
+++ b/tree.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "cache-tree.h"
+#include "hex.h"
 #include "tree.h"
 #include "object-store.h"
 #include "blob.h"
diff --git a/unpack-trees.c b/unpack-trees.c
index 3d05e45..9c1f2a1 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -3,6 +3,7 @@
 #include "repository.h"
 #include "config.h"
 #include "dir.h"
+#include "hex.h"
 #include "tree.h"
 #include "tree-walk.h"
 #include "cache-tree.h"
diff --git a/upload-pack.c b/upload-pack.c
index 551f22f..fa4bb61 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "pkt-line.h"
 #include "sideband.h"
diff --git a/url.c b/url.c
index e04bd60..bf318c0 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "url.h"
 
 int is_urlschemechar(int first_flag, int ch)
diff --git a/urlmatch.c b/urlmatch.c
index 620a648..2965cbe 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "urlmatch.h"
 
 #define URL_ALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
diff --git a/walker.c b/walker.c
index 99d0e0e..c046936 100644
--- a/walker.c
+++ b/walker.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "hex.h"
 #include "walker.h"
 #include "repository.h"
 #include "object-store.h"
diff --git a/wt-status.c b/wt-status.c
index 3162241..90525bd 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -4,6 +4,7 @@
 #include "dir.h"
 #include "commit.h"
 #include "diff.h"
+#include "hex.h"
 #include "revision.h"
 #include "diffcore.h"
 #include "quote.h"
diff --git a/xdiff-interface.c b/xdiff-interface.c
index e87950d..5baf6ce 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "config.h"
+#include "hex.h"
 #include "object-store.h"
 #include "xdiff-interface.h"
 #include "xdiff/xtypes.h"