git/builtin
Patrick Steinhardt e7da938570 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>
2024-06-14 10:26:33 -07:00
..
add.c Merge branch 'ps/the-index-is-no-more' 2024-05-08 10:18:44 -07:00
am.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
annotate.c
apply.c apply: fix uninitialized hash function 2024-05-21 09:07:48 -07:00
archive.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:33 -08:00
bisect.c cocci: apply rules to rewrite callers of "refs" interfaces 2024-05-07 10:06:59 -07:00
blame.c global: introduce USE_THE_REPOSITORY_VARIABLE macro 2024-06-14 10:26:33 -07:00
branch.c Merge branch 'kn/ref-transaction-symref' 2024-05-20 11:20:04 -07:00
bugreport.c bugreport.c: fix a crash in git bugreport with --no-suffix option 2024-03-16 09:31:42 -07:00
bundle.c builtin/bundle: abort "verify" early when there is no repository 2024-05-06 22:50:49 -07:00
cat-file.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
check-attr.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
check-ignore.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
check-mailmap.c builtin.h: remove unneccessary includes 2023-06-21 13:39:54 -07:00
check-ref-format.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
checkout--worker.c git-compat-util: move alloc macros to git-compat-util.h 2023-07-05 11:42:31 -07:00
checkout-index.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
checkout.c checkout: clarify memory ownership in unique_tracking_name() 2024-05-27 11:19:58 -07:00
clean.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
clone.c Merge branch 'ps/ref-storage-migration' into ps/use-the-repository 2024-06-13 09:39:08 -07:00
column.c column: disallow negative padding 2024-02-13 10:18:50 -08:00
commit-graph.c Merge branch 'ja/doc-placeholders-fix' 2024-02-08 13:20:34 -08:00
commit-tree.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
commit.c config: clarify memory ownership in git_config_string() 2024-05-27 11:20:00 -07:00
config.c Merge branch 'ps/leakfixes' 2024-06-06 12:49:23 -07:00
count-objects.c count-objects: mark unused parameter in alternates callback 2023-07-13 17:24:00 -07:00
credential-cache--daemon.c Merge branch 'bc/credential-scheme-enhancement' 2024-05-08 10:18:44 -07:00
credential-cache.c Merge branch 'bc/credential-scheme-enhancement' 2024-05-08 10:18:44 -07:00
credential-store.c credential: gate new fields on capability 2024-04-16 22:39:06 -07:00
credential.c builtin/credential: clear credential before exit 2024-05-27 11:20:01 -07:00
describe.c refs: pass repo when peeling objects 2024-05-17 10:33:39 -07:00
diagnose.c object-file.h: move declarations for object-file.c functions from cache.h 2023-04-11 08:52:10 -07:00
diff-files.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
diff-index.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
diff-tree.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
diff.c builtin/diff: explicitly set hash algo when there is no repo 2024-05-06 22:50:49 -07:00
difftool.c Merge branch 'rs/difftool-env-simplify' 2024-06-06 12:49:24 -07:00
fast-export.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
fast-import.c hash: require hash algorithm in is_empty_{blob,tree}_oid() 2024-06-14 10:26:33 -07:00
fetch-pack.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
fetch.c Merge branch 'ps/refs-without-the-repository-updates' 2024-05-30 14:15:13 -07:00
fmt-merge-msg.c treewide: remove unnecessary includes for wrapper.h 2023-07-05 11:41:59 -07:00
for-each-ref.c ref-filter: properly distinuish pseudo and root refs 2024-05-15 07:30:52 -07:00
for-each-repo.c for-each-repo: optionally keep going on an error 2024-04-24 10:46:03 -07:00
fsck.c cocci: apply rules to rewrite callers of "refs" interfaces 2024-05-07 10:06:59 -07:00
fsmonitor--daemon.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:33 -08:00
gc.c refs: pass repo when peeling objects 2024-05-17 10:33:39 -07:00
get-tar-commit-id.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
grep.c Merge branch 'eb/hash-transition' 2024-03-28 14:13:50 -07:00
hash-object.c builtin/hash-object: fix uninitialized hash function 2024-05-21 09:05:13 -07:00
help.c Merge branch 'gc/config-context' 2023-07-06 11:54:48 -07:00
hook.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
index-pack.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
init-db.c refs: convert ref storage format to an enum 2024-06-06 09:04:31 -07:00
interpret-trailers.c Merge branch 'la/hide-trailer-info' 2024-05-23 11:04:27 -07:00
log.c global: introduce USE_THE_REPOSITORY_VARIABLE macro 2024-06-14 10:26:33 -07:00
ls-files.c factor out strbuf_expand_bad_format() 2024-03-25 11:59:24 -07:00
ls-remote.c Merge branch 'en/header-cleanup' 2024-01-08 14:05:15 -08:00
ls-tree.c Merge branch 'rs/strbuf-expand-bad-format' 2024-04-03 10:56:20 -07:00
mailinfo.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
mailsplit.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
merge-base.c commit-reach(repo_get_merge_bases_many_dirty): pass on errors 2024-02-29 08:06:01 -08:00
merge-file.c merge-file: add --diff-algorithm option 2023-11-22 14:23:06 +09:00
merge-index.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
merge-ours.c diff.h: remove unnecessary include of oidset.h 2023-06-21 13:39:53 -07:00
merge-recursive.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
merge-tree.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
merge.c hash: require hash algorithm in empty_tree_oid_hex() 2024-06-14 10:26:33 -07:00
mktag.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:33 -08:00
mktree.c git-compat-util: move alloc macros to git-compat-util.h 2023-07-05 11:42:31 -07:00
multi-pack-index.c midx: disable replace objects 2024-04-17 12:35:41 -07:00
mv.c mv: replace src_dir with a strvec 2024-05-30 08:55:29 -07:00
name-rev.c cocci: apply rules to rewrite callers of "refs" interfaces 2024-05-07 10:06:59 -07:00
notes.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
pack-objects.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
pack-redundant.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
pack-refs.c builtin/pack-refs: introduce new "--auto" flag 2024-03-25 09:54:07 -07:00
patch-id.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
prune-packed.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
prune.c Merge branch 'en/header-split-cache-h-part-3' 2023-06-29 16:43:21 -07:00
pull.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
push.c Merge branch 'en/header-cleanup' into maint-2.43 2024-02-08 16:22:10 -08:00
range-diff.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
read-tree.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
rebase.c config: clarify memory ownership in git_config_string() 2024-05-27 11:20:00 -07:00
receive-pack.c hash: require hash algorithm in empty_tree_oid_hex() 2024-06-14 10:26:33 -07:00
reflog.c refs: remove dwim_log() 2024-05-17 10:33:39 -07:00
refs.c builtin/refs: new command to migrate ref storage formats 2024-06-06 09:04:34 -07:00
remote-ext.c builtins: annotate always-empty prefix parameters 2023-03-28 14:11:24 -07:00
remote-fd.c builtins: annotate always-empty prefix parameters 2023-03-28 14:11:24 -07:00
remote.c Merge branch 'ps/refs-without-the-repository-updates' 2024-05-30 14:15:13 -07:00
repack.c Merge branch 'ps/leakfixes' 2024-06-06 12:49:23 -07:00
replace.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
replay.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00
rerere.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
reset.c Merge branch 'ps/refs-without-the-repository' 2024-05-16 10:10:14 -07:00
rev-list.c Merge branch 'jk/pretty-subject-cleanup' 2024-04-01 13:21:34 -07:00
rev-parse.c Merge branch 'ps/undecided-is-not-necessarily-sha1' 2024-05-30 14:15:11 -07:00
revert.c cherry-pick: add --empty for more robust redundant commit handling 2024-03-25 16:45:41 -07:00
rm.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
send-pack.c Merge branch 'en/header-cleanup' into maint-2.43 2024-02-08 16:22:10 -08:00
shortlog.c builtin/shortlog: don't set up revisions without repo 2024-05-06 22:50:50 -07:00
show-branch.c cocci: apply rules to rewrite callers of "refs" interfaces 2024-05-07 10:06:59 -07:00
show-index.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
show-ref.c refs: pass repo when peeling objects 2024-05-17 10:33:39 -07:00
sparse-checkout.c sparse-checkout: free duplicate hashmap entries 2024-06-05 09:51:43 -07:00
stash.c Merge branch 'ps/refs-without-the-repository' 2024-05-16 10:10:14 -07:00
stripspace.c strbuf: accept a comment string for strbuf_add_commented_lines() 2024-03-12 13:28:10 -07:00
submodule--helper.c Merge branch 'gt/t-hash-unit-test' 2024-06-12 13:37:15 -07:00
symbolic-ref.c Merge branch 'kn/ref-transaction-symref' 2024-05-20 11:20:04 -07:00
tag.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
unpack-file.c treewide: remove unnecessary includes for wrapper.h 2023-07-05 11:41:59 -07:00
unpack-objects.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
update-index.c refs: refactor resolve_gitlink_ref() to accept a repository 2024-05-17 10:33:38 -07:00
update-ref.c hash: require hash algorithm in oidread() and oidclr() 2024-06-14 10:26:32 -07:00
update-server-info.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
upload-archive.c repository: remove unnecessary include of path.h 2023-06-21 13:39:53 -07:00
upload-pack.c Sync with 2.44.1 2024-04-29 20:42:30 +02:00
var.c refs: drop git_default_branch_name() 2024-05-17 10:33:39 -07:00
verify-commit.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
verify-pack.c builtin.h: remove unneccessary includes 2023-06-21 13:39:54 -07:00
verify-tag.c treewide: remove unnecessary includes in source files 2023-12-26 12:04:31 -08:00
worktree.c Merge branch 'ps/leakfixes' 2024-06-06 12:49:23 -07:00
write-tree.c builtin: stop using the_index 2024-04-18 12:30:42 -07:00