private void ProcessEntry(TreeEntry h, TreeEntry m, GitIndex.Entry i)
{
ObjectId iId = (i == null ? null : i.ObjectId);
ObjectId mId = (m == null ? null : m.Id);
ObjectId hId = (h == null ? null : h.Id);
string name = (i != null ? i.Name : (h != null ? h.FullName : m.FullName));
if (i == null)
{
//
// I (index) H M Result
// -------------------------------------------------------
// 0 nothing nothing nothing (does not happen)
// 1 nothing nothing exists use M
// 2 nothing exists nothing remove path from index
// 3 nothing exists exists use M
if (h == null)
{
_updated.Add(name, mId);
}
else if (m == null)
{
Removed.Add(name);
}
else
{
_updated.Add(name, mId);
}
}
else if (h == null)
{
//
// clean I==H I==M H M Result
// -----------------------------------------------------
// 4 yes N/A N/A nothing nothing keep index
// 5 no N/A N/A nothing nothing keep index
//
// 6 yes N/A yes nothing exists keep index
// 7 no N/A yes nothing exists keep index
// 8 yes N/A no nothing exists fail
// 9 no N/A no nothing exists fail
if (m == null || mId.Equals(iId))
{
if (HasParentBlob(_merge, name))
{
if (i.IsModified(_root, true))
{
Conflicts.Add(name);
}
else
{
Removed.Add(name);
}
}
}
else
{
Conflicts.Add(name);
}
}
else if (m == null)
{
//
// 10 yes yes N/A exists nothing remove path from index
// 11 no yes N/A exists nothing fail
// 12 yes no N/A exists nothing fail
// 13 no no N/A exists nothing fail
//
if (hId.Equals(iId))
{
if (i.IsModified(_root, true))
{
Conflicts.Add(name);
}
else
{
Removed.Add(name);
}
}
else
{
Conflicts.Add(name);
}
}
else
{
if (!hId.Equals(mId) && !hId.Equals(iId) && !mId.Equals(iId))
{
Conflicts.Add(name);
}
else if (hId.Equals(iId) && !mId.Equals(iId))
{
if (i.IsModified(_root, true))
{
Conflicts.Add(name);
}
else
{
_updated.Add(name, mId);
}
}
}
}