mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 19:02:39 +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>
24 lines
596 B
C#
24 lines
596 B
C#
using System.Threading.Tasks;
|
|
|
|
namespace SourceGit.Commands
|
|
{
|
|
public class QueryRevisionByRefName : Command
|
|
{
|
|
public QueryRevisionByRefName(string repo, string refname)
|
|
{
|
|
WorkingDirectory = repo;
|
|
Context = repo;
|
|
Args = $"rev-parse {refname}";
|
|
}
|
|
|
|
public async Task<string> GetResultAsync()
|
|
{
|
|
var rs = await ReadToEndAsync().ConfigureAwait(false);
|
|
if (rs.IsSuccess && !string.IsNullOrEmpty(rs.StdOut))
|
|
return rs.StdOut.Trim();
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|