Пример #1
0
        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());
        }
Пример #2
0
        public virtual void TestTreeIteratorWithGitmodules()
        {
            ObjectId subId      = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string   path       = "sub";
            Config   gitmodules = new Config();

            gitmodules.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                 .CONFIG_KEY_PATH, "sub");
            gitmodules.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                 .CONFIG_KEY_URL, "git://example.com/sub");
            RevCommit commit = testDb.GetRevWalk().ParseCommit(testDb.Commit().NoParents().Add
                                                                   (Constants.DOT_GIT_MODULES, gitmodules.ToText()).Edit(new _PathEdit_397(subId, path
                                                                                                                                           )).Create());
            CanonicalTreeParser p = new CanonicalTreeParser();

            p.Reset(testDb.GetRevWalk().GetObjectReader(), commit.Tree);
            SubmoduleWalk gen = SubmoduleWalk.ForPath(db, p, "sub");

            NUnit.Framework.Assert.AreEqual(path, gen.GetPath());
            NUnit.Framework.Assert.AreEqual(subId, gen.GetObjectId());
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, path), gen.GetDirectory
                                                ());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUrl());
            NUnit.Framework.Assert.AreEqual("sub", gen.GetModulesPath());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUpdate());
            NUnit.Framework.Assert.AreEqual("git://example.com/sub", gen.GetModulesUrl());
            NUnit.Framework.Assert.IsNull(gen.GetRepository());
            NUnit.Framework.Assert.IsFalse(gen.Next());
        }
Пример #3
0
        public virtual void ResolveInvalidParentUrl()
        {
            string          path   = AddSubmoduleToIndex();
            string          @base  = "no_slash";
            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 = "../sub.git";

            modulesConfig.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                    .CONFIG_KEY_URL, url);
            modulesConfig.Save();
            try
            {
                new SubmoduleInitCommand(db).Call();
                NUnit.Framework.Assert.Fail("Exception not thrown");
            }
            catch (JGitInternalException e)
            {
                NUnit.Framework.Assert.IsTrue(e.InnerException is IOException);
            }
        }
Пример #4
0
        public virtual void RepositoryWithNoSubmodules()
        {
            SubmoduleWalk gen = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsFalse(gen.Next());
            NUnit.Framework.Assert.IsNull(gen.GetPath());
            NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, gen.GetObjectId());
        }
Пример #5
0
        public virtual void RepositoryWithSubmodule()
        {
            WriteTrashFile("file.txt", "content");
            Git git = Git.Wrap(db);

            git.Add().AddFilepattern("file.txt").Call();
            git.Commit().SetMessage("create file").Call();
            ObjectId       id     = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string         path   = "sub";
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_96(id, path));
            editor.Commit();
            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);
            modulesConfig.Save();
            Repository subRepo = Git.CloneRepository().SetURI(db.Directory.ToURI().ToString()
                                                              ).SetDirectory(new FilePath(db.WorkTree, path)).Call().GetRepository();

            AddRepoToClose(subRepo);
            NUnit.Framework.Assert.IsNotNull(subRepo);
            SubmoduleWalk generator = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(generator.Next());
            NUnit.Framework.Assert.IsNull(generator.GetConfigUrl());
            NUnit.Framework.Assert.AreEqual(url, generator.GetModulesUrl());
            SubmoduleSyncCommand         command = new SubmoduleSyncCommand(db);
            IDictionary <string, string> synced  = command.Call();

            NUnit.Framework.Assert.IsNotNull(synced);
            NUnit.Framework.Assert.AreEqual(1, synced.Count);
            KeyValuePair <string, string> module = synced.EntrySet().Iterator().Next();

            NUnit.Framework.Assert.AreEqual(path, module.Key);
            NUnit.Framework.Assert.AreEqual(url, module.Value);
            generator = SubmoduleWalk.ForIndex(db);
            NUnit.Framework.Assert.IsTrue(generator.Next());
            NUnit.Framework.Assert.AreEqual(url, generator.GetConfigUrl());
            Repository subModRepository = generator.GetRepository();

            AddRepoToClose(subModRepository);
            StoredConfig submoduleConfig = subModRepository.GetConfig();

            NUnit.Framework.Assert.AreEqual(url, submoduleConfig.GetString(ConfigConstants.CONFIG_REMOTE_SECTION
                                                                           , Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL));
        }
Пример #6
0
        public virtual void RepositoryWithRootLevelSubmoduleRelativeRef()
        {
            ObjectId id     = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string   path   = "sub";
            FilePath dotGit = new FilePath(db.WorkTree, path + FilePath.separatorChar + Constants
                                           .DOT_GIT);

            if (!dotGit.GetParentFile().Exists())
            {
                dotGit.GetParentFile().Mkdirs();
            }
            FilePath modulesGitDir = new FilePath(db.Directory, "modules" + FilePath.separatorChar
                                                  + path);

            new FileWriter(dotGit).Append("gitdir: " + "../" + Constants.DOT_GIT + "/modules/"
                                          + path).Close();
            FileRepositoryBuilder builder = new FileRepositoryBuilder();

            builder.SetWorkTree(new FilePath(db.WorkTree, path));
            builder.Build().Create();
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_203(id, path));
            editor.Commit();
            SubmoduleWalk gen = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(gen.Next());
            NUnit.Framework.Assert.AreEqual(path, gen.GetPath());
            NUnit.Framework.Assert.AreEqual(id, gen.GetObjectId());
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, path), gen.GetDirectory
                                                ());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUrl());
            NUnit.Framework.Assert.IsNull(gen.GetModulesPath());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUrl());
            Repository subRepo = gen.GetRepository();

            AddRepoToClose(subRepo);
            NUnit.Framework.Assert.IsNotNull(subRepo);
            NUnit.Framework.Assert.AreEqual(modulesGitDir, subRepo.Directory);
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, path), subRepo.WorkTree
                                            );
            NUnit.Framework.Assert.IsFalse(gen.Next());
        }
Пример #7
0
        public virtual void AddSubmoduleWithRelativeUri()
        {
            Git git = new Git(db);

            WriteTrashFile("file.txt", "content");
            git.Add().AddFilepattern("file.txt").Call();
            RevCommit           commit  = git.Commit().SetMessage("create file").Call();
            SubmoduleAddCommand command = new SubmoduleAddCommand(db);
            string path = "sub";
            string uri  = "./.git";

            command.SetPath(path);
            command.SetURI(uri);
            Repository repo = command.Call();

            NUnit.Framework.Assert.IsNotNull(repo);
            AddRepoToClose(repo);
            SubmoduleWalk generator = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(generator.Next());
            NUnit.Framework.Assert.AreEqual(path, generator.GetPath());
            NUnit.Framework.Assert.AreEqual(commit, generator.GetObjectId());
            NUnit.Framework.Assert.AreEqual(uri, generator.GetModulesUrl());
            NUnit.Framework.Assert.AreEqual(path, generator.GetModulesPath());
            string fullUri = db.Directory.GetAbsolutePath();

            if (FilePath.separatorChar == '\\')
            {
                fullUri = fullUri.Replace('\\', '/');
            }
            NUnit.Framework.Assert.AreEqual(fullUri, generator.GetConfigUrl());
            Repository subModRepo = generator.GetRepository();

            AddRepoToClose(subModRepo);
            NUnit.Framework.Assert.IsNotNull(subModRepo);
            NUnit.Framework.Assert.AreEqual(fullUri, subModRepo.GetConfig().GetString(ConfigConstants
                                                                                      .CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL
                                                                                      ));
            NUnit.Framework.Assert.AreEqual(commit, repo.Resolve(Constants.HEAD));
            Status status = Git.Wrap(db).Status().Call();

            NUnit.Framework.Assert.IsTrue(status.GetAdded().Contains(Constants.DOT_GIT_MODULES
                                                                     ));
            NUnit.Framework.Assert.IsTrue(status.GetAdded().Contains(path));
        }
Пример #8
0
        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());
        }
Пример #9
0
        public virtual void GeneratorFilteredToOneOfTwoSubmodules()
        {
            ObjectId       id1    = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string         path1  = "sub1";
            ObjectId       id2    = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1235");
            string         path2  = "sub2";
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_271(id1, path1));
            editor.Add(new _PathEdit_278(id2, path2));
            editor.Commit();
            SubmoduleWalk gen = SubmoduleWalk.ForIndex(db);

            gen.SetFilter(PathFilter.Create(path1));
            NUnit.Framework.Assert.IsTrue(gen.Next());
            NUnit.Framework.Assert.AreEqual(path1, gen.GetPath());
            NUnit.Framework.Assert.AreEqual(id1, gen.GetObjectId());
            NUnit.Framework.Assert.IsFalse(gen.Next());
        }
Пример #10
0
        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());
        }
Пример #11
0
        public virtual void RepositoryWithSubmodule()
        {
            WriteTrashFile("file.txt", "content");
            Git git = Git.Wrap(db);

            git.Add().AddFilepattern("file.txt").Call();
            RevCommit      commit = git.Commit().SetMessage("create file").Call();
            string         path   = "sub";
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_94(commit, path));
            editor.Commit();
            StoredConfig config = ((FileBasedConfig)db.GetConfig());

            config.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.
                             CONFIG_KEY_URL, db.Directory.ToURI().ToString());
            config.Save();
            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);
            modulesConfig.Save();
            SubmoduleUpdateCommand command = new SubmoduleUpdateCommand(db);
            ICollection <string>   updated = command.Call();

            NUnit.Framework.Assert.IsNotNull(updated);
            NUnit.Framework.Assert.AreEqual(1, updated.Count);
            NUnit.Framework.Assert.AreEqual(path, updated.Iterator().Next());
            SubmoduleWalk generator = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(generator.Next());
            Repository subRepo = generator.GetRepository();

            AddRepoToClose(subRepo);
            NUnit.Framework.Assert.IsNotNull(subRepo);
            NUnit.Framework.Assert.AreEqual(commit, subRepo.Resolve(Constants.HEAD));
        }
Пример #12
0
        public virtual void IndexWithGitmodules()
        {
            ObjectId subId      = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string   path       = "sub";
            Config   gitmodules = new Config();

            gitmodules.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                 .CONFIG_KEY_PATH, "sub");
            // Different config in the index should be overridden by the working tree.
            gitmodules.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                 .CONFIG_KEY_URL, "git://example.com/bad");
            RevBlob gitmodulesBlob = testDb.Blob(gitmodules.ToText());

            gitmodules.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants
                                 .CONFIG_KEY_URL, "git://example.com/sub");
            WriteTrashFile(Constants.DOT_GIT_MODULES, gitmodules.ToText());
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_315(subId, path));
            editor.Add(new _PathEdit_322(gitmodulesBlob, Constants.DOT_GIT_MODULES));
            editor.Commit();
            SubmoduleWalk gen = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(gen.Next());
            NUnit.Framework.Assert.AreEqual(path, gen.GetPath());
            NUnit.Framework.Assert.AreEqual(subId, gen.GetObjectId());
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, path), gen.GetDirectory
                                                ());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUrl());
            NUnit.Framework.Assert.AreEqual("sub", gen.GetModulesPath());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUpdate());
            NUnit.Framework.Assert.AreEqual("git://example.com/sub", gen.GetModulesUrl());
            NUnit.Framework.Assert.IsNull(gen.GetRepository());
            NUnit.Framework.Assert.IsFalse(gen.Next());
        }
Пример #13
0
        public virtual void AddSubmodule()
        {
            Git git = new Git(db);

            WriteTrashFile("file.txt", "content");
            git.Add().AddFilepattern("file.txt").Call();
            RevCommit           commit  = git.Commit().SetMessage("create file").Call();
            SubmoduleAddCommand command = new SubmoduleAddCommand(db);
            string path = "sub";

            command.SetPath(path);
            string uri = db.Directory.ToURI().ToString();

            command.SetURI(uri);
            Repository repo = command.Call();

            NUnit.Framework.Assert.IsNotNull(repo);
            AddRepoToClose(repo);
            SubmoduleWalk generator = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(generator.Next());
            NUnit.Framework.Assert.AreEqual(path, generator.GetPath());
            NUnit.Framework.Assert.AreEqual(commit, generator.GetObjectId());
            NUnit.Framework.Assert.AreEqual(uri, generator.GetModulesUrl());
            NUnit.Framework.Assert.AreEqual(path, generator.GetModulesPath());
            NUnit.Framework.Assert.AreEqual(uri, generator.GetConfigUrl());
            Repository subModRepo = generator.GetRepository();

            AddRepoToClose(subModRepo);
            NUnit.Framework.Assert.IsNotNull(subModRepo);
            NUnit.Framework.Assert.AreEqual(commit, repo.Resolve(Constants.HEAD));
            Status status = Git.Wrap(db).Status().Call();

            NUnit.Framework.Assert.IsTrue(status.GetAdded().Contains(Constants.DOT_GIT_MODULES
                                                                     ));
            NUnit.Framework.Assert.IsTrue(status.GetAdded().Contains(path));
        }
Пример #14
0
        public virtual void RepositoryWithRootLevelSubmodule()
        {
            ObjectId       id     = ObjectId.FromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
            string         path   = "sub";
            DirCache       cache  = db.LockDirCache();
            DirCacheEditor editor = cache.Editor();

            editor.Add(new _PathEdit_108(id, path));
            editor.Commit();
            SubmoduleWalk gen = SubmoduleWalk.ForIndex(db);

            NUnit.Framework.Assert.IsTrue(gen.Next());
            NUnit.Framework.Assert.AreEqual(path, gen.GetPath());
            NUnit.Framework.Assert.AreEqual(id, gen.GetObjectId());
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, path), gen.GetDirectory
                                                ());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetConfigUrl());
            NUnit.Framework.Assert.IsNull(gen.GetModulesPath());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUpdate());
            NUnit.Framework.Assert.IsNull(gen.GetModulesUrl());
            NUnit.Framework.Assert.IsNull(gen.GetRepository());
            NUnit.Framework.Assert.IsFalse(gen.Next());
        }