当前位置: 首页>>代码示例>>Java>>正文


Java Constants.DOT_GIT_IGNORE属性代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.Constants.DOT_GIT_IGNORE属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.DOT_GIT_IGNORE属性的具体用法?Java Constants.DOT_GIT_IGNORE怎么用?Java Constants.DOT_GIT_IGNORE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jgit.lib.Constants的用法示例。


在下文中一共展示了Constants.DOT_GIT_IGNORE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUnignoreFileInRoot

public void testUnignoreFileInRoot () throws Exception {
    File f = new File(workDir, "file");
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertFalse(gitIgnore.exists());
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "/file");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "f\nf2\n/file\nf3\nf4");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("f\nf2\nf3\nf4", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:UnignoreTest.java

示例2: testIgnoreFileWithBracket

public void testIgnoreFileWithBracket () throws Exception {
    File f = new File(workDir, "fi[le");
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/fi[[]le", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "/fi[[]le");
    GitStatus st = getClient(workDir).getStatus(new File[] { f }, NULL_PROGRESS_MONITOR).get(f);
    assertEquals(Status.STATUS_IGNORED, st.getStatusIndexWC());
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/fi[[]le", read(gitIgnore));
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "/fi\\[le");
    // jgit seems to incorrectly handle escaped wildcards
    st = getClient(workDir).getStatus(new File[] { f }, NULL_PROGRESS_MONITOR).get(f);
    assertEquals(Status.STATUS_IGNORED, st.getStatusIndexWC());
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/fi\\[le", read(gitIgnore));
    assertEquals(0, ignores.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:IgnoreTest.java

示例3: testUnignoreFileInSubfolder

public void testUnignoreFileInSubfolder () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "file");
    f.getParentFile().mkdirs();
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertFalse(gitIgnore.exists());
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "/sf1/sf2/file");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "/sf1/sf2/file/");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/sf1/sf2/file/", read(gitIgnore));
    assertEquals(0, ignores.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:UnignoreTest.java

示例4: testIgnoreRemoveNegation_NestedIgnoreFile

public void testIgnoreRemoveNegation_NestedIgnoreFile () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "file");
    f.getParentFile().mkdirs();
    f.createNewFile();
    File gitIgnore = new File(f.getParentFile().getParentFile(), Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#ignoreFile\n/sf2/file\n!/sf2/file");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf2/file", read(gitIgnore));
    assertFalse(new File(workDir, Constants.DOT_GIT_IGNORE).exists());
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "sf2/file\n!sf2/file");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("sf2/file", read(gitIgnore));
    assertFalse(new File(workDir, Constants.DOT_GIT_IGNORE).exists());
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "#ignoreFile\nsf2/f*\n!/sf2/file");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\nsf2/f*", read(gitIgnore));
    assertFalse(new File(workDir, Constants.DOT_GIT_IGNORE).exists());
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:IgnoreTest.java

示例5: testIgnoreFolderIgnoredEqualPath

public void testIgnoreFolderIgnoredEqualPath () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder/");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder/", read(gitIgnore));
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder", read(gitIgnore));
    assertEquals(0, ignores.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:IgnoreTest.java

示例6: testIgnoreIgnoredPartialEqualPath

public void testIgnoreIgnoredPartialEqualPath () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "file");
    f.getParentFile().mkdirs();
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#ignoreFile\nfile");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\nfile", read(gitIgnore));
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "sf1/sf2/file");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("sf1/sf2/file", read(gitIgnore));
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "sf1/*/file");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("sf1/*/file", read(gitIgnore));
    assertEquals(0, ignores.length);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:IgnoreTest.java

示例7: testIgnoreFolderRemoveNegation

public void testIgnoreFolderRemoveNegation () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder/\n!/sf1/sf2/folder/");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder\n!/sf1/sf2/folder/");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:IgnoreTest.java

示例8: testUnignoreFileWithStarChar

public void testUnignoreFileWithStarChar () throws Exception {
    if (isWindows()) {
        // win do not allow '*' in filename
        return;
    }
    File f = new File(workDir, "fi*le");
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/fi[*]le", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:UnignoreTest.java

示例9: testIgnoreFolderNoNegationRemoval

public void testIgnoreFolderNoNegationRemoval () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder\n!folder");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder\n!folder\n/sf1/sf2/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "#ignoreFile\n/sf1/sf2/folder\n!/sf1/sf2/folder");
    ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#ignoreFile\n/sf1/sf2/folder\n!/sf1/sf2/folder\n/sf1/sf2/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:IgnoreTest.java

示例10: testUnignoreFolderInSubfolder

public void testUnignoreFolderInSubfolder () throws Exception {
    File f = new File(new File(new File(workDir, "sf1"), "sf2"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertFalse(gitIgnore.exists());
    assertEquals(0, ignores.length);
    
    write(gitIgnore, "sf1/sf2/folder/");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
    
    write(gitIgnore, "/sf1/sf2/folder");
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/sf1/sf2/folder\n!/sf1/sf2/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:UnignoreTest.java

示例11: testIgnoreFileInRoot

public void testIgnoreFileInRoot () throws Exception {
    File f = new File(workDir, "file");
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("/file", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:IgnoreTest.java

示例12: testIgnoreFolderInSubfolder

public void testIgnoreFolderInSubfolder () throws Exception {
    File f = new File(new File(new File(workDir, "subFolder"), "anotherSubfolder"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("/subFolder/anotherSubfolder/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:IgnoreTest.java

示例13: testUnignoreFileWithQuestionMark

public void testUnignoreFileWithQuestionMark () throws Exception {
    if (isWindows()) {
        // win do not allow '?' in filename
        return;
    }
    File f = new File(workDir, "fi?le");
    f.createNewFile();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("/fi[?]le", read(gitIgnore));
    
    ignores = getClient(workDir).unignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertEquals("", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:UnignoreTest.java

示例14: testIgnoreFolderInRootAppend

public void testIgnoreFolderInRootAppend () throws Exception {
    File f = new File(workDir, "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#this is ignore file\n\n\nfff\nfff2");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#this is ignore file\n\n\nfff\nfff2\n/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:IgnoreTest.java

示例15: testIgnoreFolderInSubfolderAppend

public void testIgnoreFolderInSubfolderAppend () throws Exception {
    File f = new File(new File(new File(workDir, "subFolder"), "anotherSubfolder"), "folder");
    f.mkdirs();
    File gitIgnore = new File(workDir, Constants.DOT_GIT_IGNORE);
    write(gitIgnore, "#this is ignore file\nfff\nfff2");
    File[] ignores = getClient(workDir).ignore(new File[] { f }, NULL_PROGRESS_MONITOR);
    assertTrue(gitIgnore.exists());
    assertEquals("#this is ignore file\nfff\nfff2\n/subFolder/anotherSubfolder/folder/", read(gitIgnore));
    assertEquals(Arrays.asList(gitIgnore), Arrays.asList(ignores));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:IgnoreTest.java


注:本文中的org.eclipse.jgit.lib.Constants.DOT_GIT_IGNORE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。