not sure if I am on the right track here.
I have been trying to build a folder structure tree in Winforms by recursively building a DictionaryInfo object and with some hacking ignoring files and folders I ignored and not tracked by git.
But I found that there is a git command that basically does all this for me. git ls-tree -r -t --name-only head
Can I achieve this with libgit2?
Thanks!
Edit (Add workaround)
So right now I am doing this
var info = new ProcessStartInfo("git", "ls-tree -r -t --name-only head")
{
CreateNoWindow = true,
RedirectStandardOutput = true,
UseShellExecute = false,
WorkingDirectory = "<repo workdir>",
};
var list = new List<TreeNode>();
using (var sr = Process.Start(info)?.StandardOutput)
{
string? line;
while ((line = sr?.ReadLine()) != null)
{
if (line != null)
list.Add(new TreeNode(line));
}
}
treeView.Nodes.Clear();
var rootDirectoryInfo = new DirectoryInfo(path);
treeView.Nodes.AddRange(list.ToArray());