]> Kevux Git Server - rit/commit
builtin/repack.c: pass "cruft_expiration" to `write_cruft_pack`
authorTaylor Blau <me@ttaylorr.com>
Mon, 24 Oct 2022 18:43:06 +0000 (14:43 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Oct 2022 20:39:42 +0000 (13:39 -0700)
commiteddad3686080553bb1e6ffa6d9394912f9427823
tree0bdb6d675986a78734bbef812e72ed0345d6540d
parent4e7b65ba8e7b4174c4ab249b64c6cb3ad0009732
builtin/repack.c: pass "cruft_expiration" to `write_cruft_pack`

`builtin/repack.c`'s `write_cruft_pack()` is used to generate the cruft
pack when `--cruft` is supplied. It uses a static variable
"cruft_expiration" which is filled in by option parsing.

A future patch will add an `--expire-to` option which allows `git
repack` to write a cruft pack containing the pruned objects out to a
separate repository. In order to implement this functionality, some
callers will have to pass a value for `cruft_expiration` different than
the one filled out by option parsing.

Prepare for this by teaching `write_cruft_pack` to take a
"cruft_expiration" parameter, instead of reading a single static
variable.

The (sole) existing caller of `write_cruft_pack()` will pass the value
for "cruft_expiration" filled in by option parsing, retaining existing
behavior. This means that we can make the variable local to
`cmd_repack()`, and eliminate the static declaration.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c