public virtual void Test000_openrepo_alternate_index_file_and_objdirs() { FilePath repo1Parent = new FilePath(trash.GetParentFile(), "r1"); FilePath indexFile = new FilePath(trash, "idx"); FilePath objDir = new FilePath(trash, "../obj"); FilePath altObjDir = ((ObjectDirectory)db.ObjectDatabase).GetDirectory(); Repository repo1initial = new FileRepository(new FilePath(repo1Parent, Constants. DOT_GIT)); repo1initial.Create(); repo1initial.Close(); FilePath theDir = new FilePath(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().SetGitDir(theDir).SetObjectDirectory (objDir).AddAlternateObjectDirectory(altObjDir).SetIndexFile(indexFile).Build(); // // // // AssertEqualsPath(theDir, r.Directory); AssertEqualsPath(theDir.GetParentFile(), r.WorkTree); AssertEqualsPath(indexFile, r.GetIndexFile()); AssertEqualsPath(objDir, ((ObjectDirectory)r.ObjectDatabase).GetDirectory()); NUnit.Framework.Assert.IsNotNull(r.Open(ObjectId.FromString("6db9c2ebf75590eef973081736730a9ea169a0c4" ))); // Must close or the default repo pack files created by this test gets // locked via the alternate object directories on Windows. r.Close(); }
public virtual void Test000_openrepo_default_workDirSet() { FilePath repo1Parent = new FilePath(trash.GetParentFile(), "r1"); Repository repo1initial = new FileRepository(new FilePath(repo1Parent, Constants. DOT_GIT)); repo1initial.Create(); repo1initial.Close(); FilePath theDir = new FilePath(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().SetWorkTree(repo1Parent).Build(); AssertEqualsPath(theDir, r.Directory); AssertEqualsPath(repo1Parent, r.WorkTree); AssertEqualsPath(new FilePath(theDir, "index"), r.GetIndexFile()); AssertEqualsPath(new FilePath(theDir, "objects"), ((ObjectDirectory)r.ObjectDatabase ).GetDirectory()); }
public virtual void Test000_openrepo_default_relative_workdirconfig() { FilePath repo1Parent = new FilePath(trash.GetParentFile(), "r1"); FilePath workdir = new FilePath(trash.GetParentFile(), "rw"); FileUtils.Mkdir(workdir); FileRepository repo1initial = new FileRepository(new FilePath(repo1Parent, Constants .DOT_GIT)); repo1initial.Create(); FileBasedConfig cfg = ((FileBasedConfig)repo1initial.GetConfig()); cfg.SetString("core", null, "worktree", "../../rw"); cfg.Save(); repo1initial.Close(); FilePath theDir = new FilePath(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().SetGitDir(theDir).Build(); AssertEqualsPath(theDir, r.Directory); AssertEqualsPath(workdir, r.WorkTree); AssertEqualsPath(new FilePath(theDir, "index"), r.GetIndexFile()); AssertEqualsPath(new FilePath(theDir, "objects"), ((ObjectDirectory)r.ObjectDatabase ).GetDirectory()); }