Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
qmfrederik authored and AArnott committed May 29, 2021
1 parent e987a7e commit 4f46d95
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/NerdBank.GitVersioning/Managed/ManagedGitExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ bool TryCalculateHeight(GitCommit commit)

var ignoreCase = repository.IgnoreCase;

/*
bool ContainsRelevantChanges(IEnumerable<TreeEntryChanges> 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)
Expand All @@ -194,26 +185,6 @@ bool ContainsRelevantChanges(IEnumerable<TreeEntryChanges> 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<TreeChanges>(parent.Tree, commit.Tree, diffInclude, DiffOptions)))
: ContainsRelevantChanges(commit.GetRepository().Diff
.Compare<TreeChanges>(null, commit.Tree, diffInclude, DiffOptions));
*/

if (!relevantCommit)
{
height = 0;
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit 4f46d95

Please sign in to comment.