Merge branch 'ps/config-wo-the-repository'

The config API had a set of convenience wrapper functions that
implicitly use the_repository instance; they have been removed and
inlined at the calling sites.

* ps/config-wo-the-repository: (21 commits)
  config: fix sign comparison warnings
  config: move Git config parsing into "environment.c"
  config: remove unused `the_repository` wrappers
  config: drop `git_config_set_multivar()` wrapper
  config: drop `git_config_get_multivar_gently()` wrapper
  config: drop `git_config_set_multivar_in_file_gently()` wrapper
  config: drop `git_config_set_in_file_gently()` wrapper
  config: drop `git_config_set()` wrapper
  config: drop `git_config_set_gently()` wrapper
  config: drop `git_config_set_in_file()` wrapper
  config: drop `git_config_get_bool()` wrapper
  config: drop `git_config_get_ulong()` wrapper
  config: drop `git_config_get_int()` wrapper
  config: drop `git_config_get_string()` wrapper
  config: drop `git_config_get_string()` wrapper
  config: drop `git_config_get_string_multi()` wrapper
  config: drop `git_config_get_value()` wrapper
  config: drop `git_config_get_value()` wrapper
  config: drop `git_config_get()` wrapper
  config: drop `git_config_clear()` wrapper
  ...
This commit is contained in:
Junio C Hamano
2025-08-04 08:10:32 -07:00
161 changed files with 1015 additions and 1099 deletions

139
config.h
View File

@@ -163,9 +163,6 @@ struct config_context {
typedef int (*config_fn_t)(const char *, const char *,
const struct config_context *, void *);
int git_default_config(const char *, const char *,
const struct config_context *, void *);
/**
* Read a specific file in git-config format.
* This function takes the same callback and data parameters as `repo_config`.
@@ -716,140 +713,4 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
lookup_config(mapping, ARRAY_SIZE(mapping), var)
int lookup_config(const char **mapping, int nr_mapping, const char *var);
# ifdef USE_THE_REPOSITORY_VARIABLE
static inline void git_config(config_fn_t fn, void *data)
{
repo_config(the_repository, fn, data);
}
static inline void git_config_clear(void)
{
repo_config_clear(the_repository);
}
static inline int git_config_get(const char *key)
{
return repo_config_get(the_repository, key);
}
static inline int git_config_get_value(const char *key, const char **value)
{
return repo_config_get_value(the_repository, key, value);
}
static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
{
return repo_config_get_value_multi(the_repository, key, dest);
}
static inline int git_config_get_string_multi(const char *key,
const struct string_list **dest)
{
return repo_config_get_string_multi(the_repository, key, dest);
}
static inline int git_config_get_string(const char *key, char **dest)
{
return repo_config_get_string(the_repository, key, dest);
}
static inline int git_config_get_string_tmp(const char *key, const char **dest)
{
return repo_config_get_string_tmp(the_repository, key, dest);
}
static inline int git_config_get_int(const char *key, int *dest)
{
return repo_config_get_int(the_repository, key, dest);
}
static inline int git_config_get_ulong(const char *key, unsigned long *dest)
{
return repo_config_get_ulong(the_repository, key, dest);
}
static inline int git_config_get_bool(const char *key, int *dest)
{
return repo_config_get_bool(the_repository, key, dest);
}
static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
{
return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
}
static inline int git_config_get_maybe_bool(const char *key, int *dest)
{
return repo_config_get_maybe_bool(the_repository, key, dest);
}
static inline int git_config_get_pathname(const char *key, char **dest)
{
return repo_config_get_pathname(the_repository, key, dest);
}
static inline void git_config_set_in_file(const char *config_filename,
const char *key, const char *value)
{
repo_config_set_in_file(the_repository, config_filename, key, value);
}
static inline int git_config_set_gently(const char *key, const char *value)
{
return repo_config_set_gently(the_repository, key, value);
}
static inline void git_config_set(const char *key, const char *value)
{
repo_config_set(the_repository, key, value);
}
static inline int git_config_set_in_file_gently(
const char *config_filename,
const char *key,
const char *comment,
const char *value)
{
return repo_config_set_in_file_gently(the_repository, config_filename,
key, comment, value);
}
static inline int git_config_set_multivar_in_file_gently(
const char *config_filename,
const char *key, const char *value,
const char *value_pattern,
const char *comment,
unsigned flags)
{
return repo_config_set_multivar_in_file_gently(the_repository, config_filename,
key, value, value_pattern,
comment, flags);
}
static inline void git_config_set_multivar_in_file(
const char *config_filename,
const char *key,
const char *value,
const char *value_pattern,
unsigned flags)
{
repo_config_set_multivar_in_file(the_repository, config_filename,
key, value, value_pattern, flags);
}
static inline int git_config_set_multivar_gently(const char *key, const char *value,
const char *value_pattern, unsigned flags)
{
return repo_config_set_multivar_gently(the_repository, key, value,
value_pattern, flags);
}
static inline void git_config_set_multivar(const char *key, const char *value,
const char *value_pattern, unsigned flags)
{
repo_config_set_multivar(the_repository, key, value,
value_pattern, flags);
}
# endif /* USE_THE_REPOSITORY_VARIABLE */
#endif /* CONFIG_H */