/// <exception cref="System.IO.IOException"></exception> internal virtual void ReadTree(string prefix, Tree t) { TreeEntry[] members = t.Members(); for (int i = 0; i < members.Length; ++i) { TreeEntry te = members[i]; string name; if (prefix.Length > 0) { name = prefix + "/" + te.GetName(); } else { name = te.GetName(); } if (te is Tree) { ReadTree(name, (Tree)te); } else { GitIndex.Entry e = new GitIndex.Entry(this, te, 0); entries.Put(Constants.Encode(name), e); } } }
/// <summary>Add the specified tree entry to this tree.</summary> /// <remarks>Add the specified tree entry to this tree.</remarks> /// <param name="e"></param> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public virtual void AddEntry(TreeEntry e) { int p; EnsureLoaded(); p = BinarySearch(contents, e.GetNameUTF8(), TreeEntry.LastChar(e), 0, e.GetNameUTF8 ().Length); if (p < 0) { e.AttachParent(this); InsertEntry(p, e); } else { throw new EntryExistsException(e.GetName()); } }
/// <summary>Add the specified tree entry to this tree.</summary> /// <remarks>Add the specified tree entry to this tree.</remarks> /// <param name="e"></param> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public virtual void AddEntry(TreeEntry e) { int p; EnsureLoaded(); p = BinarySearch(contents, e.GetNameUTF8(), TreeEntry.LastChar(e), 0, e.GetNameUTF8 ().Length); if (p < 0) { e.AttachParent(this); InsertEntry(p, e); } else { throw new EntryExistsException(e.GetName()); } }