在命令行中,我可以输入
git log myfile它会非常迅速地给出这个文件被更新的所有提交。
使用libgit2sharp,我找到的唯一方法是扫描我的存储库中的每个提交,并查询提交中的文件的提交。这需要很长时间(每个文件10秒左右)。
有没有办法获得与我使用libgit2sharp从"git log“中获得的相同信息?
发布于 2018-11-28 14:08:39
过滤提交看起来确实是the way tests are implemented
// $ git log --follow --format=oneline untouched.txt
// c10c1d5f74b76f20386d18674bf63fbee6995061 Initial commit
fileHistoryEntries = repo.Commits.QueryBy("untouched.txt").ToList();
Assert.Single(fileHistoryEntries);
Assert.Equal("c10c1d5f74b76f20386d18674bf63fbee6995061", fileHistoryEntries[0].Commit.Sha);这是introduced in 2015 by commit c462df3
甚至是一部regular git log (not filtered per file) can be slow on large repo。
https://stackoverflow.com/questions/53506070
复制相似问题