gpt4 book ai didi

c# - 在 C# 中以编程方式执行 "Git blame -w"

转载 作者:太空狗 更新时间:2023-10-29 13:00:22 25 4
gpt4 key购买 nike

我需要使用 C# 以编程方式获取 Git 历史记录中特定行的最后作者。我尝试使用 libgit2sharp :

var repo = new LibGit2Sharp.Repository(gitRepositoryPath);
string relativePath = MakeRelativeSimple(filename);
var blameHunks = repo.Blame(relativePath);
// next : find the hunk which overlap the desired line number

但这相当于命令

git blame <file>

事实上我需要

git blame -w <file> (比较时忽略空格)

Libgit2sharp 不要设置 -w switch 并且不提供任何参数/选项来设置它。我有哪些选择?您知道与 -w 兼容的任何其他库吗? blame 的开关命令?

最佳答案

当我遇到类似的 git lib 没有削减它的高级场景时,我只是使用启动进程到真正的 git 命令行。它并不性感,但非常有效。

关于c# - 在 C# 中以编程方式执行 "Git blame -w",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36310172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com