From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: vdye@github.com, johannes.schindelin@gmx.de, newren@gmail.com,
peff@peff.net, gitster@pobox.com,
Derrick Stolee <derrickstolee@github.com>,
Derrick Stolee <derrickstolee@github.com>
Subject: [PATCH 4/6] config: move quote_path_fully to global config
Date: Fri, 02 Jun 2023 14:33:38 +0000 [thread overview]
Message-ID: <15d65d3e05d11de69e36f2a7b83c06b2727ff8f1.1685716420.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1539.git.1685716420.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
config.c | 5 -----
global-config.c | 2 ++
global-config.h | 1 +
quote.c | 6 +++---
quote.h | 2 --
5 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/config.c b/config.c
index d955a16b372..6b4051a4eae 100644
--- a/config.c
+++ b/config.c
@@ -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;
diff --git a/global-config.c b/global-config.c
index 5bd6bc45418..395d21e0381 100644
--- a/global-config.c
+++ b/global-config.c
@@ -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;
diff --git a/global-config.h b/global-config.h
index a6d8e5adc4e..fbe5fccb1a1 100644
--- a/global-config.h
+++ b/global-config.h
@@ -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,
};
/**
diff --git a/quote.c b/quote.c
index 43c739671ed..25ca0473881 100644
--- a/quote.c
+++ b/quote.c
@@ -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;
}
diff --git a/quote.h b/quote.h
index 0300c291041..87ff458b06d 100644
--- a/quote.h
+++ b/quote.h
@@ -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
--
gitgitgadget
next prev parent reply other threads:[~2023-06-02 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 14:33 [PATCH 0/6] [RFC] Lazy-loaded default Git config Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 1/6] config: create new global config helpers Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 2/6] config: add trust_executable_bit to global config Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 3/6] config: move trust_ctime " Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` Derrick Stolee via GitGitGadget [this message]
2023-06-02 14:33 ` [PATCH 5/6] config: move has_symlinks " Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 6/6] config: move ignore_case " Derrick Stolee via GitGitGadget
2023-06-08 18:19 ` [PATCH 0/6] [RFC] Lazy-loaded default Git config Glen Choo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15d65d3e05d11de69e36f2a7b83c06b2727ff8f1.1685716420.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=vdye@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).