mirror of
https://github.com/git/git.git
synced 2026-01-20 23:52:52 +00:00
Allow for platform-specific core.* config settings
In the Git for Windows project, we have ample precendent for config settings that apply to Windows, and to Windows only. Let's formalize this concept by introducing a platform_core_config() function that can be #define'd in a platform-specific manner. This will allow us to contain platform-specific code better, as the corresponding variables no longer need to be exported so that they can be defined in environment.c and be set in config.c Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -202,6 +202,11 @@ static int ask_yes_no_if_possible(const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
int mingw_core_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mingw_unlink(const char *pathname)
|
||||
{
|
||||
int ret, tries = 0;
|
||||
|
||||
@@ -11,6 +11,9 @@ typedef _sigset_t sigset_t;
|
||||
#undef _POSIX_THREAD_SAFE_FUNCTIONS
|
||||
#endif
|
||||
|
||||
extern int mingw_core_config(const char *var, const char *value, void *cb);
|
||||
#define platform_core_config mingw_core_config
|
||||
|
||||
/*
|
||||
* things that are not available in header files
|
||||
*/
|
||||
|
||||
6
config.c
6
config.c
@@ -1000,7 +1000,7 @@ int git_config_expiry_date(timestamp_t *timestamp, const char *var, const char *
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int git_default_core_config(const char *var, const char *value)
|
||||
static int git_default_core_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
/* This needs a better name */
|
||||
if (!strcmp(var, "core.filemode")) {
|
||||
@@ -1252,7 +1252,7 @@ static int git_default_core_config(const char *var, const char *value)
|
||||
}
|
||||
|
||||
/* Add other config variables here and to Documentation/config.txt. */
|
||||
return 0;
|
||||
return platform_core_config(var, value, cb);
|
||||
}
|
||||
|
||||
static int git_default_i18n_config(const char *var, const char *value)
|
||||
@@ -1340,7 +1340,7 @@ static int git_default_mailmap_config(const char *var, const char *value)
|
||||
int git_default_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
if (starts_with(var, "core."))
|
||||
return git_default_core_config(var, value);
|
||||
return git_default_core_config(var, value, cb);
|
||||
|
||||
if (starts_with(var, "user."))
|
||||
return git_ident_config(var, value, cb);
|
||||
|
||||
@@ -338,6 +338,14 @@ typedef uintmax_t timestamp_t;
|
||||
#define _PATH_DEFPATH "/usr/local/bin:/usr/bin:/bin"
|
||||
#endif
|
||||
|
||||
#ifndef platform_core_config
|
||||
static inline int noop_core_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#define platform_core_config noop_core_config
|
||||
#endif
|
||||
|
||||
#ifndef has_dos_drive_prefix
|
||||
static inline int git_has_dos_drive_prefix(const char *path)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user