summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-11-25 22:12:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-25 23:04:55 (GMT)
commit483a6d9b5da6a03d34aceb7bff86b12c7241e17b (patch)
treeb939afafb482e824e83b0bc383a9b6abd0bce337 /builtin/gc.c
parent8717937a75dd3a38c5298cc6047c8653d30c2e45 (diff)
downloadgit-483a6d9b5da6a03d34aceb7bff86b12c7241e17b.zip
git-483a6d9b5da6a03d34aceb7bff86b12c7241e17b.tar.gz
git-483a6d9b5da6a03d34aceb7bff86b12c7241e17b.tar.bz2
maintenance: use 'git config --fixed-value'
When a repository's leading directories contain regex metacharacters, the config calls for 'git maintenance register' and 'git maintenance unregister' are not careful enough. Use the new --fixed-value option to direct the config machinery to use exact string matches. This is a more robust option than escaping these arguments in a piecemeal fashion. For the test, require that we are not running on Windows since the '+' and '*' characters are not allowed on that filesystem. Reported-by: Emily Shaffer <emilyshaffer@google.com> Reported-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
-rw-r--r--builtin/gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 3d258b6..acfd5b9 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1462,7 +1462,8 @@ static int maintenance_register(void)
git_config_set("maintenance.strategy", "incremental");
config_get.git_cmd = 1;
- strvec_pushl(&config_get.args, "config", "--global", "--get", "maintenance.repo",
+ strvec_pushl(&config_get.args, "config", "--global", "--get",
+ "--fixed-value", "maintenance.repo",
the_repository->worktree ? the_repository->worktree
: the_repository->gitdir,
NULL);
@@ -1493,7 +1494,7 @@ static int maintenance_unregister(void)
config_unset.git_cmd = 1;
strvec_pushl(&config_unset.args, "config", "--global", "--unset",
- "maintenance.repo",
+ "--fixed-value", "maintenance.repo",
the_repository->worktree ? the_repository->worktree
: the_repository->gitdir,
NULL);