/// <exception cref="System.IO.IOException"></exception> internal virtual void ProcessEntry(TreeEntry h, TreeEntry m, GitIndex.Entry i) { ObjectId iId = (i == null ? null : i.GetObjectId()); ObjectId mId = (m == null ? null : m.GetId()); ObjectId hId = (h == null ? null : h.GetId()); string name = (i != null ? i.GetName() : (h != null ? h.GetFullName() : m.GetFullName ())); if (i == null) { if (h == null) { updated.Put(name, mId); } else { if (m == null) { removed.AddItem(name); } else { updated.Put(name, mId); } } } else { if (h == null) { if (m == null || mId.Equals(iId)) { if (HasParentBlob(merge, name)) { if (i.IsModified(root, true)) { conflicts.AddItem(name); } else { removed.AddItem(name); } } } else { conflicts.AddItem(name); } } else { if (m == null) { if (hId.Equals(iId)) { if (i.IsModified(root, true)) { conflicts.AddItem(name); } else { removed.AddItem(name); } } else { conflicts.AddItem(name); } } else { if (!hId.Equals(mId) && !hId.Equals(iId) && !mId.Equals(iId)) { conflicts.AddItem(name); } else { if (hId.Equals(iId) && !mId.Equals(iId)) { if (i.IsModified(root, true)) { conflicts.AddItem(name); } else { updated.Put(name, mId); } } } } } } }
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); } } } }
/// <exception cref="System.IO.IOException"></exception> public override void VisitEntry(TreeEntry m, GitIndex.Entry i, FilePath f) { // TODO remove this once we support submodules if (f.GetName().Equals(".gitmodules")) { throw new NotSupportedException(JGitText.Get().submodulesNotSupported); } if (m == null) { this._enclosing.index.Remove(this._enclosing.root, f); return; } bool needsCheckout = false; if (i == null) { needsCheckout = true; } else { if (i.GetObjectId().Equals(m.GetId())) { if (i.IsModified(this._enclosing.root, true)) { needsCheckout = true; } } else { needsCheckout = true; } } if (needsCheckout) { GitIndex.Entry newEntry = this._enclosing.index.AddEntry(m); this._enclosing.index.CheckoutEntry(this._enclosing.root, newEntry); } }