From 4f46d95c2b8ae6a135d1b54ff23cf1ab5f2d6c4f Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Tue, 25 May 2021 12:33:32 +0200 Subject: [PATCH] Remove dead code --- .../Managed/ManagedGitExtensions.cs | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/src/NerdBank.GitVersioning/Managed/ManagedGitExtensions.cs b/src/NerdBank.GitVersioning/Managed/ManagedGitExtensions.cs index a2f1fefc..58b8206e 100644 --- a/src/NerdBank.GitVersioning/Managed/ManagedGitExtensions.cs +++ b/src/NerdBank.GitVersioning/Managed/ManagedGitExtensions.cs @@ -165,15 +165,6 @@ bool TryCalculateHeight(GitCommit commit) var ignoreCase = repository.IgnoreCase; - /* - bool ContainsRelevantChanges(IEnumerable changes) => - excludePaths.Count == 0 - ? changes.Any() - // If there is a single change that isn't excluded, - // then this commit is relevant. - : changes.Any(change => !excludePaths.Any(exclude => exclude.Excludes(change.Path, ignoreCase))); - */ - int height = 1; if (pathFilters != null) @@ -194,26 +185,6 @@ bool ContainsRelevantChanges(IEnumerable changes) => } } - /* - // If there are no include paths, or any of the include - // paths refer to the root of the repository, then do not - // filter the diff at all. - var diffInclude = - includePaths.Count == 0 || pathFilters.Any(filter => filter.IsRoot) - ? null - : includePaths; - - // If the diff between this commit and any of its parents - // does not touch a path that we care about, don't bump the - // height. - var relevantCommit = - commit.Parents.Any() - ? commit.Parents.Any(parent => ContainsRelevantChanges(commit.GetRepository().Diff - .Compare(parent.Tree, commit.Tree, diffInclude, DiffOptions))) - : ContainsRelevantChanges(commit.GetRepository().Diff - .Compare(null, commit.Tree, diffInclude, DiffOptions)); - */ - if (!relevantCommit) { height = 0; @@ -268,7 +239,8 @@ private static bool IsRelevantCommit(GitRepository repository, GitTree tree, Git bool isRelevant = // Either there are no include filters at all (i.e. everything is included), or there's an explicit include filter - (!filters.Any(f => f.IsInclude) || filters.Any(f => f.Includes(fullPath, repository.IgnoreCase))) + (!filters.Any(f => f.IsInclude) || filters.Any(f => f.Includes(fullPath, repository.IgnoreCase)) + || (!entry.IsFile && filters.Any(f => f.IncludesChildren(fullPath, repository.IgnoreCase)))) // The path is not excluded by any filters && !filters.Any(f => f.Excludes(fullPath, repository.IgnoreCase));