public override void SetUp() { base.SetUp(); toLoad = new AList <WindowCacheGetTest.TestObject>(); BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream( JGitTestUtil.GetTestResourceFile("all_packed_objects.txt")), Constants.CHARSET)); try { string line; while ((line = br.ReadLine()) != null) { string[] parts = line.Split(" {1,}"); WindowCacheGetTest.TestObject o = new WindowCacheGetTest.TestObject(this); o.id = ObjectId.FromString(parts[0]); o.SetType(parts[1]); // parts[2] is the inflate size // parts[3] is the size-in-pack // parts[4] is the offset in the pack toLoad.AddItem(o); } } finally { br.Close(); } NUnit.Framework.Assert.AreEqual(96, toLoad.Count); }
public virtual void Test1() { FilePath packFile = JGitTestUtil.GetTestResourceFile("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack" ); InputStream @is = new FileInputStream(packFile); try { IndexPack pack = new IndexPack(db, @is, new FilePath(trash, "tmp_pack1")); pack.Index(new TextProgressMonitor()); PackFile file = new PackFile(new FilePath(trash, "tmp_pack1.idx"), new FilePath(trash , "tmp_pack1.pack")); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("540a36d136cf413e4b064c2b0e0a4db60f77feab" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("82c6b885ff600be425b4ea96dee75dca255b69e7" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("aabf2ffaec9b497f0950352b3e582d73035c2035" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("c59759f143fb1fe21c197981df75a7ee00290799" ))); } finally { @is.Close(); } }
public override void SetUp() { base.SetUp(); // index with both small (< 2^31) and big offsets idx = PackIndex.Open(JGitTestUtil.GetTestResourceFile("pack-huge.idx")); reverseIdx = new PackReverseIndex(idx); }
public virtual void TestWritePack2DeltasCRC32Copy() { FilePath packDir = new FilePath(((ObjectDirectory)db.ObjectDatabase).GetDirectory (), "pack"); FilePath crc32Pack = new FilePath(packDir, "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack" ); FilePath crc32Idx = new FilePath(packDir, "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx" ); CopyFile(JGitTestUtil.GetTestResourceFile("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2" ), crc32Idx); db.OpenPack(crc32Pack, crc32Idx); WriteVerifyPack2(true); }
public virtual void TestRemovedSubtree() { FilePath path = JGitTestUtil.GetTestResourceFile("dircache.testRemovedSubtree"); DirCache dc = DirCache.Read(path, FS.DETECTED); NUnit.Framework.Assert.AreEqual(2, dc.GetEntryCount()); TreeWalk tw = new TreeWalk(db); tw.Recursive = true; tw.AddTree(new DirCacheIterator(dc)); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("a/a", tw.PathString); NUnit.Framework.Assert.AreSame(FileMode.REGULAR_FILE, tw.GetFileMode(0)); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("q", tw.PathString); NUnit.Framework.Assert.AreSame(FileMode.REGULAR_FILE, tw.GetFileMode(0)); NUnit.Framework.Assert.IsFalse(tw.Next()); }
public virtual void Test2() { FilePath packFile = JGitTestUtil.GetTestResourceFile("pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack" ); InputStream @is = new FileInputStream(packFile); try { IndexPack pack = new IndexPack(db, @is, new FilePath(trash, "tmp_pack2")); pack.Index(new TextProgressMonitor()); PackFile file = new PackFile(new FilePath(trash, "tmp_pack2.idx"), new FilePath(trash , "tmp_pack2.pack")); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("02ba32d3649e510002c21651936b7077aa75ffa9" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("0966a434eb1a025db6b71485ab63a3bfbea520b6" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("09efc7e59a839528ac7bda9fa020dc9101278680" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("0a3d7772488b6b106fb62813c4d6d627918d9181" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("1004d0d7ac26fbf63050a234c9b88a46075719d3" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("10da5895682013006950e7da534b705252b03be6" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("1203b03dc816ccbb67773f28b3c19318654b0bc8" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("15fae9e651043de0fd1deef588aa3fbf5a7a41c6" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("16f9ec009e5568c435f473ba3a1df732d49ce8c3" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("1fd7d579fb6ae3fe942dc09c2c783443d04cf21e" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("20a8ade77639491ea0bd667bf95de8abf3a434c8" ))); NUnit.Framework.Assert.IsTrue(file.HasObject(ObjectId.FromString("2675188fd86978d5bc4d7211698b2118ae3bf658" ))); } finally { // and lots more... @is.Close(); } }
/// <exception cref="System.Exception"></exception> public ApplyResult Init(string name, bool preExists = true, bool postExists = true) { Git git = new Git(db); if (preExists) { a = new RawText(ReadFile(name + "_PreImage", useCrlfFiles)); JGitTestUtil.Write(new FilePath(db.Directory.GetParent(), name), a.GetString(0, a.Size(), false )); git.Add().AddFilepattern(name).Call(); git.Commit().SetMessage("PreImage").Call(); } if (postExists) { bool postShouldHaveCrlf = preExists && a.GetLineDelimiter() != null?a.GetLineDelimiter() != "\n" : useCrlfPatches; b = new RawText(ReadFile(name + "_PostImage", postShouldHaveCrlf)); } return(git.Apply().SetPatch(typeof(DiffFormatterReflowTest).GetResourceAsStream(name + ".patch", useCrlfPatches)).Call()); }
/// <exception cref="System.Exception"></exception> public override void SetUp() { base.SetUp(); string[] packs = new string[] { "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f", "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371", "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745" , "pack-546ff360fe3488adb20860ce3436a2d6373d2796", "pack-cbdeda40019ae0e6e789088ea0f51f164f489d14" , "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa", "pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12" }; FilePath packDir = new FilePath(((ObjectDirectory)db.ObjectDatabase).GetDirectory (), "pack"); foreach (string n in packs) { CopyFile(JGitTestUtil.GetTestResourceFile(n + ".pack"), new FilePath(packDir, n + ".pack")); CopyFile(JGitTestUtil.GetTestResourceFile(n + ".idx"), new FilePath(packDir, n + ".idx")); } CopyFile(JGitTestUtil.GetTestResourceFile("packed-refs"), new FilePath(db.Directory , "packed-refs")); }
/// <exception cref="System.IO.IOException"></exception> protected internal virtual FilePath WriteTrashFile(string name, string data) { return(JGitTestUtil.WriteTrashFile(db, name, data)); }
/// <exception cref="System.IO.IOException"></exception> protected internal virtual void DeleteTrashFile(string name) { JGitTestUtil.DeleteTrashFile(db, name); }
/// <exception cref="System.IO.IOException"></exception> protected internal virtual string Read(string name) { return(base.Read(name)); return(JGitTestUtil.Read(db, name)); }
public override FilePath GetFileForPackdf2982f28() { return(JGitTestUtil.GetTestResourceFile("pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2" )); }
public override FilePath GetFileForPack34be9032() { return(JGitTestUtil.GetTestResourceFile("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2" )); }
private FilePath PathOf(string name) { return(JGitTestUtil.GetTestResourceFile(name)); }