|
|
@ -86,11 +86,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
ConfigInvalidException, GitAPIException { |
|
|
|
ConfigInvalidException, GitAPIException { |
|
|
|
final String path = addSubmoduleToIndex(); |
|
|
|
final String path = addSubmoduleToIndex(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
@ -109,11 +109,12 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
|
|
|
|
|
|
|
|
generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertEquals(url, generator.getConfigUrl()); |
|
|
|
assertEquals(url, generator.getConfigUrl()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveSameLevelRelativeUrl() throws Exception { |
|
|
|
public void resolveSameLevelRelativeUrl() throws Exception { |
|
|
@ -126,11 +127,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
base); |
|
|
|
base); |
|
|
|
config.save(); |
|
|
|
config.save(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
@ -149,11 +150,13 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
|
|
|
|
|
|
|
|
generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertEquals("git://server/repo.git/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals("git://server/repo.git/sub.git", |
|
|
|
|
|
|
|
generator.getConfigUrl()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveOneLevelHigherRelativeUrl() throws IOException, |
|
|
|
public void resolveOneLevelHigherRelativeUrl() throws IOException, |
|
|
@ -167,11 +170,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
base); |
|
|
|
base); |
|
|
|
config.save(); |
|
|
|
config.save(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
@ -190,11 +193,12 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
|
|
|
|
|
|
|
|
generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertEquals("git://server/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals("git://server/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveTwoLevelHigherRelativeUrl() throws IOException, |
|
|
|
public void resolveTwoLevelHigherRelativeUrl() throws IOException, |
|
|
@ -208,11 +212,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
base); |
|
|
|
base); |
|
|
|
config.save(); |
|
|
|
config.save(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
@ -231,11 +235,12 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
|
|
|
|
|
|
|
|
generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertEquals("git://server2/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals("git://server2/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveWorkingDirectoryRelativeUrl() throws IOException, |
|
|
|
public void resolveWorkingDirectoryRelativeUrl() throws IOException, |
|
|
@ -250,11 +255,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL); |
|
|
|
Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL); |
|
|
|
config.save(); |
|
|
|
config.save(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
@ -273,11 +278,12 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(1, modules.size()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
assertEquals(path, modules.iterator().next()); |
|
|
|
|
|
|
|
|
|
|
|
generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertEquals(base + "/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals(base + "/sub.git", generator.getConfigUrl()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
assertEquals(update, generator.getConfigUpdate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveInvalidParentUrl() throws IOException, |
|
|
|
public void resolveInvalidParentUrl() throws IOException, |
|
|
@ -291,11 +297,11 @@ public class SubmoduleInitTest extends RepositoryTestCase { |
|
|
|
base); |
|
|
|
base); |
|
|
|
config.save(); |
|
|
|
config.save(); |
|
|
|
|
|
|
|
|
|
|
|
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); |
|
|
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) { |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertTrue(generator.next()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUrl()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
assertNull(generator.getConfigUpdate()); |
|
|
|
|
|
|
|
} |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
FileBasedConfig modulesConfig = new FileBasedConfig(new File( |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, |
|
|
|