Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-25 23:22:38 +0300
committerJunio C Hamano <gitster@pobox.com>2018-06-25 23:22:38 +0300
commitebaf0a56f3f5f823df4166bc8fd626b523f864dc (patch)
tree1eb7aa0e578fb8636f721721f9d0767e68776138 /config.c
parent110240588d5c0ca88d3b55da52068f59d8d6367d (diff)
parentf22f682695d8f1bf79cde44cfe0b913905c1ef9a (diff)
Merge branch 'nd/complete-config-vars'
Continuing with the idea to programatically enumerate various pieces of data required for command line completion, teach the codebase to report the list of configuration variables subcommands care about to help complete them. * nd/complete-config-vars: completion: complete general config vars in two steps log-tree: allow to customize 'grafted' color completion: support case-insensitive config vars completion: keep other config var completion in camelCase completion: drop the hard coded list of config vars am: move advice.amWorkDir parsing back to advice.c advice: keep config name in camelCase in advice_config[] fsck: produce camelCase config key names help: add --config to list all available config fsck: factor out msg_id_info[] lazy initialization code grep: keep all colors in an array Add and use generic name->id mapping code for color slot parsing
Diffstat (limited to 'config.c')
-rw-r--r--config.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/config.c b/config.c
index fbbf0f8e9f..a0a6ae1980 100644
--- a/config.c
+++ b/config.c
@@ -3245,3 +3245,16 @@ enum config_scope current_config_scope(void)
else
return current_parsing_scope;
}
+
+int lookup_config(const char **mapping, int nr_mapping, const char *var)
+{
+ int i;
+
+ for (i = 0; i < nr_mapping; i++) {
+ const char *name = mapping[i];
+
+ if (name && !strcasecmp(var, name))
+ return i;
+ }
+ return -1;
+}