/// <summary>
        /// Removes the <see cref="TreeEntryDefinition"/> located at each of the
        /// specified <paramref name="treeEntryPaths"/>.
        /// </summary>
        /// <param name="td">The <see cref="TreeDefinition"/>.</param>
        /// <param name="treeEntryPaths">The paths within this <see cref="TreeDefinition"/>.</param>
        /// <returns>The current <see cref="TreeDefinition"/>.</returns>
        public static TreeDefinition Remove(this TreeDefinition td, IEnumerable <string> treeEntryPaths)
        {
            Ensure.ArgumentNotNull(td, "td");
            Ensure.ArgumentNotNull(treeEntryPaths, "treeEntryPaths");

            foreach (var treeEntryPath in treeEntryPaths)
            {
                td.Remove(treeEntryPath);
            }

            return(td);
        }
Ejemplo n.º 2
0
        private static void UpdateDeletionTreeDefinitions(IEnumerable <ObjectRepositoryEntryChanges> deletions, TreeDefinition definition, Commit oldCommit = null)
        {
            foreach (var deleted in deletions)
            {
                if (oldCommit == null)
                {
                    throw new GitObjectDbException("Unexpected state: no deletion should be detected on blank commit.");
                }

                var folderEntry = oldCommit[deleted.Path.GetParentPath()];
                if (folderEntry != null)
                {
                    definition.Remove(folderEntry.Path);
                }
            }
        }