From: Junio C Hamano Date: Thu, 19 Nov 2020 22:45:11 GMT Subject: Re: [PATCH 5/7] config: plumb --literal-value into config API Message-ID: In-Reply-To: <5881b2d987e3e8575d054a64fe21fbe7e7967aba.1605801143.git.gitgitgadget@gmail.com> "Derrick Stolee via GitGitGadget" writes: > diff --git a/config.c b/config.c > index 4841c68a91..5028c1e736 100644 > --- a/config.c > +++ b/config.c > @@ -2402,6 +2402,7 @@ struct config_store_data { > size_t baselen; > char *key; > int do_not_match; > + const char *literal_value; > regex_t *value_regex; > int multi_replace; > struct { > @@ -2431,6 +2432,8 @@ static int matches(const char *key, const char *value, > { > if (strcmp(key, store->key)) > return 0; /* not ours */ > + if (store->literal_value) > + return !strcmp(store->literal_value, value); > if (!store->value_regex) > return 1; /* always matches */ > if (store->value_regex == CONFIG_REGEX_NONE) > @@ -2803,6 +2806,8 @@ int git_config_set_multivar_in_file_gently(const char *config_filename, > store.value_regex = NULL; > else if (value_regex == CONFIG_REGEX_NONE) > store.value_regex = CONFIG_REGEX_NONE; > + else if (flags & CONFIG_FLAGS_LITERAL_VALUE) > + store.literal_value = value_regex; > else { > if (value_regex[0] == '!') { > store.do_not_match = 1; This is nice. It is a surprisingly small change. Thanks.