commit-reach.c: allow merge_bases_many to handle any repo
[gitweb.git] / config.c
index 4446909229a0f7b14d7428ad9860c9a655c77df8..4051e388230afb1fe96f1ffad35fcc36425d247b 100644 (file)
--- a/config.c
+++ b/config.c
@@ -6,6 +6,7 @@
  *
  */
 #include "cache.h"
+#include "branch.h"
 #include "config.h"
 #include "repository.h"
 #include "lockfile.h"
@@ -37,6 +38,7 @@ struct config_source {
        int eof;
        struct strbuf value;
        struct strbuf var;
+       unsigned subsection_case_sensitive : 1;
 
        int (*do_fgetc)(struct config_source *c);
        int (*do_ungetc)(int c, struct config_source *conf);
@@ -122,7 +124,7 @@ static const char include_depth_advice[] = N_(
 "      %s\n"
 "from\n"
 "      %s\n"
-"Do you have circular includes?");
+"This might be due to circular includes.");
 static int handle_path_include(const char *path, struct config_include_data *inc)
 {
        int ret = 0;
@@ -605,6 +607,7 @@ static int get_value(config_fn_t fn, void *data, struct strbuf *name)
 
 static int get_extended_base_var(struct strbuf *name, int c)
 {
+       cf->subsection_case_sensitive = 0;
        do {
                if (c == '\n')
                        goto error_incomplete_line;
@@ -641,6 +644,7 @@ static int get_extended_base_var(struct strbuf *name, int c)
 
 static int get_base_var(struct strbuf *name)
 {
+       cf->subsection_case_sensitive = 1;
        for (;;) {
                int c = get_next_char();
                if (cf->eof)
@@ -2274,7 +2278,7 @@ int git_config_get_max_percent_split_change(void)
 int git_config_get_fsmonitor(void)
 {
        if (git_config_get_pathname("core.fsmonitor", &core_fsmonitor))
-               core_fsmonitor = getenv("GIT_FSMONITOR_TEST");
+               core_fsmonitor = getenv("GIT_TEST_FSMONITOR");
 
        if (core_fsmonitor && !*core_fsmonitor)
                core_fsmonitor = NULL;
@@ -2285,6 +2289,24 @@ int git_config_get_fsmonitor(void)
        return 0;
 }
 
+int git_config_get_index_threads(void)
+{
+       int is_bool, val = 0;
+
+       val = git_env_ulong("GIT_TEST_INDEX_THREADS", 0);
+       if (val)
+               return val;
+
+       if (!git_config_get_bool_or_int("index.threads", &is_bool, &val)) {
+               if (is_bool)
+                       return val ? 0 : 1;
+               else
+                       return val;
+       }
+
+       return 0; /* auto */
+}
+
 NORETURN
 void git_die_config_linenr(const char *key, const char *filename, int linenr)
 {
@@ -2369,14 +2391,21 @@ static int store_aux_event(enum config_event_t type,
        store->parsed[store->parsed_nr].type = type;
 
        if (type == CONFIG_EVENT_SECTION) {
+               int (*cmpfn)(const char *, const char *, size_t);
+
                if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
                        return error(_("invalid section name '%s'"), cf->var.buf);
 
+               if (cf->subsection_case_sensitive)
+                       cmpfn = strncasecmp;
+               else
+                       cmpfn = strncmp;
+
                /* Is this the section we were looking for? */
                store->is_keys_section =
                        store->parsed[store->parsed_nr].is_keys_section =
                        cf->var.len - 1 == store->baselen &&
-                       !strncasecmp(cf->var.buf, store->key, store->baselen);
+                       !cmpfn(cf->var.buf, store->key, store->baselen);
                if (store->is_keys_section) {
                        store->section_seen = 1;
                        ALLOC_GROW(store->seen, store->seen_nr + 1,