Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse JGit支持.gittattributes吗?_Eclipse_Git_Jgit - Fatal编程技术网

Eclipse JGit支持.gittattributes吗?

Eclipse JGit支持.gittattributes吗?,eclipse,git,jgit,Eclipse,Git,Jgit,我试图理解如何使用JGit中的.git属性。但我找不到任何最能说明这一点的教程 是JGit不支持它吗。但git客户端有这种支持。为什么不使用JGit?JGit对.gittattributes有基本的支持。有关当前的开发状态,请参阅和相关的bug JGit测试套件可以帮助您理解.gittributes是如何在JGit中实现的。有关如何使用JGit源代码的信息,请参阅。如果您想尝试libgi2,可以访问最新的 以下是一些例子: Repository testRepo = Repository.ope

我试图理解如何使用JGit中的.git属性。但我找不到任何最能说明这一点的教程


是JGit不支持它吗。但git客户端有这种支持。为什么不使用JGit?

JGit对.gittattributes有基本的支持。有关当前的开发状态,请参阅和相关的bug


JGit测试套件可以帮助您理解.gittributes是如何在JGit中实现的。有关如何使用JGit源代码的信息,请参阅。

如果您想尝试libgi2,可以访问最新的

以下是一些例子:

Repository testRepo = Repository.open("path-to-your-repo");
// load macros from .gitattributes file
Attr.addMacro(testRepo, "binary", "-diff -crlf");
// Loop through all attributes
Map<String, String> attributes = new HashMap<>();
Attr.foreach(
        testRepo,
        EnumSet.of(CHECK_INDEX_THEN_FILE),
        ".",
        new Attr.ForeachCb() {
            @Override
            public int accept(String name, String value) {
                attributes.put(name, value);
                return 0;
            }
        });
Repository testRepo=Repository.open(“您的repo路径”);
//从.gittributes文件加载宏
Attr.addMacro(testRepo,“二进制”,“差分-crlf”);
//循环遍历所有属性
Map attributes=newhashmap();
弗雷赫酒店(
testRepo,
EnumSet.of(检查索引,然后检查文件),
".",
新属性ForeachCb(){
@凌驾
public int accept(字符串名称、字符串值){
attributes.put(名称、值);
返回0;
}
});

如果我理解正确,您可以找到关于这些API的测试用例

,JGit只是一个库,也就是说,您可以用它构建一个git客户端java@niceman:您能给我指出一些使用JGit处理.gitatriebutes的有用示例\教程吗?是的,我正在使用eclipse(使用JGit的EGit)我正在将GIT集成到其中。如果您使用的是windows,则会出现问题。除此之外,git的任何文档/教程/示例都很像文档。谢谢,你能指出一些有用的链接吗?我可以从这些链接了解JGit属性的用法?我甚至找不到一个链接来说明JGit属性的工作行为,因为有支持,.gittributes在JGit和本机Git中的行为相同。因此,您可以使用有关.gittributes的所有常规信息。如果您发现某些东西不能像本机Git所描述的那样工作,您可能需要提交一个“是”,我理解这一点。我想知道是否有任何自我解释的教程,例如有说明各种JGIT命令的自我解释代码,是否有任何教程\示例,我可以从中学习如何使用JGIT属性?要了解“各种”JGIT命令,您可能需要阅读如下入门教程:是,我已经读过了。我在问是否有类似的教程(如cookbook)说明了
org.eclipse.jgit.attributes