Skip to content

Commit 38669fd

Browse files
committed
make including ignored files optional (still default to true) so users can opt out for perf reasons
1 parent 0b00a5b commit 38669fd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

LibGit2Sharp/RepositoryStatus.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ private static GitStatusOptions CreateStatusOptions(StatusOptions options)
7979
Version = 1,
8080
Show = (GitStatusShow)options.Show,
8181
Flags =
82-
GitStatusOptionFlags.IncludeIgnored |
8382
GitStatusOptionFlags.IncludeUntracked |
8483
GitStatusOptionFlags.RecurseUntrackedDirs,
8584
};
8685

86+
if (options.IncludeIgnored )
87+
{
88+
coreOptions.Flags |= GitStatusOptionFlags.IncludeIgnored;
89+
}
90+
8791
if (options.DetectRenamesInIndex)
8892
{
8993
coreOptions.Flags |=

LibGit2Sharp/StatusOptions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public sealed class StatusOptions
3535
public StatusOptions()
3636
{
3737
DetectRenamesInIndex = true;
38+
IncludeIgnored = true;
3839
}
3940

4041
/// <summary>
@@ -84,5 +85,14 @@ public StatusOptions()
8485
/// Unaltered meaning the file is identical in the working directory, the index and HEAD.
8586
/// </remarks>
8687
public bool IncludeUnaltered { get; set; }
88+
89+
/// <summary>
90+
/// Include ignored files when scanning for status
91+
/// </summary>
92+
/// <remarks>
93+
/// ignored meaning present in .gitingore. Defaults to true for back compat but may improve perf to not include if you have thousands of ignored files.
94+
/// </remarks>
95+
public bool IncludeIgnored { get; set; }
96+
8797
}
8898
}

0 commit comments

Comments
 (0)