@@ -1568,11 +1568,6 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
check_stat = 0;
}
- if (!strcmp(var, "core.quotepath")) {
- quote_path_fully = git_config_bool(var, value);
- return 0;
- }
-
if (!strcmp(var, "core.symlinks")) {
has_symlinks = git_config_bool(var, value);
return 0;
@@ -6,6 +6,7 @@ static int global_ints[] = {
[INT_CONFIG_NONE] = 0, /* unused*/
[INT_CONFIG_TRUST_EXECUTABLE_BIT] = 1,
[INT_CONFIG_TRUST_CTIME] = 1,
+ [INT_CONFIG_QUOTE_PATH_FULLY] = 1,
};
/* Bitmask for the enum. */
@@ -15,6 +16,7 @@ static const char *global_int_names[] = {
[INT_CONFIG_NONE] = NULL, /* unused*/
[INT_CONFIG_TRUST_EXECUTABLE_BIT] = "core.filemode",
[INT_CONFIG_TRUST_CTIME] = "core.trustctime",
+ [INT_CONFIG_QUOTE_PATH_FULLY] = "core.quotepath",
};
static int config_available;
@@ -5,6 +5,7 @@ enum int_config_key {
INT_CONFIG_NONE = 0,
INT_CONFIG_TRUST_EXECUTABLE_BIT,
INT_CONFIG_TRUST_CTIME,
+ INT_CONFIG_QUOTE_PATH_FULLY,
};
/**
@@ -4,8 +4,7 @@
#include "quote.h"
#include "strbuf.h"
#include "strvec.h"
-
-int quote_path_fully = 1;
+#include "global-config.h"
static inline int need_bs_quote(char c)
{
@@ -212,7 +211,7 @@ int sq_dequote_to_strvec(char *arg, struct strvec *array)
}
/* 1 means: quote as octal
- * 0 means: quote as octal if (quote_path_fully)
+ * 0 means: quote as octal if core.quotePath is true
* -1 means: never quote
* c: quote as "\\c"
*/
@@ -233,6 +232,7 @@ static signed char const cq_lookup[256] = {
static inline int cq_must_quote(char c)
{
+ int quote_path_fully = get_int_config_global(INT_CONFIG_QUOTE_PATH_FULLY);
return cq_lookup[(unsigned char)c] + quote_path_fully > 0;
}
@@ -3,8 +3,6 @@
struct strbuf;
-extern int quote_path_fully;
-
/* Help to copy the thing properly quoted for the shell safety.
* any single quote is replaced with '\'', any exclamation point
* is replaced with '\!', and the whole thing is enclosed in a