Skip to content

Commit e1b8f5a

Browse files
committed
Add IncludeUntracked and RecurseUntrackedDirs to StatusOptions
These map directly to options of the same name on libgit2, and are useful when you don't want to bother retrieving them.
1 parent 38f046d commit e1b8f5a

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

LibGit2Sharp/RepositoryStatus.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,18 @@ private static GitStatusOptions CreateStatusOptions(StatusOptions options)
7878
{
7979
Version = 1,
8080
Show = (GitStatusShow)options.Show,
81-
Flags =
82-
GitStatusOptionFlags.IncludeUntracked |
83-
GitStatusOptionFlags.RecurseUntrackedDirs,
8481
};
8582

8683
if (options.IncludeIgnored)
8784
{
8885
coreOptions.Flags |= GitStatusOptionFlags.IncludeIgnored;
8986
}
9087

88+
if (options.IncludeUntracked)
89+
{
90+
coreOptions.Flags |= GitStatusOptionFlags.IncludeUntracked;
91+
}
92+
9193
if (options.DetectRenamesInIndex)
9294
{
9395
coreOptions.Flags |=
@@ -114,6 +116,12 @@ private static GitStatusOptions CreateStatusOptions(StatusOptions options)
114116
GitStatusOptionFlags.RecurseIgnoredDirs;
115117
}
116118

119+
if (options.RecurseUntrackedDirs)
120+
{
121+
coreOptions.Flags |=
122+
GitStatusOptionFlags.RecurseUntrackedDirs;
123+
}
124+
117125
if (options.PathSpec != null)
118126
{
119127
coreOptions.PathSpec = GitStrArrayManaged.BuildFrom(options.PathSpec);

LibGit2Sharp/StatusOptions.cs

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public StatusOptions()
3636
{
3737
DetectRenamesInIndex = true;
3838
IncludeIgnored = true;
39+
IncludeUntracked = true;
40+
RecurseUntrackedDirs = true;
3941
}
4042

4143
/// <summary>
@@ -63,6 +65,11 @@ public StatusOptions()
6365
/// </summary>
6466
public bool RecurseIgnoredDirs { get; set; }
6567

68+
/// <summary>
69+
/// Recurse into untracked directories
70+
/// </summary>
71+
public bool RecurseUntrackedDirs { get; set; }
72+
6673
/// <summary>
6774
/// Limit the scope of paths to consider to the provided pathspecs
6875
/// </summary>
@@ -94,5 +101,9 @@ public StatusOptions()
94101
/// </remarks>
95102
public bool IncludeIgnored { get; set; }
96103

104+
/// <summary>
105+
/// Include untracked files when scanning for status
106+
/// </summary>
107+
public bool IncludeUntracked { get; set; }
97108
}
98109
}

0 commit comments

Comments
 (0)