sourcegit/src/Commands/QueryCommitChildren.cs
leo 1c0d8a2697
fix: git rev-list do not support --decorate-refs-exclude (#746)
Do not use histories filters to query commit children
2024-11-27 17:06:44 +08:00

30 lines
768 B
C#

using System.Collections.Generic;
namespace SourceGit.Commands
{
public class QueryCommitChildren : Command
{
public QueryCommitChildren(string repo, string commit, int max)
{
WorkingDirectory = repo;
Context = repo;
_commit = commit;
Args = $"rev-list -{max} --parents --branches --remotes ^{commit}";
}
public IEnumerable<string> Result()
{
Exec();
return _lines;
}
protected override void OnReadline(string line)
{
if (line.Contains(_commit))
_lines.Add(line.Substring(0, 40));
}
private string _commit;
private List<string> _lines = new List<string>();
}
}