summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2023-04-22 20:17:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-04-24 19:47:32 (GMT)
commitd1cbe1e6d8a9cab2b4ffe8a17d34db214dce1e49 (patch)
tree77bc199604bfda9597a2afbfce4dd121e7ba99db /refs
parent23a517e4156714c3f8c8a4e36beccfee1d76ff1f (diff)
downloadgit-d1cbe1e6d8a9cab2b4ffe8a17d34db214dce1e49.zip
git-d1cbe1e6d8a9cab2b4ffe8a17d34db214dce1e49.tar.gz
git-d1cbe1e6d8a9cab2b4ffe8a17d34db214dce1e49.tar.bz2
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>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c1
-rw-r--r--refs/packed-backend.c1
-rw-r--r--refs/ref-cache.c2
-rw-r--r--refs/ref-cache.h3
4 files changed, 6 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 1128a9a..bca7b85 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -3,6 +3,7 @@
#include "../copy.h"
#include "../environment.h"
#include "../gettext.h"
+#include "../hash.h"
#include "../hex.h"
#include "../refs.h"
#include "refs-internal.h"
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 2333ed5..704424f 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -2,6 +2,7 @@
#include "../alloc.h"
#include "../config.h"
#include "../gettext.h"
+#include "../hash.h"
#include "../hex.h"
#include "../refs.h"
#include "refs-internal.h"
diff --git a/refs/ref-cache.c b/refs/ref-cache.c
index dc1ca49..2294c45 100644
--- a/refs/ref-cache.c
+++ b/refs/ref-cache.c
@@ -1,6 +1,8 @@
#include "../git-compat-util.h"
#include "../alloc.h"
+#include "../hash.h"
#include "../refs.h"
+#include "../repository.h"
#include "refs-internal.h"
#include "ref-cache.h"
#include "../iterator.h"
diff --git a/refs/ref-cache.h b/refs/ref-cache.h
index cf4ad90..95c76e2 100644
--- a/refs/ref-cache.h
+++ b/refs/ref-cache.h
@@ -1,10 +1,11 @@
#ifndef REFS_REF_CACHE_H
#define REFS_REF_CACHE_H
-#include "hash.h"
+#include "hash-ll.h"
struct ref_dir;
struct ref_store;
+struct repository;
/*
* If this ref_cache is filled lazily, this function is used to load