continue;
String path = generator.getPath();
+ String name = generator.getModuleName();
// Copy 'url' and 'update' fields from .gitmodules to config
// file
String url = generator.getRemoteUrl();
String update = generator.getModulesUpdate();
if (url != null)
config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_URL, url);
+ name, ConfigConstants.CONFIG_KEY_URL, url);
if (update != null)
config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_UPDATE, update);
+ name, ConfigConstants.CONFIG_KEY_UPDATE, update);
if (url != null || update != null)
initialized.add(path);
}
return path;
}
+ /**
+ * The module name for the current submodule entry (used for the section name of .git/config)
+ * @since 4.10
+ * @return name
+ */
+ public String getModuleName() {
+ return getModuleName(path);
+ }
+
/**
* Get object id of current submodule entry
*
public String getModulesPath() throws IOException, ConfigInvalidException {
lazyLoadModulesConfig();
return modulesConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- getModuleName(path), ConfigConstants.CONFIG_KEY_PATH);
+ getModuleName(), ConfigConstants.CONFIG_KEY_PATH);
}
/**
* @throws java.io.IOException
*/
public String getConfigUrl() throws IOException, ConfigInvalidException {
- // SubmoduleInitCommand copies the submodules.*.url and
- // submodules.*.update values from .gitmodules to the config, and
- // does so using the path defined in .gitmodules as the subsection
- // name. So no path-to-name translation is necessary here.
return repoConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_URL);
+ getModuleName(), ConfigConstants.CONFIG_KEY_URL);
}
/**
public String getModulesUrl() throws IOException, ConfigInvalidException {
lazyLoadModulesConfig();
return modulesConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- getModuleName(path), ConfigConstants.CONFIG_KEY_URL);
+ getModuleName(), ConfigConstants.CONFIG_KEY_URL);
}
/**
*/
public String getConfigUpdate() throws IOException, ConfigInvalidException {
return repoConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_UPDATE);
+ getModuleName(), ConfigConstants.CONFIG_KEY_UPDATE);
}
/**
public String getModulesUpdate() throws IOException, ConfigInvalidException {
lazyLoadModulesConfig();
return modulesConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- getModuleName(path), ConfigConstants.CONFIG_KEY_UPDATE);
+ getModuleName(), ConfigConstants.CONFIG_KEY_UPDATE);
}
/**
ConfigInvalidException {
lazyLoadModulesConfig();
return modulesConfig.getEnum(IgnoreSubmoduleMode.values(),
- ConfigConstants.CONFIG_SUBMODULE_SECTION, getModuleName(path),
+ ConfigConstants.CONFIG_SUBMODULE_SECTION, getModuleName(),
ConfigConstants.CONFIG_KEY_IGNORE, IgnoreSubmoduleMode.NONE);
}