10000 Merge remote-tracking branch 'origin/pr/1393' · libgit2/libgit2sharp@8deaf1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 8deaf1e

Browse files
committed
Merge remote-tracking branch 'origin/pr/1393'
2 parents 9cb1cb1 + e1b8f5a commit 8deaf1e

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
### Changes
1818

19+
- Status now does not show untracked files by default. To retrieve
20+
untracked files, included the `StatusOptions.IncludeUntracked` and/or
21+
the `StatusOptions.RecurseUntrackedDirs` options.
22+
1923
### Fixes
2024

2125
- The exception thrown when the native library cannot be loaded is now

LibGit2Sharp/RepositoryStatus.cs

Lines changed: 11 additions & 3 deletions
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

Lines changed: 11 additions & 0 deletions
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< 48C8 code class="diff-text syntax-highlighted-line addition">+
/// </summary>
107+
public bool IncludeUntracked { get; set; }
97108
}
98109
}

0 commit comments

Comments
 (0)
0