public void resolveTwoLevelHigherRelativeUrl() throws IOException,
ConfigInvalidException, GitAPIException {
final String path = addSubmoduleToIndex();
String base = "git://server/repo.git";
FileBasedConfig config = db.getConfig();
config.setString(ConfigConstants.CONFIG_REMOTE_SECTION,
Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL,
base);
config.save();
SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
assertTrue(generator.next());
assertNull(generator.getConfigUrl());
assertNull(generator.getConfigUpdate());
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_PATH, path);
String url = "../../server2/sub.git";
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_URL, url);
String update = "rebase";
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_UPDATE, update);
modulesConfig.save();
SubmoduleInitCommand command = new SubmoduleInitCommand(db);
Collection<String> modules = command.call();
assertNotNull(modules);
assertEquals(1, modules.size());