git/builtin
Jeff King b87af5aa77 hash: convert remaining direct function calls
The previous patch added a coccinelle rule to make sure callers always
use git_hash_init() rather than direct function pointers from the algo
struct.

Let's do the same for the rest of the git_hash_*() wrappers. I split
these out because they're a bit different: they implicitly use the algop
pointer in the git_hash_ctx. So when we convert:

  -algo->update_fn(&ctx, buf, len);
  +git_hash_update(&ctx, buf, len);

we drop the reference to algo entirely! But this is always going to be
the right thing. If "algo" does not match what is in ctx.algop, then
we'd already be invoking undefined behavior.

So in addition to making it possible to add more logic to the
git_hash_*() functions, we're avoiding the need to pass around the extra
algo pointer and make sure that it matches what's in "ctx".

The rest of the patch is the mechanical application of that coccinelle
patch, plus a minor cleanup in test-synthesize.c to drop a now-unused
function parameter (since we don't have to pass around the algo
separately anymore).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-07 21:56:00 -07:00
..
add.c odb: split `struct odb_transaction` into separate header 2026-05-15 04:44:39 +09:00
am.c hook: mark non-parallelizable hooks 2026-04-10 07:58:53 -07:00
annotate.c
apply.c
archive.c connect: use "service" enum for "name" argument 2026-05-19 15:05:46 +09:00
backfill.c path-walk: add pl_sparse_trees to control tree pruning 2026-05-24 18:41:06 +09:00
bisect.c Merge branch 'rs/strbuf-add-oid-hex' 2026-06-09 10:04:50 +09:00
blame.c setup: stop using `the_repository` in `prefix_path()` 2026-05-19 19:36:24 +09:00
branch.c object-name: turn INTERPRET_BRANCH_* constants into enum values 2026-03-18 12:52:29 -07:00
bugreport.c
bundle.c
cat-file.c Merge branch 'js/objects-larger-than-4gb-on-windows-more' 2026-06-21 16:41:38 -07:00
check-attr.c setup: stop using `the_repository` in `setup_work_tree()` 2026-05-19 19:36:24 +09:00
check-ignore.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
check-mailmap.c mailmap: stop using the_repository 2026-02-20 08:13:58 -08:00
check-ref-format.c setup: stop using `the_repository` in `setup_git_directory_gently()` 2026-05-19 19:36:24 +09:00
checkout--worker.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
checkout-index.c setup: stop using `the_repository` in `prefix_path()` 2026-05-19 19:36:24 +09:00
checkout.c Merge branch 'ds/restore-sparse-index' 2026-06-07 23:58:24 +09:00
clean.c Merge branch 'jk/color-variable-fixes' 2025-09-29 11:40:35 -07:00
clone.c setup: stop using `the_repository` in `init_db()` 2026-05-19 19:36:25 +09:00
column.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
commit-graph.c commit-graph: add new config for changed-paths & recommend it in scalar 2025-10-22 10:40:11 -07:00
commit-tree.c commit: rename `free_commit_list()` to conform to coding guidelines 2026-01-15 05:32:31 -08:00
commit.c sequencer: teach autostash apply to take optional conflict marker labels 2026-04-29 21:46:03 +09:00
config.c config: improve diagnostic for "set" with missing value 2026-06-03 08:39:54 +09:00
count-objects.c packfile: introduce macro to iterate through packs 2025-10-16 14:42:39 -07:00
credential-cache--daemon.c config: drop `git_config_get_bool()` wrapper 2025-07-23 08:15:20 -07:00
credential-cache.c
credential-store.c builtin/credential-store: move is_rfc3986_unreserved to url.[ch] 2026-01-12 11:56:56 -08:00
credential.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
describe.c Merge branch 'td/describe-tag-iteration' 2026-06-17 11:10:11 -07:00
diagnose.c
diff-files.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff-index.c setup: stop using `the_repository` in `setup_work_tree()` 2026-05-19 19:36:24 +09:00
diff-pairs.c
diff-tree.c Merge branch 'ps/commit-list-functions-renamed' 2026-02-13 13:39:25 -08:00
diff.c setup: stop using `the_repository` in `setup_git_directory_gently()` 2026-05-19 19:36:24 +09:00
difftool.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
fast-export.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
fast-import.c hash: use git_hash_init() consistently 2026-07-07 21:56:00 -07:00
fetch-pack.c connect: use "service" enum for "name" argument 2026-05-19 15:05:46 +09:00
fetch.c Merge branch 'ua/push-remote-group' 2026-06-09 10:04:50 +09:00
fmt-merge-msg.c builtin/fmt-merge-msg: stop depending on 'the_repository' 2025-08-11 09:19:40 -07:00
for-each-ref.c Merge branch 'ms/refs-list' 2025-08-22 13:13:20 -07:00
for-each-repo.c for-each-repo: simplify passing of parameters 2026-03-03 10:20:00 -08:00
fsck.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
fsmonitor--daemon.c fsmonitor: convert shown khash to strset in do_handle_client 2026-04-15 08:44:34 -07:00
gc.c odb/source-loose: wire up `count_objects()` callback 2026-06-01 18:47:18 +09:00
get-tar-commit-id.c
grep.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
hash-object.c setup: stop using `the_repository` in `setup_git_directory()` 2026-05-19 19:36:25 +09:00
help.c setup: stop using `the_repository` in `setup_git_directory_gently()` 2026-05-19 19:36:24 +09:00
history.c Merge branch 'kh/free-commit-list' 2026-06-07 23:58:24 +09:00
hook.c hook: allow hook.jobs=-1 to use all available CPU cores 2026-04-10 07:58:55 -07:00
index-pack.c hash: use git_hash_init() consistently 2026-07-07 21:56:00 -07:00
init-db.c setup: stop using `the_repository` in `init_db()` 2026-05-19 19:36:25 +09:00
interpret-trailers.c Merge branch 'kh/doc-interpret-trailers-1' 2026-03-27 11:00:02 -07:00
last-modified.c Merge branch 'tc/last-modified-not-a-tree' 2026-02-13 13:39:25 -08:00
log.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
ls-files.c Merge branch 'js/objects-larger-than-4gb-on-windows-more' 2026-06-21 16:41:38 -07:00
ls-remote.c ref-filter: propagate peeled object ID 2025-11-04 07:32:25 -08:00
ls-tree.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
mailinfo.c
mailsplit.c
merge-base.c commit-reach: early exit paint_down_to_common for single merge-base 2026-05-12 09:33:43 +09:00
merge-file.c setup: stop using `the_repository` in `setup_git_directory()` 2026-05-19 19:36:25 +09:00
merge-index.c
merge-ours.c merge-ours: integrate with sparse-index 2026-02-06 11:45:33 -08:00
merge-recursive.c builtin: also setup gently for --help-all 2025-08-08 11:13:12 -07:00
merge-tree.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
merge.c Merge branch 'kk/merge-octopus-optim' 2026-05-27 14:15:44 +09:00
mktag.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
mktree.c builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE 2026-03-12 10:03:23 -07:00
multi-pack-index.c midx: support custom `--base` for incremental MIDX writes 2026-05-20 11:31:13 +09:00
mv.c Merge branch 'ob/more-repo-config-values' 2026-06-15 07:42:00 -07:00
name-rev.c Merge branch 'kh/name-rev-custom-format' 2026-05-19 09:57:44 +09:00
notes.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
pack-objects.c Merge branch 'js/objects-larger-than-4gb-on-windows-more' 2026-06-21 16:41:38 -07:00
pack-redundant.c pack-redundant: fix memory leak when open_pack_index() fails 2026-02-21 21:26:53 -08:00
pack-refs.c builtin/pack-refs: factor out core logic into a shared library 2025-09-19 10:02:55 -07:00
patch-id.c hash: use git_hash_init() consistently 2026-07-07 21:56:00 -07:00
prune-packed.c
prune.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
pull.c fetch: add --negotiation-include option for negotiation 2026-05-20 11:33:24 +09:00
push.c push: support pushing to a remote group 2026-05-04 10:11:17 +09:00
range-diff.c Merge branch 'kh/format-patch-range-diff-notes' 2025-10-14 12:56:09 -07:00
read-tree.c setup: stop using `the_repository` in `setup_work_tree()` 2026-05-19 19:36:24 +09:00
rebase.c use strvec_pushv() to add another strvec 2026-03-24 12:26:58 -07:00
receive-pack.c hash: use git_hash_init() consistently 2026-07-07 21:56:00 -07:00
reflog.c Merge branch 'ps/reflog-migrate-fixes' into maint-2.51 2025-10-15 10:29:28 -07:00
refs.c fsck: store repository in fsck options 2026-03-23 08:33:10 -07:00
remote-ext.c
remote-fd.c
remote.c odb: rename `odb_has_object()` flags 2026-03-31 20:43:14 -07:00
repack.c repack: allow `--write-midx=incremental` without `--geometric` 2026-05-20 11:31:14 +09:00
replace.c hex: add and use strbuf_add_oid_hex() 2026-05-14 15:59:25 +09:00
replay.c replay: allow to specify a ref with option --ref 2026-04-01 21:34:25 -07:00
repo.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
rerere.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
reset.c setup: stop using `the_repository` in `setup_work_tree()` 2026-05-19 19:36:24 +09:00
rev-list.c rev-list: use reduce_heads() for --maximal-only 2026-04-06 12:02:30 -07:00
rev-parse.c Merge branch 'jr/bisect-custom-terms-in-output' 2026-05-31 10:00:37 +09:00
revert.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
rm.c setup: stop using `the_repository` in `setup_work_tree()` 2026-05-19 19:36:24 +09:00
send-pack.c connect: use "service" enum for "name" argument 2026-05-19 15:05:46 +09:00
shortlog.c mailmap: stop using the_repository 2026-02-20 08:13:58 -08:00
show-branch.c commit: rename `free_commit_list()` to conform to coding guidelines 2026-01-15 05:32:31 -08:00
show-index.c show-index: use gettext wrapping in user facing error messages 2026-01-30 08:58:12 -08:00
show-ref.c odb: rename `odb_has_object()` flags 2026-03-31 20:43:14 -07:00
sparse-checkout.c Merge branch 'ob/more-repo-config-values' 2026-06-15 07:42:00 -07:00
stash.c Merge branch 'aj/stash-patch-optimize-temporary-index' 2026-06-07 23:58:25 +09:00
stripspace.c setup: stop using `the_repository` in `setup_git_directory_gently()` 2026-05-19 19:36:24 +09:00
submodule--helper.c hash: convert remaining direct function calls 2026-07-07 21:56:00 -07:00
symbolic-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
tag.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
unpack-file.c odb: use size_t for object_info.sizep and the size APIs 2026-06-15 07:45:41 -07:00
unpack-objects.c hash: use git_hash_init() consistently 2026-07-07 21:56:00 -07:00
update-index.c Merge branch 'ps/setup-wo-the-repository' 2026-05-27 14:15:46 +09:00
update-ref.c update-ref: handle rejections while adding updates 2026-05-05 16:34:08 +09:00
update-server-info.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
upload-archive.c setup: stop using `the_repository` in `enter_repo()` 2026-05-19 19:36:24 +09:00
upload-pack.c setup: stop using `the_repository` in `enter_repo()` 2026-05-19 19:36:24 +09:00
url-parse.c builtin: create url-parse command 2026-05-06 09:48:28 +09:00
var.c Merge branch 'jc/string-list-split' 2025-08-21 13:46:59 -07:00
verify-commit.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
verify-pack.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
verify-tag.c tag: support arbitrary repositories in gpg_verify_tag() 2025-12-29 22:02:53 +09:00
worktree.c hook: mark non-parallelizable hooks 2026-04-10 07:58:53 -07:00
write-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00