Skip to content

Commit

Permalink
object-store: move object access functions to object-store.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
stefanbeller authored and gitster committed May 16, 2018
1 parent 14ba97f commit cbd53a2
Show file tree
Hide file tree
Showing 79 changed files with 198 additions and 117 deletions.
1 change: 1 addition & 0 deletions apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "cache.h"
#include "config.h"
#include "object-store.h"
#include "blob.h"
#include "delta.h"
#include "diff.h"
Expand Down
1 change: 1 addition & 0 deletions archive-tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "config.h"
#include "tar.h"
#include "archive.h"
#include "object-store.h"
#include "streaming.h"
#include "run-command.h"

Expand Down
1 change: 1 addition & 0 deletions archive-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "archive.h"
#include "streaming.h"
#include "utf8.h"
#include "object-store.h"
#include "userdiff.h"
#include "xdiff-interface.h"

Expand Down
1 change: 1 addition & 0 deletions archive.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions blame.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "cache.h"
#include "refs.h"
#include "object-store.h"
#include "cache-tree.h"
#include "mergesort.h"
#include "diff.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 [<options>] [<rev-opts>] [<rev>] [--] <file>");
Expand Down
1 change: 1 addition & 0 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "tree-walk.h"
#include "sha1-array.h"
#include "packfile.h"
#include "object-store.h"

struct batch_options {
int enabled;
Expand Down
1 change: 1 addition & 0 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/commit-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include "cache.h"
#include "config.h"
#include "object-store.h"
#include "commit.h"
#include "tree.h"
#include "builtin.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions builtin/difftool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions builtin/fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/fmt-merge-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/hash-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
#include "builtin.h"
#include "config.h"
#include "object-store.h"
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/ls-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include "cache.h"
#include "config.h"
#include "object-store.h"
#include "blob.h"
#include "tree.h"
#include "commit.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/merge-tree.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/mktag.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions builtin/mktree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "quote.h"
#include "tree.h"
#include "parse-options.h"
#include "object-store.h"

static struct treeent {
unsigned mode;
Expand Down
1 change: 1 addition & 0 deletions builtin/notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions builtin/prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <time>] [--] [<head>...]"),
Expand Down
1 change: 1 addition & 0 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "tmp-objdir.h"
#include "oidset.h"
#include "packfile.h"
#include "object-store.h"
#include "protocol.h"

static const char * const receive_pack_usage[] = {
Expand Down
1 change: 1 addition & 0 deletions builtin/reflog.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
#include "object-store.h"
#include "commit.h"
#include "refs.h"
#include "dir.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "strbuf.h"
#include "run-command.h"
#include "refs.h"
#include "object-store.h"
#include "argv-array.h"

static const char * const builtin_remote_usage[] = {
Expand Down
1 change: 1 addition & 0 deletions builtin/rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "list-objects.h"
#include "list-objects-filter.h"
#include "list-objects-filter-options.h"
#include "object-store.h"
#include "pack.h"
#include "pack-bitmap.h"
#include "builtin.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/show-ref.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "cache.h"
#include "refs.h"
#include "object-store.h"
#include "object.h"
#include "tag.h"
#include "string-list.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "config.h"
#include "builtin.h"
#include "refs.h"
#include "object-store.h"
#include "tag.h"
#include "run-command.h"
#include "parse-options.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/unpack-file.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
#include "object-store.h"

static char *create_temp_file(struct object_id *oid)
{
Expand Down
1 change: 1 addition & 0 deletions builtin/unpack-objects.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "object-store.h"
#include "object.h"
#include "delta.h"
#include "pack.h"
Expand Down
1 change: 1 addition & 0 deletions builtin/verify-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "object-store.h"
#include "commit.h"
#include "run-command.h"
#include <signal.h>
Expand Down
1 change: 1 addition & 0 deletions bulk-checkin.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "pack.h"
#include "strbuf.h"
#include "packfile.h"
#include "object-store.h"

static struct bulk_checkin_state {
unsigned plugged:1;
Expand Down
1 change: 1 addition & 0 deletions bundle.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "cache.h"
#include "lockfile.h"
#include "bundle.h"
#include "object-store.h"
#include "object.h"
#include "commit.h"
#include "diff.h"
Expand Down
1 change: 1 addition & 0 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
#include "object-store.h"

#ifndef DEBUG
#define DEBUG 0
Expand Down
Loading

0 comments on commit cbd53a2

Please sign in to comment.