當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。