/// <exception cref="System.IO.IOException"></exception>
        private void BreakModifies(ContentSource.Pair reader, ProgressMonitor pm)
        {
            AList <DiffEntry> newEntries = new AList <DiffEntry>(entries.Count);

            pm.BeginTask(JGitText.Get().renamesBreakingModifies, entries.Count);
            for (int i = 0; i < entries.Count; i++)
            {
                DiffEntry e = entries[i];
                if (e.GetChangeType() == DiffEntry.ChangeType.MODIFY)
                {
                    int score = CalculateModifyScore(reader, e);
                    if (score < breakScore)
                    {
                        IList <DiffEntry> tmp = DiffEntry.BreakModify(e);
                        DiffEntry         del = tmp[0];
                        del.score = score;
                        deleted.AddItem(del);
                        added.AddItem(tmp[1]);
                    }
                    else
                    {
                        newEntries.AddItem(e);
                    }
                }
                else
                {
                    newEntries.AddItem(e);
                }
                pm.Update(1);
            }
            entries = newEntries;
        }
        /// <summary>Add entries to be considered for rename detection.</summary>
        /// <remarks>Add entries to be considered for rename detection.</remarks>
        /// <param name="entriesToAdd">one or more entries to add.</param>
        /// <exception cref="System.InvalidOperationException">
        /// if
        /// <code>getEntries</code>
        /// was already invoked.
        /// </exception>
        public virtual void AddAll(ICollection <DiffEntry> entriesToAdd)
        {
            if (done)
            {
                throw new InvalidOperationException(JGitText.Get().renamesAlreadyFound);
            }
            foreach (DiffEntry entry in entriesToAdd)
            {
                switch (entry.GetChangeType())
                {
                case DiffEntry.ChangeType.ADD:
                {
                    added.AddItem(entry);
                    break;
                }

                case DiffEntry.ChangeType.DELETE:
                {
                    deleted.AddItem(entry);
                    break;
                }

                case DiffEntry.ChangeType.MODIFY:
                {
                    if (SameType(entry.GetOldMode(), entry.GetNewMode()))
                    {
                        entries.AddItem(entry);
                    }
                    else
                    {
                        IList <DiffEntry> tmp = DiffEntry.BreakModify(entry);
                        deleted.AddItem(tmp[0]);
                        added.AddItem(tmp[1]);
                    }
                    break;
                }

                case DiffEntry.ChangeType.COPY:
                case DiffEntry.ChangeType.RENAME:
                default:
                {
                    entries.AddItem(entry);
                    break;
                }
                }
            }
        }
        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]);
        }