Junio C Hamano <gitster@xxxxxxxxx> writes: >> + strbuf_reset(&sb); >> + strbuf_addf(&sb, "submodule.%s.url", sub->name); >> + if (git_config_get_string(sb.buf, &url)) { >> + url = xstrdup(sub->url); >> + if (!url) >> + die(_("No url found for submodule path '%s' in .gitmodules"), >> + displaypath); > > I am assuming that this corresponds to these lines in the original > scripted version: > > url=$(git config -f .gitmodules submodule."$name".url) > test -z "$url" && > die "$(eval_gettext "No url found for submodule path... > > but what makes git_config_get_string() to read from ".gitmodules" > file? Doesn't it read from $GIT_DIR/config & ~/.gitconfig instead? I am starting to suspect that reading of ".gitmodules" in the context of "git submodule" command is a good use case for the configset API. It wants to read variables from ".gitmodules" and the regular configuration file, and cares about where they come from, illustrated by this codepath. Read URL from .gitmodules, do something to it, and update the regular configuration file. Read Update from .gitmodules, do some verification, and selectively store it in the regular configuration file. There may be cases where you want to check if a variable is in the regular configuration file (i.e. read from there), see its value in ".gitmodules", and conditionally update the regular configuration file (i.e. write into it). The configset API was designed to help implement this kind of thing in a clean manner (i.e. initialize one, add ".gitmodules" file, and then configset_get_* on it, without affecting what you read and write with the regular config_get_*/config_set_* to the regular configuration file). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html