+static const char *get_name_for_path(const char *path)
+{
+ struct string_list_item *path_option;
+ if (path == NULL) {
+ if (config_name_for_path.nr > 0)
+ return config_name_for_path.items[0].util;
+ else
+ return NULL;
+ }
+ path_option = unsorted_string_list_lookup(&config_name_for_path, path);
+ if (!path_option)
+ return NULL;
+ return path_option->util;
+}
+
+static void set_name_for_path(const char *path, const char *name, int namelen)
+{
+ struct string_list_item *config;
+ config = unsorted_string_list_lookup(&config_name_for_path, path);
+ if (config)
+ free(config->util);
+ else
+ config = string_list_append(&config_name_for_path, xstrdup(path));
+ config->util = xmemdupz(name, namelen);
+}
+
+static const char *get_ignore_for_name(const char *name)
+{
+ struct string_list_item *ignore_option;
+ ignore_option = unsorted_string_list_lookup(&config_ignore_for_name, name);
+ if (!ignore_option)
+ return NULL;
+
+ return ignore_option->util;
+}
+
+static void set_ignore_for_name(const char *name, int namelen, const char *ignore)
+{
+ struct string_list_item *config;
+ char *name_cstr = xmemdupz(name, namelen);
+ config = unsorted_string_list_lookup(&config_ignore_for_name, name_cstr);
+ if (config) {
+ free(config->util);
+ free(name_cstr);
+ } else
+ config = string_list_append(&config_ignore_for_name, name_cstr);
+ config->util = xstrdup(ignore);
+}
+
+static int get_fetch_recurse_for_name(const char *name)
+{
+ struct string_list_item *fetch_recurse;
+ fetch_recurse = unsorted_string_list_lookup(&config_fetch_recurse_submodules_for_name, name);
+ if (!fetch_recurse)
+ return RECURSE_SUBMODULES_NONE;
+
+ return (intptr_t) fetch_recurse->util;
+}
+
+static void set_fetch_recurse_for_name(const char *name, int namelen, int fetch_recurse)
+{
+ struct string_list_item *config;
+ char *name_cstr = xmemdupz(name, namelen);
+ config = unsorted_string_list_lookup(&config_fetch_recurse_submodules_for_name, name_cstr);
+ if (!config)
+ config = string_list_append(&config_fetch_recurse_submodules_for_name, name_cstr);
+ else
+ free(name_cstr);
+ config->util = (void *)(intptr_t) fetch_recurse;
+}