Esempio n. 1
0
int submodule_config(const char *var, const char *value, void *cb)
{
	if (!prefixcmp(var, "submodule."))
		return parse_submodule_config_option(var, value);
	else if (!strcmp(var, "fetch.recursesubmodules")) {
		config_fetch_recurse_submodules = parse_fetch_recurse_submodules_arg(var, value);
		return 0;
	}
	return 0;
}
Esempio n. 2
0
static int gitmodules_fetch_config(const char *var, const char *value, void *cb)
{
	struct fetch_config *config = cb;
	if (!strcmp(var, "submodule.fetchjobs")) {
		*(config->max_children) = parse_submodule_fetchjobs(var, value);
		return 0;
	} else if (!strcmp(var, "fetch.recursesubmodules")) {
		*(config->recurse_submodules) = parse_fetch_recurse_submodules_arg(var, value);
		return 0;
	}

	return 0;
}
Esempio n. 3
0
int parse_submodule_config_option(const char *var, const char *value)
{
	struct string_list_item *config;
	const char *name, *key;
	int namelen;

	if (parse_config_key(var, "submodule", &name, &namelen, &key) < 0 || !name)
		return 0;

	if (!strcmp(key, "path")) {
		if (!value)
			return config_error_nonbool(var);

		config = unsorted_string_list_lookup(&config_name_for_path, value);
		if (config)
			free(config->util);
		else
			config = string_list_append(&config_name_for_path, xstrdup(value));
		config->util = xmemdupz(name, namelen);
	} else if (!strcmp(key, "fetchrecursesubmodules")) {
		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)parse_fetch_recurse_submodules_arg(var, value);
	} else if (!strcmp(key, "ignore")) {
		char *name_cstr;

		if (!value)
			return config_error_nonbool(var);

		if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
		    strcmp(value, "all") && strcmp(value, "none")) {
			warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);
			return 0;
		}

		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(value);
		return 0;
	}
	return 0;
}
Esempio n. 4
0
int submodule_config(const char *var, const char *value, void *cb)
{
	if (!strcmp(var, "submodule.fetchjobs")) {
		parallel_jobs = git_config_int(var, value);
		if (parallel_jobs < 0)
			die(_("negative values not allowed for submodule.fetchJobs"));
		return 0;
	} else if (starts_with(var, "submodule."))
		return parse_submodule_config_option(var, value);
	else if (!strcmp(var, "fetch.recursesubmodules")) {
		config_fetch_recurse_submodules = parse_fetch_recurse_submodules_arg(var, value);
		return 0;
	}
	return 0;
}
Esempio n. 5
0
int parse_submodule_config_option(const char *var, const char *value)
{
	int len;
	struct string_list_item *config;
	struct strbuf submodname = STRBUF_INIT;

	var += 10;		/* Skip "submodule." */

	len = strlen(var);
	if ((len > 5) && !strcmp(var + len - 5, ".path")) {
		strbuf_add(&submodname, var, len - 5);
		config = unsorted_string_list_lookup(&config_name_for_path, value);
		if (config)
			free(config->util);
		else
			config = string_list_append(&config_name_for_path, xstrdup(value));
		config->util = strbuf_detach(&submodname, NULL);
		strbuf_release(&submodname);
	} else if ((len > 23) && !strcmp(var + len - 23, ".fetchrecursesubmodules")) {
		strbuf_add(&submodname, var, len - 23);
		config = unsorted_string_list_lookup(&config_fetch_recurse_submodules_for_name, submodname.buf);
		if (!config)
			config = string_list_append(&config_fetch_recurse_submodules_for_name,
						    strbuf_detach(&submodname, NULL));
		config->util = (void *)(intptr_t)parse_fetch_recurse_submodules_arg(var, value);
		strbuf_release(&submodname);
	} else if ((len > 7) && !strcmp(var + len - 7, ".ignore")) {
		if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
		    strcmp(value, "all") && strcmp(value, "none")) {
			warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);
			return 0;
		}

		strbuf_add(&submodname, var, len - 7);
		config = unsorted_string_list_lookup(&config_ignore_for_name, submodname.buf);
		if (config)
			free(config->util);
		else
			config = string_list_append(&config_ignore_for_name,
						    strbuf_detach(&submodname, NULL));
		strbuf_release(&submodname);
		config->util = xstrdup(value);
		return 0;
	}
	return 0;
}
Esempio n. 6
0
int option_fetch_parse_recurse_submodules(const struct option *opt,
					  const char *arg, int unset)
{
	int *v;

	if (!opt->value)
		return -1;

	v = opt->value;

	if (unset) {
		*v = RECURSE_SUBMODULES_OFF;
	} else {
		if (arg)
			*v = parse_fetch_recurse_submodules_arg(opt->long_name, arg);
		else
			*v = RECURSE_SUBMODULES_ON;
	}
	return 0;
}