Subject: Re: [PATCH v2 00/20] Introduce `USE_THE_REPOSITORY_VARIABLE` macro

From: Junio C Hamano <[email-masked]>
Date: Thu, 13 Jun 2024 11:48:54 -0700

Junio C Hamano <[email-masked]> writes:

> Patrick Steinhardt <[email-masked]> writes:
>
>> this is the second version of my patch series that introduce a new
>> `USE_THE_REPOSITORY_VARIABLE` macro. If undefined, then declarations
>> like `the_repository`, `the_hash_algo` and a subset of functions that
>> implicitly depend on either of these are hidden away.
>
> ;-)

Two things.

(1) This stupid change was needed to please "make sparse", or we'd
    get this:

    repository.c:21:19: error: symbol 'the_repository' was not declared. Should it be static?
    gmake: *** [Makefile:3259: repository.sp] Error 1

 repository.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git c/repository.c w/repository.c
index 95d10cc4a0..22ef85b0b3 100644
--- c/repository.c
+++ w/repository.c
@@ -18,6 +18,8 @@
 
 /* The main repository */
 static struct repository the_repo;
+
+extern struct repository *the_repository;
 struct repository *the_repository = &the_repo;
 
 /*

(2) Aside from a few trivial and expected textual conflicts to be
    resolved, there were a few new files added that needed
    merge-fixes, with which I have this topic at the tip of the
    'seen' branch.

 index-info.c   | 2 ++
 pseudo-merge.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/index-info.c b/index-info.c
index 5d61e61e28..791380f910 100644
--- a/index-info.c
+++ b/index-info.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "index-info.h"
 #include "hash.h"
diff --git a/pseudo-merge.c b/pseudo-merge.c
index e3e0393f11..f0fde13c47 100644
--- a/pseudo-merge.c
+++ b/pseudo-merge.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
 #include "git-compat-util.h"
 #include "pseudo-merge.h"
 #include "date.h"
-- 
2.45.2-683-gddb3e810f1