diff options
author | Derrick Stolee <derrickstolee@github.com> | 2022-09-27 16:57:00 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-27 19:32:26 +0300 |
commit | 50a044f1e407ef217cb5d057af08e9e87daddc78 (patch) | |
tree | b7c8e1d82efe61206ef3c4958eabe92f85ae0e25 /string-list.h | |
parent | d871b6c6c634689134a92d068bfb066d77d8429d (diff) |
gc: replace config subprocesses with API calls
The 'git maintenance [un]register' commands set or unset the multi-
valued maintenance.repo config key with the absolute path of the current
repository. These are set in the global config file.
Instead of calling a subcommand and creating a new process, create the
proper API calls to git_config_set_multivar_in_file_gently(). It
requires loading the filename for the global config file (and erroring
out if now $HOME value is set). We also need to be careful about using
CONFIG_REGEX_NONE when adding the value and using
CONFIG_FLAGS_FIXED_VALUE when removing the value. In both cases, we
check that the value already exists (this check already existed for
'unregister').
Also, remove the transparent translation of the error code from the
config API to the exit code of 'git maintenance'. Instead, use die() to
recover from failures at that level. In the case of 'unregister
--force', allow the CONFIG_NOTHING_SET error code to be a success. This
allows a possible race where another process removes the config value.
The end result is that the config value is not set anymore, so we can
treat this as a success.
Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'string-list.h')
0 files changed, 0 insertions, 0 deletions