forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountLocalChanges.cs
More file actions
28 lines (25 loc) · 801 Bytes
/
Copy pathCountLocalChanges.cs
File metadata and controls
28 lines (25 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Threading.Tasks;
namespace SourceGit.Commands
{
public class CountLocalChanges : Command
{
public CountLocalChanges(string repo, bool includeUntracked)
{
var option = includeUntracked ? "-uall" : "-uno";
WorkingDirectory = repo;
Context = repo;
Args = $"--no-optional-locks status {option} --ignore-submodules=all --porcelain";
}
public async Task<int> GetResultAsync()
{
var rs = await ReadToEndAsync().ConfigureAwait(false);
if (rs.IsSuccess)
{
var lines = rs.StdOut.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
return lines.Length;
}
return 0;
}
}
}