-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathQueryCommitChildren.cs
More file actions
36 lines (32 loc) · 1.03 KB
/
QueryCommitChildren.cs
File metadata and controls
36 lines (32 loc) · 1.03 KB
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
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SourceGit.Commands
{
public class QueryCommitChildren : Command
{
public QueryCommitChildren(string repo, string commit, int max)
{
WorkingDirectory = repo;
Context = repo;
_commit = commit;
Args = $"rev-list -{max} --parents --branches --remotes --ancestry-path ^{commit}";
}
public async Task<List<string>> GetResultAsync()
{
var rs = await ReadToEndAsync().ConfigureAwait(false);
var outs = new List<string>();
if (rs.IsSuccess)
{
var lines = rs.StdOut.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
foreach (var line in lines)
{
if (line.Contains(_commit))
outs.Add(line.Substring(0, _commit.Length));
}
}
return outs;
}
private string _commit;
}
}