hash-ll.h: split out of hash.h to remove dependency on repository.h

hash.h depends upon and includes repository.h, due to the definition and
use of the_hash_algo (defined as the_repository->hash_algo).  However,
most headers trying to include hash.h are only interested in the layout
of the structs like object_id.  Move the parts of hash.h that do not
depend upon repository.h into a new file hash-ll.h (the "low level"
parts of hash.h), and adjust other files to use this new header where
the convenience inline functions aren't needed.

This allows hash.h and object.h to be fairly small, minimal headers.  It
also exposes a lot of hidden dependencies on both path.h (which was
brought in by repository.h) and repository.h (which was previously
implicitly brought in by object.h), so also adjust other files to be
more explicit about what they depend upon.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2023-04-22 20:17:20 +00:00
committed by Junio C Hamano
parent 23a517e415
commit d1cbe1e6d8
109 changed files with 398 additions and 292 deletions

View File

@ -2,6 +2,7 @@
#include "bloom.h"
#include "hex.h"
#include "commit.h"
#include "repository.h"
#include "setup.h"
static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;

View File

@ -6,6 +6,7 @@
#include "tree.h"
#include "cache-tree.h"
#include "parse-options.h"
#include "repository.h"
#include "setup.h"
static char const * const test_cache_tree_usage[] = {

View File

@ -1,9 +1,11 @@
#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
#include "hash.h"
#include "hex.h"
#include "tree.h"
#include "cache-tree.h"
#include "repository.h"
#include "setup.h"
static void dump_one(struct cache_tree *it, const char *pfx, const char *x)

View File

@ -1,5 +1,6 @@
#include "test-tool.h"
#include "cache.h"
#include "repository.h"
#include "setup.h"
int cmd__dump_fsmonitor(int ac, const char **av)

View File

@ -3,6 +3,7 @@
#include "cache.h"
#include "dir.h"
#include "hex.h"
#include "repository.h"
#include "setup.h"
static int compare_untracked(const void *a_, const void *b_)

View File

@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "object.h"
#include "decorate.h"
#include "repository.h"
int cmd__example_decorate(int argc, const char **argv)
{

View File

@ -7,6 +7,7 @@
#include "cache.h"
#include "parse-options.h"
#include "fsmonitor-ipc.h"
#include "repository.h"
#include "setup.h"
#include "thread-utils.h"
#include "trace2.h"

View File

@ -3,6 +3,7 @@
#include "cache.h"
#include "environment.h"
#include "parse-options.h"
#include "repository.h"
#include "setup.h"
#include "trace.h"

View File

@ -3,6 +3,7 @@
#include "hex.h"
#include "match-trees.h"
#include "object-name.h"
#include "repository.h"
#include "setup.h"
#include "tree.h"

View File

@ -2,6 +2,7 @@
#include "hex.h"
#include "object-name.h"
#include "oidmap.h"
#include "repository.h"
#include "setup.h"
#include "strbuf.h"

View File

@ -2,6 +2,7 @@
#include "cache.h"
#include "abspath.h"
#include "environment.h"
#include "path.h"
#include "setup.h"
#include "string-list.h"
#include "trace.h"

View File

@ -2,6 +2,7 @@
#include "test-tool.h"
#include "cache.h"
#include "config.h"
#include "repository.h"
#include "setup.h"
#include "wrapper.h"

View File

@ -2,6 +2,7 @@
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
#include "repository.h"
#include "setup.h"
#include "tree.h"
#include "cache-tree.h"

View File

@ -1,6 +1,8 @@
#include "test-tool.h"
#include "config.h"
#include "hash.h"
#include "object-name.h"
#include "repository.h"
#include "setup.h"
#include "submodule-config.h"
#include "submodule.h"

View File

@ -1,4 +1,5 @@
#include "test-tool.h"
#include "repository.h"
#include "setup.h"
#include "submodule-config.h"

View File

@ -2,6 +2,7 @@
#include "test-tool-utils.h"
#include "parse-options.h"
#include "remote.h"
#include "repository.h"
#include "setup.h"
#include "submodule-config.h"
#include "submodule.h"

View File

@ -3,6 +3,7 @@
#include "run-command.h"
#include "exec-cmd.h"
#include "config.h"
#include "repository.h"
#include "trace2.h"
typedef int(fn_unit_test)(int argc, const char **argv);

View File

@ -2,6 +2,7 @@
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
#include "repository.h"
#include "setup.h"
int cmd__write_cache(int argc, const char **argv)