public virtual void TestBreakModify_RejoinIfUnpaired()
        {
            ObjectId  aId = Blob("foo");
            ObjectId  bId = Blob("bar");
            DiffEntry m   = DiffEntry.Modify(PATH_A);

            m.oldId = AbbreviatedObjectId.FromObjectId(aId);
            m.newId = AbbreviatedObjectId.FromObjectId(bId);
            rd.Add(m);
            rd.SetBreakScore(101);
            // Ensure m is broken apart
            IList <DiffEntry> entries = rd.Compute();

            NUnit.Framework.Assert.AreEqual(1, entries.Count);
            DiffEntry modify = entries[0];

            NUnit.Framework.Assert.AreEqual(m.oldPath, modify.oldPath);
            NUnit.Framework.Assert.AreEqual(m.oldId, modify.oldId);
            NUnit.Framework.Assert.AreEqual(m.oldMode, modify.oldMode);
            NUnit.Framework.Assert.AreEqual(m.newPath, modify.newPath);
            NUnit.Framework.Assert.AreEqual(m.newId, modify.newId);
            NUnit.Framework.Assert.AreEqual(m.newMode, modify.newMode);
            NUnit.Framework.Assert.AreEqual(m.changeType, modify.changeType);
            NUnit.Framework.Assert.AreEqual(0, modify.score);
        }
        public virtual void TestExactRename_OneRenameOneModify()
        {
            ObjectId  foo = Blob("foo");
            ObjectId  bar = Blob("bar");
            DiffEntry a   = DiffEntry.Add(PATH_A, foo);
            DiffEntry b   = DiffEntry.Delete(PATH_Q, foo);
            DiffEntry c   = DiffEntry.Modify(PATH_H);

            c.newId = c.oldId = AbbreviatedObjectId.FromObjectId(bar);
            rd.Add(a);
            rd.Add(b);
            rd.Add(c);
            IList <DiffEntry> entries = rd.Compute();

            NUnit.Framework.Assert.AreEqual(2, entries.Count);
            AssertRename(b, a, 100, entries[0]);
            NUnit.Framework.Assert.AreSame(c, entries[1]);
        }
        public virtual void TestBreakModify_BreakNone()
        {
            ObjectId  aId = Blob("foo");
            ObjectId  bId = Blob("bar");
            DiffEntry m   = DiffEntry.Modify(PATH_A);

            m.oldId = AbbreviatedObjectId.FromObjectId(aId);
            m.newId = AbbreviatedObjectId.FromObjectId(bId);
            DiffEntry a = DiffEntry.Add(PATH_B, aId);

            rd.Add(a);
            rd.Add(m);
            rd.SetBreakScore(-1);
            IList <DiffEntry> entries = rd.Compute();

            NUnit.Framework.Assert.AreEqual(2, entries.Count);
            NUnit.Framework.Assert.AreSame(m, entries[0]);
            NUnit.Framework.Assert.AreSame(a, entries[1]);
        }
        public virtual void TestBreakModify_BreakAll()
        {
            ObjectId  aId = Blob("foo");
            ObjectId  bId = Blob("bar");
            DiffEntry m   = DiffEntry.Modify(PATH_A);

            m.oldId = AbbreviatedObjectId.FromObjectId(aId);
            m.newId = AbbreviatedObjectId.FromObjectId(bId);
            DiffEntry a = DiffEntry.Add(PATH_B, aId);

            rd.Add(a);
            rd.Add(m);
            rd.SetBreakScore(101);
            IList <DiffEntry> entries = rd.Compute();

            NUnit.Framework.Assert.AreEqual(2, entries.Count);
            AssertAdd(PATH_A, bId, FileMode.REGULAR_FILE, entries[0]);
            AssertRename(DiffEntry.BreakModify(m)[0], a, 100, entries[1]);
        }
        public virtual void TestBreakModify_DontBreakAboveScore()
        {
            ObjectId  aId = Blob("blah\nblah\nfoo");
            ObjectId  bId = Blob("blah\nblah\nbar");
            DiffEntry m   = DiffEntry.Modify(PATH_A);

            m.oldId = AbbreviatedObjectId.FromObjectId(aId);
            m.newId = AbbreviatedObjectId.FromObjectId(bId);
            DiffEntry a = DiffEntry.Add(PATH_B, aId);

            rd.Add(a);
            rd.Add(m);
            rd.SetBreakScore(20);
            // Should not break the modify
            IList <DiffEntry> entries = rd.Compute();

            NUnit.Framework.Assert.AreEqual(2, entries.Count);
            NUnit.Framework.Assert.AreSame(m, entries[0]);
            NUnit.Framework.Assert.AreSame(a, entries[1]);
        }