git/builtin
Patrick Steinhardt 931e8c9f52 object-file: get rid of `the_repository` in `has_loose_object()`
We implicitly depend on `the_repository` in `has_loose_object()`.
Refactor the function to accept an `odb_source` as input that should be
checked for such a loose object.

This refactoring changes semantics of the function to not check the
whole object database for such a loose object anymore, but instead we
now only check that single source. Existing callers thus need to loop
through all sources manually now.

While this change may seem illogical at first, whether or not an object
exists in a specific format should be answered by the source using that
format. As such, we can eventually convert this into a generic function
`odb_source_has_object()` that simply checks whether a given object
exists in an object source. And as we will know about the format that
any given source uses it allows us to derive whether the object exists
in a given format.

This change also makes `has_loose_object_nonlocal()` obsolete. The only
caller of this function is adapted so that it skips the primary object
source.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16 22:16:13 -07:00
..
add.c Merge branch 'ds/sparse-apply-add-p' 2025-05-27 13:59:09 -07:00
am.c usage: allow dying without writing an error message 2025-06-03 08:30:51 -07:00
annotate.c Merge branch 'jc/a-commands-without-the-repo' 2024-10-25 14:02:36 -04:00
apply.c apply: integrate with the sparse index 2025-05-16 12:00:33 -07:00
archive.c archive: remove the_repository global variable 2024-10-11 09:37:18 -07:00
backfill.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
bisect.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
blame.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
branch.c Merge branch 'rs/ref-fitler-used-atoms-value-fix' 2025-01-29 14:05:09 -08:00
bugreport.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
bundle.c Merge branch 'jt/bundle-fsck' 2024-12-13 07:33:36 -08:00
cat-file.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
check-attr.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
check-ignore.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
check-mailmap.c mailmap: fix check-mailmap with full mailmap line 2025-02-21 18:27:16 -08:00
check-ref-format.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
checkout--worker.c builtins: send usage_with_options() help text to standard output 2025-01-17 13:30:03 -08:00
checkout-index.c builtin/checkout-index: stop using `the_repository` 2025-03-07 16:52:02 -08:00
checkout.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
clean.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
clone.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
column.c parse-options: detect mismatches in integer signedness 2025-04-17 08:15:16 -07:00
commit-graph.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
commit-tree.c odb: get rid of `the_repository` in `assert_oid_type()` 2025-07-01 14:46:35 -07:00
commit.c commit: simplify code 2025-05-15 13:46:44 -07:00
config.c global: use designated initializers for options 2025-04-17 08:15:15 -07:00
count-objects.c odb: get rid of `the_repository` in `for_each()` functions 2025-07-01 14:46:36 -07:00
credential-cache--daemon.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
credential-cache.c Merge branch 'rj/cygwin-exit' 2024-11-01 12:53:19 -04:00
credential-store.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
credential.c Merge branch 'jc/show-usage-help' 2025-01-28 13:02:22 -08:00
describe.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
diagnose.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
diff-files.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
diff-index.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
diff-pairs.c builtin/diff-pairs: allow explicit diff queue flush 2025-03-03 08:17:47 -08:00
diff-tree.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
diff.c diff --no-index: support limiting by pathspec 2025-05-22 14:20:11 -07:00
difftool.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
fast-export.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
fast-import.c odb: rename `read_object_with_reference()` 2025-07-01 14:46:39 -07:00
fetch-pack.c builtin/fetch-pack: cleanup before return error 2025-06-04 08:52:25 -07:00
fetch.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
fmt-merge-msg.c parse-options: introduce precision handling for `OPTION_INTEGER` 2025-04-17 08:15:15 -07:00
for-each-ref.c builtin/for-each-ref: stop using `the_repository` 2025-03-07 16:52:02 -08:00
for-each-repo.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
fsck.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
fsmonitor--daemon.c builtins: send usage_with_options() help text to standard output 2025-01-17 13:30:03 -08:00
gc.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
get-tar-commit-id.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
grep.c odb: rename `read_object_with_reference()` 2025-07-01 14:46:39 -07:00
hash-object.c object-store: rename files to "odb.{c,h}" 2025-07-01 14:46:34 -07:00
help.c pager: stop using `the_repository` 2024-12-18 10:44:30 -08:00
hook.c builtin: pass repository to sub commands 2024-11-26 10:36:08 +09:00
index-pack.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
init-db.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
interpret-trailers.c trailer: spread usage of "trailer_block" language 2024-10-14 12:33:02 -04:00
log.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
ls-files.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
ls-remote.c global: use designated initializers for options 2025-04-17 08:15:15 -07:00
ls-tree.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
mailinfo.c mailinfo: stop using `the_repository` 2024-12-18 10:44:31 -08:00
mailsplit.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
merge-base.c commit-reach: use `size_t` to track indices when computing merge bases 2024-12-27 08:12:40 -08:00
merge-file.c object-store: rename files to "odb.{c,h}" 2025-07-01 14:46:34 -07:00
merge-index.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
merge-ours.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
merge-recursive.c builtin/merge-recursive: switch to using merge_ort_generic() 2025-04-08 13:59:11 -07:00
merge-tree.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
merge.c merge/pull: extend merge.stat configuration variable to cover --compact-summary 2025-06-13 11:54:14 -07:00
mktag.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
mktree.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
multi-pack-index.c object-store: rename files to "odb.{c,h}" 2025-07-01 14:46:34 -07:00
mv.c Merge branch 'ps/mv-contradiction-fix' 2025-05-08 12:36:32 -07:00
name-rev.c Merge branch 'ps/object-wo-the-repository' 2025-04-15 13:50:15 -07:00
notes.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
pack-objects.c object-file: get rid of `the_repository` in `has_loose_object()` 2025-07-16 22:16:13 -07:00
pack-redundant.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
pack-refs.c builtin/pack-refs: stop using `the_repository` 2025-03-07 16:52:01 -08:00
patch-id.c global: adapt callers to use generic hash context helpers 2025-01-31 10:06:11 -08:00
prune-packed.c builtin: remove USE_THE_REPOSITORY for those without the_repository 2024-09-13 14:33:30 -07:00
prune.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
pull.c Merge branch 'jk/submodule-remote-lookup-cleanup' 2025-07-07 14:12:56 -07:00
push.c remote: rename query_refspecs functions 2025-02-04 09:51:41 -08:00
range-diff.c Merge branch 'js/range-diff-diff-merges' 2024-12-23 09:32:17 -08:00
read-tree.c global: use designated initializers for options 2025-04-17 08:15:15 -07:00
rebase.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
receive-pack.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
reflog.c Merge branch 'ps/maintenance-reflog-expire' 2025-04-16 13:54:19 -07:00
refs.c Merge branch 'sj/ref-consistency-checks-more' 2025-03-26 16:26:10 +09:00
remote-ext.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
remote-fd.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
remote.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
repack.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
replace.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
replay.c repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode () 2025-06-05 08:35:22 -07:00
rerere.c rerere: let `rerere_path()` write paths into a caller-provided buffer 2025-02-28 13:54:11 -08:00
reset.c reset: integrate sparse index with --patch 2025-05-16 12:02:47 -07:00
rev-list.c odb: rename `oid_object_info()` 2025-07-01 14:46:37 -07:00
rev-parse.c path: drop `git_path()` in favor of `repo_git_path()` 2025-02-28 13:54:11 -08:00
revert.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
rm.c rm: fix sign comparison warnings 2025-03-29 01:04:40 -07:00
send-pack.c Merge branch 'jk/fix-leak-send-pack' 2025-07-07 14:12:57 -07:00
shortlog.c repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode () 2025-06-05 08:35:22 -07:00
show-branch.c Merge branch 'az/tighten-string-array-constness' 2025-04-29 14:21:28 -07:00
show-index.c Merge branch 'jc/show-index-h-update' 2025-01-31 09:44:16 -08:00
show-ref.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
sparse-checkout.c object-file: move `safe_create_leading_directories()` into "path.c" 2025-04-15 08:24:35 -07:00
stash.c Merge branch 'bc/stash-export-import' 2025-06-30 14:30:31 -07:00
stripspace.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
submodule--helper.c Merge branch 'ps/object-store' into ps/object-file-wo-the-repository 2025-07-09 16:29:52 -07:00
symbolic-ref.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
tag.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
unpack-file.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
unpack-objects.c odb: rename `has_object()` 2025-07-01 14:46:38 -07:00
update-index.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
update-ref.c refs: add function to translate errors to strings 2025-05-19 11:06:31 -07:00
update-server-info.c builtin/update-server-info: remove unnecessary if statement 2025-04-08 14:47:37 -07:00
upload-archive.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
upload-pack.c serve: stop using `the_repository` 2024-12-18 10:44:30 -08:00
var.c Merge branch 'jc/show-usage-help' 2025-01-28 13:02:22 -08:00
verify-commit.c builtin/verify-commit: stop using `the_repository` 2025-03-07 16:52:01 -08:00
verify-pack.c builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h 2024-09-13 14:32:24 -07:00
verify-tag.c builtin/verify-tag: stop using `the_repository` 2025-03-07 16:52:01 -08:00
worktree.c Merge branch 'ly/do-not-localize-bug-messages' 2025-06-17 10:44:40 -07:00
write-tree.c global: use designated initializers for options 2025-04-17 08:15:15 -07:00