mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-25 03:12:21 +08:00
- Remove all synchronous method in commands - `Command.ReadToEndAsync` now is protected method - Rename `ResultAsync` to `GetResultAsync` - Call `ConfigureAwait(false)` when there's no context Signed-off-by: leo <longshuang@msn.cn>
26 lines
704 B
C#
26 lines
704 B
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SourceGit.Commands
|
|
{
|
|
public class QueryRevisionFileNames : Command
|
|
{
|
|
public QueryRevisionFileNames(string repo, string revision)
|
|
{
|
|
WorkingDirectory = repo;
|
|
Context = repo;
|
|
Args = $"ls-tree -r -z --name-only {revision}";
|
|
}
|
|
|
|
public async Task<List<string>> GetResultAsync()
|
|
{
|
|
var rs = await ReadToEndAsync().ConfigureAwait(false);
|
|
if (!rs.IsSuccess)
|
|
return [];
|
|
|
|
var lines = rs.StdOut.Split('\0', System.StringSplitOptions.RemoveEmptyEntries);
|
|
return [.. lines];
|
|
}
|
|
}
|
|
}
|