git/builtin
Taylor Blau 7a9c81a38d builtin/repack.c: introduce `struct write_pack_opts`
There are various functions within the 'repack' builtin which are
responsible for writing different kinds of packs. They include:

 - `static int write_filtered_pack(...)`
 - `static int write_cruft_pack(...)`

as well as the function `finish_pack_objects_cmd()`, which is
responsible for finalizing a new pack write, and recording the checksum
of its contents in the 'names' list.

Both of these `write_` functions have a few things in common. They both
take a pointer to the 'pack_objects_args' struct, as well as a pair of
character pointers for `destination` and `pack_prefix`.

Instead of repeating those arguments for each function, let's extract an
options struct called "write_pack_opts" which has these three parameters
as member fields. While we're at it, add fields for "packdir," and
"packtmp", both of which are static variables within the builtin, and
need to be read from within these two functions.

This will shorten the list of parameters that callers have to provide to
`write_filtered_pack()`, avoid ambiguity when passing multiple variables
of the same type, and provide a unified interface for the two functions
mentioned earlier.

(Note that "pack_prefix" can be derived on the fly as a function of
"packdir" and "packtmp", making it unnecessary to store "pack_prefix"
explicitly. This commit ignores that potential cleanup in the name of
doing as few things as possible, but a later commit will make that
change.)

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-10-16 10:08:56 -07:00
..
add.c bulk-checkin: remove global transaction state 2025-08-25 09:48:13 -07:00
am.c config: drop `git_config_get_bool()` wrapper 2025-07-23 08:15:20 -07:00
annotate.c Merge branch 'jc/a-commands-without-the-repo' 2024-10-25 14:02:36 -04:00
apply.c builtin: use default hash when outside a repository 2025-07-01 14:58:24 -07:00
archive.c archive: remove the_repository global variable 2024-10-11 09:37:18 -07:00
backfill.c packfile: split up responsibilities of `reprepare_packed_git()` 2025-09-24 11:53:50 -07:00
bisect.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
blame.c Merge branch 'jc/string-list-split' 2025-08-21 13:46:59 -07:00
branch.c config: drop `git_config_set_multivar()` wrapper 2025-07-23 08:15:21 -07: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 packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -07:00
check-attr.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
check-ignore.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
check-mailmap.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
check-ref-format.c builtin: send usage() help text to standard output 2025-01-17 13:30:03 -08:00
checkout--worker.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
checkout-index.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
checkout.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
clean.c Merge branch 'jc/strbuf-split' 2025-08-21 13:47:00 -07:00
clone.c config: drop `git_config_set_multivar()` wrapper 2025-07-23 08:15:21 -07:00
column.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
commit-graph.c Merge branch 'ps/object-store-midx-dedup-info' 2025-09-12 10:41:18 -07:00
commit-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
commit.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
config.c config: drop `git_config_set_multivar_in_file_gently()` wrapper 2025-07-23 08:15:21 -07:00
count-objects.c packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -07:00
credential-cache--daemon.c config: drop `git_config_get_bool()` wrapper 2025-07-23 08:15:20 -07:00
credential-cache.c Merge branch 'rj/cygwin-exit' 2024-11-01 12:53:19 -04:00
credential-store.c config: drop `git_config_get_int()` wrapper 2025-07-23 08:15:20 -07:00
credential.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
describe.c Merge branch 'rs/describe-with-lazy-queue-and-oidset' 2025-09-12 10:41:21 -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 config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff-index.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff-pairs.c builtin/diff-pairs: allow explicit diff queue flush 2025-03-03 08:17:47 -08:00
diff-tree.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
diff.c diff: --no-index should ignore the worktree 2025-08-09 17:22:01 -07:00
difftool.c odb: rename `repo_read_object_file()` 2025-07-01 14:46:38 -07:00
fast-export.c Merge branch 'ps/config-wo-the-repository' 2025-08-04 08:10:33 -07:00
fast-import.c packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -07:00
fetch-pack.c builtin/fetch-pack: cleanup before return error 2025-06-04 08:52:25 -07:00
fetch.c config: drop `git_config_get_int()` wrapper 2025-07-23 08:15:20 -07: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 global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
fsck.c packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -07:00
fsmonitor--daemon.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
gc.c packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -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 packfile: refactor `get_packed_git()` to work on packfile store 2025-09-24 11:53:51 -07:00
hash-object.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
help.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
hook.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
index-pack.c packfile: introduce function to load and add packfiles 2025-09-24 11:53:50 -07:00
init-db.c Merge branch 'ps/parse-options-integers' 2025-04-24 17:25:34 -07:00
interpret-trailers.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
last-modified.c Merge branch 'tc/last-modified' 2025-09-08 14:54:35 -07:00
log.c range-diff: add configurable memory limit for cost matrix 2025-08-29 09:46:07 -07:00
ls-files.c Merge branch 'ds/ls-files-lazy-unsparse' 2025-09-08 14:54:35 -07:00
ls-remote.c builtin: use default hash when outside a repository 2025-07-01 14:58:24 -07:00
ls-tree.c use repo_get_oid_with_flags() 2025-09-10 14:29:49 -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 config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
merge-file.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -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: also setup gently for --help-all 2025-08-08 11:13:12 -07:00
merge-tree.c Merge branch 'jc/strbuf-split' 2025-08-21 13:47:00 -07:00
merge.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
mktag.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
mktree.c odb: introduce `odb_write_object()` 2025-07-16 22:16:15 -07:00
multi-pack-index.c Merge branch 'ps/object-store-midx-dedup-info' 2025-09-12 10:41:18 -07:00
mv.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
name-rev.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
notes.c Merge branch 'jc/strbuf-split' 2025-08-21 13:47:00 -07:00
pack-objects.c packfile: refactor `get_packed_git_mru()` to work on packfile store 2025-09-24 11:53:51 -07:00
pack-redundant.c packfile: refactor `get_all_packs()` to work on packfile store 2025-09-24 11:53:51 -07:00
pack-refs.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
patch-id.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -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 Merge branch 'ps/config-wo-the-repository' 2025-08-04 08:10:33 -07:00
push.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
range-diff.c range-diff: add configurable memory limit for cost matrix 2025-08-29 09:46:07 -07:00
read-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
rebase.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
receive-pack.c packfile: split up responsibilities of `reprepare_packed_git()` 2025-09-24 11:53:50 -07:00
reflog.c Merge branch 'ps/reflog-migrate-fixes' 2025-08-21 13:46:57 -07:00
refs.c builtin/refs: add 'exists' subcommand 2025-09-02 09:58:35 -07: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 Merge branch 'ps/remote-rename-fix' 2025-08-21 13:46:58 -07:00
repack.c builtin/repack.c: introduce `struct write_pack_opts` 2025-10-16 10:08:56 -07:00
replace.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
replay.c repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode () 2025-06-05 08:35:22 -07:00
repo.c repo: add the field objects.format 2025-09-04 11:36:40 -07:00
rerere.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
reset.c Merge branch 'lm/add-p-context' 2025-08-04 08:10:33 -07:00
rev-list.c Merge branch 'ps/config-wo-the-repository' 2025-08-04 08:10:33 -07:00
rev-parse.c use repo_get_oid_with_flags() 2025-09-10 14:29:49 -07:00
revert.c Merge branch 'pw/3.0-commentchar-auto-deprecation' 2025-09-18 10:07:00 -07:00
rm.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
send-pack.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
shortlog.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
show-branch.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
show-index.c builtin: use default hash when outside a repository 2025-07-01 14:58:24 -07:00
show-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
sparse-checkout.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
stash.c Merge branch 'rs/get-oid-with-flags-cleanup' 2025-09-23 11:53:40 -07:00
stripspace.c config: drop `git_config()` wrapper 2025-07-23 08:15:18 -07:00
submodule--helper.c Merge branch 'kj/renamed-submodule' 2025-08-05 11:53:56 -07:00
symbolic-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
tag.c Merge branch 'ps/object-file-wo-the-repository' 2025-08-05 11:53:55 -07:00
unpack-file.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
unpack-objects.c bulk-checkin: remove global transaction state 2025-08-25 09:48:13 -07:00
update-index.c bulk-checkin: remove global transaction state 2025-08-25 09:48:13 -07:00
update-ref.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
update-server-info.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -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/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 config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00
worktree.c config: drop `git_config_set_multivar_in_file_gently()` wrapper 2025-07-23 08:15:21 -07:00
write-tree.c config: move Git config parsing into "environment.c" 2025-07-23 08:15:22 -07:00