diff --git a/src/Commands/QuerySingleCommit.cs b/src/Commands/QuerySingleCommit.cs index 35289ec58..3f2deef38 100644 --- a/src/Commands/QuerySingleCommit.cs +++ b/src/Commands/QuerySingleCommit.cs @@ -6,6 +6,9 @@ public class QuerySingleCommit : Command { public QuerySingleCommit(string repo, string sha) { + _repo = repo; + _sha = sha; + WorkingDirectory = repo; Context = repo; Args = $"show --no-show-signature --decorate=full --format=%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s -s {sha}"; @@ -13,6 +16,10 @@ public QuerySingleCommit(string repo, string sha) public Models.Commit Result() { + var isCommitSHA = new IsCommitSHA(_repo, _sha).Result(); + if (!isCommitSHA) + return null; + var rs = ReadToEnd(); if (rs.IsSuccess && !string.IsNullOrEmpty(rs.StdOut)) { @@ -37,5 +44,8 @@ public Models.Commit Result() return null; } + + private readonly string _repo; + private readonly string _sha; } }