}
});
editor.commit();
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();
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 current = "git://server/repo.git";
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_URL, current);
modulesConfig.save();
Repository subRepo = Git.cloneRepository()
.setURI(db.getDirectory().toURI().toString())
.setDirectory(new File(db.getWorkTree(), path)).call()
.getRepository();
assertNotNull(subRepo);
addRepoToClose(subRepo);
SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
assertTrue(generator.next());
assertNull(generator.getConfigUrl());
assertEquals(current, generator.getModulesUrl());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_URL, "../sub.git");
modulesConfig.save();
SubmoduleSyncCommand command = new SubmoduleSyncCommand(db);
Map<String, String> synced = command.call();
assertNotNull(synced);
assertEquals(1, synced.size());