- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于我当前的项目,我需要找出哪些用户最后修改了给定文件中的一系列行。为此,我一直在使用 JGit,并在 Kotlin 中编写代码。到目前为止一切顺利,我意识到当我尝试使用 JGit blame 命令时,它会一直返回 null,即使它没有抛出异常。这是我目前拥有的原型(prototype)函数,它将在感兴趣的范围内逐行打印最后一个提交者的电子邮件(别管 LocationInfo 类,它是一个自定义数据类,其中包含我要检查的文件路径和范围):
fun getContributors(location: LocationInfo, git: Git, commitID: ObjectId) {
val blamer = BlameCommand(git.repository)
blamer.setFilePath(location.path.substringAfter(git.repository.directory.parent))
blamer.setStartCommit(commitID)
val blameResult = blamer.call() // blameResult is always null!
println("Blaming: ${location.path.substringAfter(git.repository.directory.parent + "/")}")
for (line in location.range.start..location.range.end) {
println(blameResult.getSourceCommitter(line).emailAddress)
}
}
当我导航到终端中的存储库时, checkout 旧提交(与我的代码中的提交 ID 相同)并在相同的文件(与我的代码中的路径相同)上运行 git blame 命令,它确实做了它应该做的事情并为我提供与我需要的信息。这个问题的原因可能是什么?我很确定我也为函数提供了合法的参数。我对 BlameCommand 的处理是否不正确?
最佳答案
您可以将您对该命令的处理与 org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java
进行比较喜欢 here
BlameCommand command = new BlameCommand(db);
command.setFilePath("file.txt");
BlameResult lines = command.call();
因此,请确保
location.path.substringAfter(git.repository.directory.parent)
实际上引用的是文件,而不是文件夹。
关于git - JGit BlameCommand 不断返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63769467/
如果这不是一个错误,那就是另一个错误。如果不是那样的话,那就是别的东西了。我觉得我的项目已经改变了很多,现在只是试图解决代码签名问题,结果一切都搞砸了。我严格按照说明进行操作,但出现错误,例如当前的“
我不确定是否有一些我不知道的内置变量或规则,或者 make 是否有问题,或者我只是疯了。 对于我的一个项目,我有一个如下的 makefile: CC=g++ CFLAGS=-O3 `libpng-co
我有大约 10 个 div,它们必须不断翻转,每个 div 延迟 3 秒 这个 codrops 链接的最后一个效果是我正在寻找的,但无需单击 div http://tympanus.net/Devel
我如何使用 jQuery 持续运行 PHP 脚本并每秒获取响应,以及将鼠标上的少量数据发送到同一脚本? 我真的必须添加一些随机扩展才能让这么简单的计时器工作吗? 最佳答案 To iterate is
JBoss 4.x EJB 3.0 我见过如下代码(大大简化): @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPO
使用 PHPStorm,我试图忽略每次尝试进行 git 提交时 pop 的 workspace.xml。 我的 .gitignore 看起来像: /.idea/ .idea/workspace.xml
我是一名优秀的程序员,十分优秀!