[PATCH 01/19] object-store: move object access functions to object-store.h

2018-05-17 Thread Stefan Beller
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 7e5792c996f..cbc45fa1b0e 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 f93409324f9..e38435eb4ef 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 74f3fe91034..abc556e5a75 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 93ab175b0b4..9da1e3664a6 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 3a11f1ce52b..f689bde31cd 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 bfdf7cc1325..0ffd1d443ea 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[] 

[PATCH 01/19] object-store: move object access functions to object-store.h

2018-05-15 Thread Stefan Beller
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 
---
 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 7e5792c996f..cbc45fa1b0e 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 f93409324f9..e38435eb4ef 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 74f3fe91034..abc556e5a75 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 93ab175b0b4..9da1e3664a6 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 3a11f1ce52b..f689bde31cd 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 bfdf7cc1325..0ffd1d443ea 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