Git fork

global: introduce `USE_THE_REPOSITORY_VARIABLE` macro

Use of the `the_repository` variable is deprecated nowadays, and we
slowly but steadily convert the codebase to not use it anymore. Instead,
callers should be passing down the repository to work on via parameters.

It is hard though to prove that a given code unit does not use this
variable anymore. The most trivial case, merely demonstrating that there
is no direct use of `the_repository`, is already a bit of a pain during
code reviews as the reviewer needs to manually verify claims made by the
patch author. The bigger problem though is that we have many interfaces
that implicitly rely on `the_repository`.

Introduce a new `USE_THE_REPOSITORY_VARIABLE` macro that allows code
units to opt into usage of `the_repository`. The intent of this macro is
to demonstrate that a certain code unit does not use this variable
anymore, and to keep it from new dependencies on it in future changes,
be it explicit or implicit

For now, the macro only guards `the_repository` itself as well as
`the_hash_algo`. There are many more known interfaces where we have an
implicit dependency on `the_repository`, but those are not guarded at
the current point in time. Over time though, we should start to add
guards as required (or even better, just remove them).

Define the macro as required in our code units. As expected, most of our
code still relies on the global variable. Nearly all of our builtins
rely on the variable as there is no way yet to pass `the_repository` to
their entry point. For now, declare the macro in "biultin.h" to keep the
required changes at least a little bit more contained.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
e7da9385 7abbca0e

+347 -3
+2
add-interactive.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "add-interactive.h" 3 5 #include "color.h"
+2
add-patch.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "add-interactive.h" 3 5 #include "advice.h"
+2
apply.c
··· 7 7 * 8 8 */ 9 9 10 + #define USE_THE_REPOSITORY_VARIABLE 11 + 10 12 #include "git-compat-util.h" 11 13 #include "abspath.h" 12 14 #include "base85.h"
+3
archive-tar.c
··· 1 1 /* 2 2 * Copyright (c) 2005, 2006 Rene Scharfe 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "config.h" 6 9 #include "gettext.h"
+3
archive-zip.c
··· 1 1 /* 2 2 * Copyright (c) 2006 Rene Scharfe 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "config.h" 6 9 #include "archive.h"
+2
archive.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "config.h"
+2
attr.c
··· 6 6 * an insanely large number of attributes. 7 7 */ 8 8 9 + #define USE_THE_REPOSITORY_VARIABLE 10 + 9 11 #include "git-compat-util.h" 10 12 #include "config.h" 11 13 #include "environment.h"
+2
bisect.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "commit.h"
+2
blame.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "refs.h" 3 5 #include "object-store-ll.h"
+2
branch.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "config.h"
+8
builtin.h
··· 1 1 #ifndef BUILTIN_H 2 2 #define BUILTIN_H 3 3 4 + /* 5 + * TODO: Almost all of our builtins access `the_repository` by necessity 6 + * because they do not get passed a pointer to it. We should adapt the function 7 + * signature of those main functions to accept a `struct repository *` and then 8 + * remove the macro here. 9 + */ 10 + #define USE_THE_REPOSITORY_VARIABLE 11 + 4 12 #include "git-compat-util.h" 5 13 6 14 /*
+1 -1
builtin/blame.c
··· 5 5 * See COPYING for licensing conditions 6 6 */ 7 7 8 - #include "git-compat-util.h" 8 + #include "builtin.h" 9 9 #include "config.h" 10 10 #include "color.h" 11 11 #include "builtin.h"
+1 -1
builtin/log.c
··· 4 4 * (C) Copyright 2006 Linus Torvalds 5 5 * 2006 Junio Hamano 6 6 */ 7 - #include "git-compat-util.h" 7 + #include "builtin.h" 8 8 #include "abspath.h" 9 9 #include "config.h" 10 10 #include "environment.h"
+3
bulk-checkin.c
··· 1 1 /* 2 2 * Copyright (c) 2011, Google Inc. 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "bulk-checkin.h" 6 9 #include "environment.h"
+2
bundle-uri.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "bundle-uri.h" 3 5 #include "bundle.h"
+2
bundle.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "lockfile.h" 3 5 #include "bundle.h"
+2
cache-tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "hex.h"
+2
checkout.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "object-name.h" 3 5 #include "remote.h"
+2
chunk-format.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "chunk-format.h" 3 5 #include "csum-file.h"
+2
combine-diff.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "object-store-ll.h" 3 5 #include "commit.h"
+2
commit-graph.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "csum-file.h"
+2
commit-reach.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit.h" 3 5 #include "commit-graph.h"
+2
commit.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "tag.h" 3 5 #include "commit.h"
+2
common-main.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "exec-cmd.h" 3 5 #include "gettext.h"
+2
compat/win32/trace2_win32_process_info.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "../../git-compat-util.h" 2 4 #include "../../json-writer.h" 3 5 #include "../../repository.h"
+3
config.c
··· 5 5 * Copyright (C) Johannes Schindelin, 2005 6 6 * 7 7 */ 8 + 9 + #define USE_THE_REPOSITORY_VARIABLE 10 + 8 11 #include "git-compat-util.h" 9 12 #include "abspath.h" 10 13 #include "advice.h"
+2
connected.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+2
convert.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "config.h"
+3
csum-file.c
··· 7 7 * files. Useful when you write a file that you want to be 8 8 * able to verify hasn't been messed with afterwards. 9 9 */ 10 + 11 + #define USE_THE_REPOSITORY_VARIABLE 12 + 10 13 #include "git-compat-util.h" 11 14 #include "progress.h" 12 15 #include "csum-file.h"
+2
delta-islands.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "object.h" 3 5 #include "commit.h"
+2
diagnose.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "diagnose.h" 3 5 #include "compat/disk.h"
+3
diff-lib.c
··· 1 1 /* 2 2 * Copyright (C) 2005 Junio C Hamano 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "commit.h" 6 9 #include "diff.h"
+3
diff.c
··· 1 1 /* 2 2 * Copyright (C) 2005 Junio C Hamano 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "abspath.h" 6 9 #include "base85.h"
+3
diffcore-break.c
··· 1 1 /* 2 2 * Copyright (C) 2005 Junio C Hamano 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "diffcore.h" 6 9 #include "hash.h"
+3
diffcore-rename.c
··· 2 2 * 3 3 * Copyright (C) 2005 Junio C Hamano 4 4 */ 5 + 6 + #define USE_THE_REPOSITORY_VARIABLE 7 + 5 8 #include "git-compat-util.h" 6 9 #include "diff.h" 7 10 #include "diffcore.h"
+3
dir.c
··· 5 5 * Copyright (C) Linus Torvalds, 2005-2006 6 6 * Junio Hamano, 2005-2006 7 7 */ 8 + 9 + #define USE_THE_REPOSITORY_VARIABLE 10 + 8 11 #include "git-compat-util.h" 9 12 #include "abspath.h" 10 13 #include "config.h"
+2
entry.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "object-store-ll.h" 3 5 #include "dir.h"
+3
environment.c
··· 7 7 * even if you might want to know where the git directory etc 8 8 * are. 9 9 */ 10 + 11 + #define USE_THE_REPOSITORY_VARIABLE 12 + 10 13 #include "git-compat-util.h" 11 14 #include "abspath.h" 12 15 #include "branch.h"
+2
fetch-pack.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "repository.h" 3 5 #include "config.h"
+2
fmt-merge-msg.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
fsck.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "date.h" 3 5 #include "dir.h"
+2
fsmonitor-ipc.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "simple-ipc.h"
+2
git.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "builtin.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
hash-lookup.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hash.h" 3 5 #include "hash-lookup.h"
+3 -1
hash.h
··· 4 4 #include "hash-ll.h" 5 5 #include "repository.h" 6 6 7 - #define the_hash_algo the_repository->hash_algo 7 + #ifdef USE_THE_REPOSITORY_VARIABLE 8 + # define the_hash_algo the_repository->hash_algo 9 + #endif 8 10 9 11 #endif
+2
help.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "builtin.h"
+2
hex.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hash.h" 3 5 #include "hex.h"
+2
http-backend.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
http-push.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "hex.h"
+2
http-walker.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "repository.h" 3 5 #include "hex.h"
+2
http.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "git-curl-compat.h" 3 5 #include "hex.h"
+2
list-objects-filter-options.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "gettext.h"
+2
list-objects-filter.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "dir.h" 3 5 #include "gettext.h"
+2
list-objects.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "tag.h" 3 5 #include "commit.h"
+2
log-tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit-reach.h" 3 5 #include "config.h"
+2
loose.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hash.h" 3 5 #include "path.h"
+2
ls-refs.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
mailmap.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "string-list.h"
+2
match-trees.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hex.h" 3 5 #include "match-trees.h"
+2
merge-blobs.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "merge-ll.h" 3 5 #include "blob.h"
+2
merge-ort.c
··· 14 14 * "cale", "peedy", or "ins" instead of "ort"?) 15 15 */ 16 16 17 + #define USE_THE_REPOSITORY_VARIABLE 18 + 17 19 #include "git-compat-util.h" 18 20 #include "merge-ort.h" 19 21
+3
merge-recursive.c
··· 3 3 * Fredrik Kuivinen. 4 4 * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006 5 5 */ 6 + 7 + #define USE_THE_REPOSITORY_VARIABLE 8 + 6 9 #include "git-compat-util.h" 7 10 #include "merge-recursive.h" 8 11
+2
merge.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hash.h"
+2
midx-write.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "config.h"
+2
midx.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "dir.h"
+2
negotiator/default.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "default.h" 3 5 #include "../commit.h"
+2
negotiator/skipping.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "skipping.h" 3 5 #include "../commit.h"
+2
notes-cache.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "notes-cache.h" 3 5 #include "object-store-ll.h"
+2
notes-merge.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "commit.h"
+2
notes-utils.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "commit.h"
+2
notes.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
object-file-convert.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "strbuf.h"
+3
object-file.c
··· 6 6 * This handles basic git object files - packing, unpacking, 7 7 * creation etc. 8 8 */ 9 + 10 + #define USE_THE_REPOSITORY_VARIABLE 11 + 9 12 #include "git-compat-util.h" 10 13 #include "abspath.h" 11 14 #include "config.h"
+2
object-name.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "object-name.h" 3 5 #include "advice.h"
+2
object.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+2
oid-array.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "oid-array.h" 3 5 #include "hash-lookup.h"
+2
oss-fuzz/fuzz-commit-graph.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit-graph.h" 3 5 #include "repository.h"
+2
pack-bitmap-write.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
pack-bitmap.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit.h" 3 5 #include "gettext.h"
+2
pack-check.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "hex.h"
+2
pack-revindex.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "pack-revindex.h"
+2
pack-write.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
packfile.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
parse-options-cb.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "parse-options.h" 3 5 #include "branch.h"
+3
path.c
··· 1 1 /* 2 2 * Utilities for paths and pathnames 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "abspath.h" 6 9 #include "environment.h"
+2
pathspec.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "parse.h"
+2
pretty.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "commit.h"
+2
progress.c
··· 9 9 */ 10 10 11 11 #define GIT_TEST_PROGRESS_ONLY 12 + #define USE_THE_REPOSITORY_VARIABLE 13 + 12 14 #include "git-compat-util.h" 13 15 #include "pager.h" 14 16 #include "progress.h"
+2
promisor-remote.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+2
range-diff.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
reachable.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+3
read-cache.c
··· 3 3 * 4 4 * Copyright (C) Linus Torvalds, 2005 5 5 */ 6 + 7 + #define USE_THE_REPOSITORY_VARIABLE 8 + 6 9 #include "git-compat-util.h" 7 10 #include "bulk-checkin.h" 8 11 #include "config.h"
+2
rebase-interactive.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit.h" 3 5 #include "editor.h"
+2
ref-filter.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "gettext.h"
+2
reflog-walk.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "commit.h" 3 5 #include "refs.h"
+2
reflog.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "object-store-ll.h"
+2
refs.c
··· 2 2 * The backend-independent part of the reference module. 3 3 */ 4 4 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 5 7 #include "git-compat-util.h" 6 8 #include "advice.h" 7 9 #include "config.h"
+2
refs/files-backend.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "../git-compat-util.h" 2 4 #include "../copy.h" 3 5 #include "../environment.h"
+2
refs/packed-backend.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "../git-compat-util.h" 2 4 #include "../config.h" 3 5 #include "../dir.h"
+2
refs/reftable-backend.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "../git-compat-util.h" 2 4 #include "../abspath.h" 3 5 #include "../chdir-notify.h"
+2
refspec.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hash.h"
+2
remote-curl.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "git-curl-compat.h" 3 5 #include "config.h"
+2
remote.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "config.h"
+8
repository.c
··· 16 16 #include "promisor-remote.h" 17 17 #include "refs.h" 18 18 19 + /* 20 + * We do not define `USE_THE_REPOSITORY_VARIABLE` in this file because we do 21 + * not want to rely on functions that implicitly use `the_repository`. This 22 + * means that the `extern` declaration of `the_repository` isn't visible here, 23 + * which makes sparse unhappy. We thus declare it here. 24 + */ 25 + extern struct repository *the_repository; 26 + 19 27 /* The main repository */ 20 28 static struct repository the_repo; 21 29 struct repository *the_repository = &the_repo;
+2
repository.h
··· 197 197 unsigned different_commondir:1; 198 198 }; 199 199 200 + #ifdef USE_THE_REPOSITORY_VARIABLE 200 201 extern struct repository *the_repository; 202 + #endif 201 203 202 204 /* 203 205 * Define a custom repository layout. Any field can be NULL, which
+2
rerere.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "config.h"
+2
reset.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "cache-tree.h" 3 5 #include "gettext.h"
+2
resolve-undo.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "dir.h" 3 5 #include "hash.h"
+2
revision.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
run-command.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "run-command.h" 3 5 #include "environment.h"
+2
scalar.c
··· 2 2 * The Scalar command-line interface. 3 3 */ 4 4 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 5 7 #include "git-compat-util.h" 6 8 #include "abspath.h" 7 9 #include "gettext.h"
+2
send-pack.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "commit.h"
+2
sequencer.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "advice.h"
+2
serve.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "repository.h" 3 5 #include "config.h"
+2
server-info.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "dir.h" 3 5 #include "environment.h"
+2
setup.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "copy.h"
+2
shallow.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hex.h" 3 5 #include "repository.h"
+2
split-index.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hash.h"
+3
streaming.c
··· 1 1 /* 2 2 * Copyright (c) 2011, Google Inc. 3 3 */ 4 + 5 + #define USE_THE_REPOSITORY_VARIABLE 6 + 4 7 #include "git-compat-util.h" 5 8 #include "convert.h" 6 9 #include "environment.h"
+2
submodule-config.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "dir.h" 3 5 #include "environment.h"
+2
submodule.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "repository.h"
+2
t/helper/test-bitmap.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "git-compat-util.h" 3 5 #include "pack-bitmap.h"
+2
t/helper/test-bloom.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "bloom.h" 3 5 #include "hex.h"
+2
t/helper/test-cache-tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+2
t/helper/test-dump-cache-tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hash.h" 3 5 #include "hex.h"
+2
t/helper/test-dump-fsmonitor.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "read-cache-ll.h" 3 5 #include "repository.h"
+2
t/helper/test-dump-split-index.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "read-cache-ll.h"
+2
t/helper/test-dump-untracked-cache.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "dir.h" 3 5 #include "hex.h"
+2
t/helper/test-find-pack.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "object-name.h" 3 5 #include "object-store.h"
+2
t/helper/test-fsmonitor-client.c
··· 3 3 * a `git fsmonitor--daemon` daemon. 4 4 */ 5 5 6 + #define USE_THE_REPOSITORY_VARIABLE 7 + 6 8 #include "test-tool.h" 7 9 #include "parse-options.h" 8 10 #include "fsmonitor-ipc.h"
+2
t/helper/test-lazy-init-name-hash.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "environment.h" 3 5 #include "name-hash.h"
+2
t/helper/test-match-trees.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "match-trees.h"
+2
t/helper/test-oidmap.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "object-name.h"
+2
t/helper/test-pack-mtimes.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "strbuf.h"
+2
t/helper/test-reach.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "commit.h" 3 5 #include "commit-reach.h"
+2
t/helper/test-read-cache.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "config.h" 3 5 #include "read-cache-ll.h"
+2
t/helper/test-read-graph.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "commit-graph.h" 3 5 #include "repository.h"
+2
t/helper/test-read-midx.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "midx.h"
+2
t/helper/test-ref-store.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "hex.h" 3 5 #include "refs.h"
+2
t/helper/test-repository.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "commit-graph.h" 3 5 #include "commit.h"
+2
t/helper/test-revision-walking.c
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 11 + #define USE_THE_REPOSITORY_VARIABLE 12 + 11 13 #include "test-tool.h" 12 14 #include "commit.h" 13 15 #include "diff.h"
+2
t/helper/test-scrap-cache-tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "lockfile.h" 3 5 #include "read-cache-ll.h"
+2
t/helper/test-submodule-config.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "config.h" 3 5 #include "hash.h"
+2
t/helper/test-submodule-nested-repo-config.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "repository.h" 3 5 #include "setup.h"
+2
t/helper/test-submodule.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "test-tool-utils.h" 3 5 #include "parse-options.h"
+2
t/helper/test-trace2.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "strvec.h" 3 5 #include "run-command.h"
+2
t/helper/test-write-cache.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "lockfile.h" 3 5 #include "read-cache-ll.h"
+2
t/unit-tests/t-example-decorate.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-lib.h" 2 4 #include "object.h" 3 5 #include "decorate.h"
+2
tag.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "environment.h" 3 5 #include "tag.h"
+2
tmp-objdir.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "tmp-objdir.h" 3 5 #include "abspath.h"
+2
transport-helper.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "transport.h" 3 5 #include "quote.h"
+2
transport.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "config.h"
+2
tree-walk.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "tree-walk.h" 3 5 #include "dir.h"
+2
tree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "hex.h" 3 5 #include "tree.h"
+2
unpack-trees.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "strvec.h"
+2
upload-pack.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "config.h" 3 5 #include "environment.h"
+2
walker.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "hex.h"
+2
worktree.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "abspath.h" 3 5 #include "environment.h"
+2
wt-status.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "advice.h" 3 5 #include "wt-status.h"
+2
xdiff-interface.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "git-compat-util.h" 2 4 #include "gettext.h" 3 5 #include "config.h"