From cbd53a2193d11e83b5bad2c3514bd1603074bc36 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Tue, 15 May 2018 16:42:15 -0700 Subject: [PATCH 01/19] object-store: move object access functions to object-store.h This should make these functions easier to find and cache.h less overwhelming to read. In particular, this moves: - read_object_file - oid_object_info - write_object_file As a result, most of the codebase needs to #include object-store.h. In this patch the #include is only added to files that would fail to compile otherwise. It would be better to #include wherever identifiers from the header are used. That can happen later when we have better tooling for it. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- apply.c | 1 + archive-tar.c | 1 + archive-zip.c | 1 + archive.c | 1 + blame.c | 1 + builtin/blame.c | 1 + builtin/cat-file.c | 1 + builtin/checkout.c | 1 + builtin/clone.c | 1 + builtin/commit-tree.c | 1 + builtin/describe.c | 1 + builtin/difftool.c | 1 + builtin/fast-export.c | 1 + builtin/fetch.c | 1 + builtin/fmt-merge-msg.c | 1 + builtin/hash-object.c | 1 + builtin/log.c | 1 + builtin/ls-tree.c | 1 + builtin/merge-tree.c | 1 + builtin/mktag.c | 1 + builtin/mktree.c | 1 + builtin/notes.c | 1 + builtin/prune.c | 1 + builtin/receive-pack.c | 1 + builtin/reflog.c | 1 + builtin/remote.c | 1 + builtin/rev-list.c | 1 + builtin/show-ref.c | 1 + builtin/tag.c | 1 + builtin/unpack-file.c | 1 + builtin/unpack-objects.c | 1 + builtin/verify-commit.c | 1 + bulk-checkin.c | 1 + bundle.c | 1 + cache-tree.c | 1 + cache.h | 117 --------------------------------------- combine-diff.c | 1 + commit.c | 1 + config.c | 1 + convert.c | 1 + diff.c | 1 + diffcore-rename.c | 1 + dir.c | 1 + entry.c | 1 + fetch-pack.c | 1 + fsck.c | 1 + grep.c | 1 + list-objects-filter.c | 1 + list-objects.c | 1 + log-tree.c | 1 + mailmap.c | 1 + match-trees.c | 1 + merge-blobs.c | 1 + merge-recursive.c | 1 + notes-cache.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-store.h | 117 +++++++++++++++++++++++++++++++++++++++ object.c | 1 + pack-bitmap-write.c | 1 + packfile.h | 5 ++ read-cache.c | 1 + ref-filter.c | 1 + refs.c | 1 + remote-testsvn.c | 1 + remote.c | 1 + rerere.c | 1 + revision.c | 1 + send-pack.c | 1 + sequencer.c | 1 + shallow.c | 1 + submodule-config.c | 1 + tag.c | 1 + tree-walk.c | 1 + tree.c | 1 + unpack-trees.c | 1 + upload-pack.c | 1 + walker.c | 1 + xdiff-interface.c | 1 + 79 files changed, 198 insertions(+), 117 deletions(-) diff --git a/apply.c b/apply.c index 7e5792c996..cbc45fa1b0 100644 --- a/apply.c +++ b/apply.c @@ -9,6 +9,7 @@ #include "cache.h" #include "config.h" +#include "object-store.h" #include "blob.h" #include "delta.h" #include "diff.h" diff --git a/archive-tar.c b/archive-tar.c index f93409324f..e38435eb4e 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -5,6 +5,7 @@ #include "config.h" #include "tar.h" #include "archive.h" +#include "object-store.h" #include "streaming.h" #include "run-command.h" diff --git a/archive-zip.c b/archive-zip.c index 74f3fe9103..abc556e5a7 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -6,6 +6,7 @@ #include "archive.h" #include "streaming.h" #include "utf8.h" +#include "object-store.h" #include "userdiff.h" #include "xdiff-interface.h" diff --git a/archive.c b/archive.c index 93ab175b0b..9da1e3664a 100644 --- a/archive.c +++ b/archive.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "refs.h" +#include "object-store.h" #include "commit.h" #include "tree-walk.h" #include "attr.h" diff --git a/blame.c b/blame.c index 3a11f1ce52..f689bde31c 100644 --- a/blame.c +++ b/blame.c @@ -1,5 +1,6 @@ #include "cache.h" #include "refs.h" +#include "object-store.h" #include "cache-tree.h" #include "mergesort.h" #include "diff.h" diff --git a/builtin/blame.c b/builtin/blame.c index bfdf7cc132..0ffd1d443e 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -22,6 +22,7 @@ #include "line-log.h" #include "dir.h" #include "progress.h" +#include "object-store.h" #include "blame.h" static char blame_usage[] = N_("git blame [] [] [] [--] "); diff --git a/builtin/cat-file.c b/builtin/cat-file.c index b8ecbea98e..91e7764243 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -13,6 +13,7 @@ #include "tree-walk.h" #include "sha1-array.h" #include "packfile.h" +#include "object-store.h" struct batch_options { int enabled; diff --git a/builtin/checkout.c b/builtin/checkout.c index b49b582071..105e07981f 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -4,6 +4,7 @@ #include "lockfile.h" #include "parse-options.h" #include "refs.h" +#include "object-store.h" #include "commit.h" #include "tree.h" #include "tree-walk.h" diff --git a/builtin/clone.c b/builtin/clone.c index 7df5932b85..29998c02ec 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -14,6 +14,7 @@ #include "parse-options.h" #include "fetch-pack.h" #include "refs.h" +#include "object-store.h" #include "tree.h" #include "tree-walk.h" #include "unpack-trees.h" diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index ecf42191da..9fbd3529fb 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "config.h" +#include "object-store.h" #include "commit.h" #include "tree.h" #include "builtin.h" diff --git a/builtin/describe.c b/builtin/describe.c index 66c497f789..65b0edc473 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -13,6 +13,7 @@ #include "hashmap.h" #include "argv-array.h" #include "run-command.h" +#include "object-store.h" #include "revision.h" #include "list-objects.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index ee8dce019e..df7e75f797 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -20,6 +20,7 @@ #include "argv-array.h" #include "strbuf.h" #include "lockfile.h" +#include "object-store.h" #include "dir.h" static char *diff_gui_tool; diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 373c794873..f593e57b9d 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -7,6 +7,7 @@ #include "cache.h" #include "config.h" #include "refs.h" +#include "object-store.h" #include "commit.h" #include "object.h" #include "tag.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index 73be393b2e..c1f2df9796 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -5,6 +5,7 @@ #include "config.h" #include "repository.h" #include "refs.h" +#include "object-store.h" #include "commit.h" #include "builtin.h" #include "string-list.h" diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index bd680be687..1b526adb3a 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -2,6 +2,7 @@ #include "cache.h" #include "config.h" #include "refs.h" +#include "object-store.h" #include "commit.h" #include "diff.h" #include "revision.h" diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 526da5c185..d5c018eabd 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -6,6 +6,7 @@ */ #include "builtin.h" #include "config.h" +#include "object-store.h" #include "blob.h" #include "quote.h" #include "parse-options.h" diff --git a/builtin/log.c b/builtin/log.c index 71f68a3e4f..9656578f58 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -7,6 +7,7 @@ #include "cache.h" #include "config.h" #include "refs.h" +#include "object-store.h" #include "color.h" #include "commit.h" #include "diff.h" diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 409da4e835..fe3b952cb3 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "config.h" +#include "object-store.h" #include "blob.h" #include "tree.h" #include "commit.h" diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 32736e0b10..1b702d44c9 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "tree-walk.h" #include "xdiff-interface.h" +#include "object-store.h" #include "blob.h" #include "exec_cmd.h" #include "merge-blobs.h" diff --git a/builtin/mktag.c b/builtin/mktag.c index 82a6e86077..6fb7dc8578 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "tag.h" #include "replace-object.h" +#include "object-store.h" /* * A signature file has a very simple fixed format: four lines diff --git a/builtin/mktree.c b/builtin/mktree.c index bb76b469fd..2dc4ad6ba8 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -7,6 +7,7 @@ #include "quote.h" #include "tree.h" #include "parse-options.h" +#include "object-store.h" static struct treeent { unsigned mode; diff --git a/builtin/notes.c b/builtin/notes.c index 921e08d5bf..73b680ee13 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -11,6 +11,7 @@ #include "config.h" #include "builtin.h" #include "notes.h" +#include "object-store.h" #include "blob.h" #include "pretty.h" #include "refs.h" diff --git a/builtin/prune.c b/builtin/prune.c index 518ffbea13..8cc8659612 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -6,6 +6,7 @@ #include "reachable.h" #include "parse-options.h" #include "progress.h" +#include "object-store.h" static const char * const prune_usage[] = { N_("git prune [-n] [-v] [--progress] [--expire