public virtual void RepositoryWithUninitializedModule() { string path = AddSubmoduleToIndex(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); modulesConfig.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants .CONFIG_KEY_PATH, path); string url = "git://server/repo.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); ICollection <string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual(url, generator.GetConfigUrl()); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }
public virtual void RepositoryWithNoSubmodules() { SubmoduleInitCommand command = new SubmoduleInitCommand(db); ICollection<string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.IsTrue(modules.IsEmpty()); }
public virtual void RepositoryWithNoSubmodules() { SubmoduleInitCommand command = new SubmoduleInitCommand(db); ICollection <string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.IsTrue(modules.IsEmpty()); }
public virtual void ResolveWorkingDirectoryRelativeUrl() { string path = AddSubmoduleToIndex(); string @base = db.WorkTree.GetAbsolutePath(); if (FilePath.separatorChar == '\\') { @base = @base.Replace('\\', '/'); } FileBasedConfig config = ((FileBasedConfig)db.GetConfig()); config.SetString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME , ConfigConstants.CONFIG_KEY_URL, null); config.Save(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); modulesConfig.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants .CONFIG_KEY_PATH, path); string url = "./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); ICollection <string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual(@base + "/sub.git", generator.GetConfigUrl()); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }
public virtual void ResolveTwoLevelHigherRelativeUrl() { string path = AddSubmoduleToIndex(); string @base = "git://server/repo.git"; FileBasedConfig config = ((FileBasedConfig)db.GetConfig()); config.SetString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME , ConfigConstants.CONFIG_KEY_URL, @base); config.Save(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); 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); ICollection <string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual("git://server2/sub.git", generator.GetConfigUrl() ); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }
public virtual void RepositoryWithUninitializedModule() { string path = AddSubmoduleToIndex(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); modulesConfig.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants .CONFIG_KEY_PATH, path); string url = "git://server/repo.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); ICollection<string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual(url, generator.GetConfigUrl()); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }
public virtual void ResolveWorkingDirectoryRelativeUrl() { string path = AddSubmoduleToIndex(); string @base = db.WorkTree.GetAbsolutePath(); if (FilePath.separatorChar == '\\') { @base = @base.Replace('\\', '/'); } FileBasedConfig config = ((FileBasedConfig)db.GetConfig()); config.SetString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME , ConfigConstants.CONFIG_KEY_URL, null); config.Save(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); modulesConfig.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants .CONFIG_KEY_PATH, path); string url = "./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); ICollection<string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual(@base + "/sub.git", generator.GetConfigUrl()); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }
public virtual void ResolveTwoLevelHigherRelativeUrl() { string path = AddSubmoduleToIndex(); string @base = "git://server/repo.git"; FileBasedConfig config = ((FileBasedConfig)db.GetConfig()); config.SetString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME , ConfigConstants.CONFIG_KEY_URL, @base); config.Save(); SubmoduleWalk generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.IsNull(generator.GetConfigUrl()); NUnit.Framework.Assert.IsNull(generator.GetConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants .DOT_GIT_MODULES), db.FileSystem); 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); ICollection<string> modules = command.Call(); NUnit.Framework.Assert.IsNotNull(modules); NUnit.Framework.Assert.AreEqual(1, modules.Count); NUnit.Framework.Assert.AreEqual(path, modules.Iterator().Next()); generator = SubmoduleWalk.ForIndex(db); NUnit.Framework.Assert.IsTrue(generator.Next()); NUnit.Framework.Assert.AreEqual("git://server2/sub.git", generator.GetConfigUrl() ); NUnit.Framework.Assert.AreEqual(update, generator.GetConfigUpdate()); }