]> git.ipfire.org Git - thirdparty/git.git/commit
config: fix constness of out parameter for `git_config_get_expiry()`
authorPatrick Steinhardt <ps@pks.im>
Fri, 16 Aug 2024 10:44:57 +0000 (12:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Aug 2024 16:46:24 +0000 (09:46 -0700)
commita70a9bf6eec832b808a805de318601684b19f18e
treeaca5b36515a0cf6fc94eec7e2cdf6573fb29f6dd
parent25673b1c476756ec0587fb0596ab3c22b96dc52a
config: fix constness of out parameter for `git_config_get_expiry()`

The type of the out parameter of `git_config_get_expiry()` is a pointer
to a constant string, which creates the impression that ownership of the
returned data wasn't transferred to the caller. This isn't true though
and thus quite misleading.

Adapt the parameter to be of type `char **` and adjust callers
accordingly. While at it, refactor `get_shared_index_expire_date()` to
drop the static `shared_index_expire` variable. It is only used in that
function, and furthermore we would only hit the code where we parse the
expiry date a single time because we already use a static `prepared`
variable to track whether we did parse it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
config.c
config.h
read-cache.c