enhance: get count of changed file (without untracked) directly (#316)

This commit is contained in:
leo 2024-08-07 15:52:58 +08:00
parent 8c16ded6bd
commit 3bcf4e128e
No known key found for this signature in database
5 changed files with 34 additions and 8 deletions

View file

@ -0,0 +1,26 @@
using System;
namespace SourceGit.Commands
{
public class CountLocalChangesWithoutUntracked : Command
{
public CountLocalChangesWithoutUntracked(string repo)
{
WorkingDirectory = repo;
Context = repo;
Args = "status -uno --ignore-submodules=dirty --porcelain";
}
public int Result()
{
var rs = ReadToEnd();
if (rs.IsSuccess)
{
var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries);
return lines.Length;
}
return 0;
}
}
}