本文整理匯總了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));
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}