/
vasiukoff
/
sg
Обзор
Документация
Войти
/
vasiukoff
/
sg
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Commands/QueryCurrentBranchCommitHashes.cs
41 строка
1 KB
leo
enhance: do not return to `UIThread` while calculating git outputs
25 ноя 2025, 10:31
25 ноя 2025, 10:31
c187480
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; namespace SourceGit.Commands { public class QueryCurrentBranchCommitHashes : Command { public QueryCurrentBranchCommitHashes(string repo, ulong sinceTimestamp) { var since = DateTime.UnixEpoch.AddSeconds(sinceTimestamp).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); WorkingDirectory = repo; Context = repo; Args = $"log --since={since.Quoted()} --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; } } }