-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathQueryCurrentBranchCommitHashes.cs
More file actions
39 lines (33 loc) · 1.04 KB
/
Copy pathQueryCurrentBranchCommitHashes.cs
File metadata and controls
39 lines (33 loc) · 1.04 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
37
38
39
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
namespace SourceGit.Commands
{
public class QueryCurrentBranchCommitHashes : Command
{
public QueryCurrentBranchCommitHashes(string repo, ulong sinceTimestamp)
{
WorkingDirectory = repo;
Context = repo;
Args = $"log --since=@{sinceTimestamp} --format=%H";
}
public async Task<HashSet<string>> GetResultAsync()
{
var outs = new HashSet<string>();
try
{
using var proc = new Process();
proc.StartInfo = CreateGitStartInfo(true);
proc.Start();
while (await proc.StandardOutput.ReadLineAsync().ConfigureAwait(false) is { Length: > 8 } line)
outs.Add(line);
await proc.WaitForExitAsync().ConfigureAwait(false);
}
catch
{
// Ignore exceptions;
}
return outs;
}
}
}