如何将 jgit DiffFormatter 限制为 java 文件?
How to restrict the jgit DiffFormatter to java file?
因为 git diff -- "*.java"
可以将 git diff 限制为 java 文件?它在jgit中的等价物是什么?顺便说一句,我试过 DiffFormatter.setPathFilter(PathFilter.create("*.java"))
因为 PathFilter 可以将 TreeWalk 限制为已配置的路径。但不幸的是,它没有用。
A PathFilter 只匹配文件的全名或路径前缀,你想要的需要 PathSuffixFilter.create(".java")
而不是,那么只有以 .java
结尾的文件才会包含在 diff-结果。
见http://download.eclipse.org/jgit/site/4.7.1.201706071930-r/apidocs/index.html and http://download.eclipse.org/jgit/site/4.7.1.201706071930-r/apidocs/index.html
因为 git diff -- "*.java"
可以将 git diff 限制为 java 文件?它在jgit中的等价物是什么?顺便说一句,我试过 DiffFormatter.setPathFilter(PathFilter.create("*.java"))
因为 PathFilter 可以将 TreeWalk 限制为已配置的路径。但不幸的是,它没有用。
A PathFilter 只匹配文件的全名或路径前缀,你想要的需要 PathSuffixFilter.create(".java")
而不是,那么只有以 .java
结尾的文件才会包含在 diff-结果。
见http://download.eclipse.org/jgit/site/4.7.1.201706071930-r/apidocs/index.html and http://download.eclipse.org/jgit/site/4.7.1.201706071930-r/apidocs/index.html