Merge branch 'stable-4.2'

* stable-4.2:
  BundleWriterTest: Open RevWalk in try-with-resource
  DiffFormatterTest: Remove accidentally added trailing whitespace
  CherryPickCommandTest: Create Git instances in try-with-resource
  DiffFormatterTest: Create auto-closeable instances in try-with-resource
  ConfigTest: Create Git instance in try-with-resource
  CommitAndLogCommandTest: Use assumeFalse to skip test on Windows
  CommitAndLogCommandTest: Create Git instances in try-with-resource
  AddCommandTest: Create Git instances in try-with-resource
  ArchiveCommandTest: Create Git instances in try-with-resource
  TagCommandTest: Instantiate Git and RevWalk objects in try-with-resource
  BlameCommandTest: Instantiate Git objects in try-with-resource
  SideBandOutputStreamTest: Use try-with-resource
  FileTreeIteratorJava7Test: Create Git instances in try-with-resource

Change-Id: Ib572e98e6117b70442aee9cd7e7b8c3cf65562a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2016-01-21 14:04:39 +01:00
commit 34b4a564ea
11 changed files with 1341 additions and 1269 deletions

View File

@ -60,7 +60,9 @@ public class ConfigTest extends CLIRepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
new Git(db).commit().setMessage("initial commit").call();
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
}
}
@Test

View File

@ -78,9 +78,7 @@ public class AddCommandTest extends RepositoryTestCase {
@Test
public void testAddNothing() throws GitAPIException {
Git git = new Git(db);
try {
try (Git git = new Git(db)) {
git.add().call();
fail("Expected IllegalArgumentException");
} catch (NoFilepatternException e) {
@ -91,11 +89,10 @@ public void testAddNothing() throws GitAPIException {
@Test
public void testAddNonExistingSingleFile() throws GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
DirCache dc = git.add().addFilepattern("a.txt").call();
assertEquals(0, dc.getEntryCount());
}
}
@Test
@ -106,14 +103,14 @@ public void testAddExistingSingleFile() throws IOException, GitAPIException {
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("a.txt").call();
assertEquals(
"[a.txt, mode:100644, content:content]",
indexState(CONTENT));
}
}
@Test
public void testCleanFilter() throws IOException,
@ -125,7 +122,7 @@ public void testCleanFilter() throws IOException,
writeTrashFile("src/a.txt", "foo\n");
File script = writeTempFile("sed s/o/e/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + slashify(script.getPath()));
@ -138,6 +135,7 @@ public void testCleanFilter() throws IOException,
"[src/a.tmp, mode:100644, content:foo][src/a.txt, mode:100644, content:fee\n]",
indexState(CONTENT));
}
}
@Test
public void testCleanFilterEnvironment()
@ -146,7 +144,7 @@ public void testCleanFilterEnvironment()
writeTrashFile("src/a.txt", "foo");
File script = writeTempFile("echo $GIT_DIR; echo 1 >xyz");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + slashify(script.getPath()));
@ -158,6 +156,7 @@ public void testCleanFilterEnvironment()
+ "\n]", indexState(CONTENT));
assertTrue(new File(db.getWorkTree(), "xyz").exists());
}
}
@Test
public void testMultipleCleanFilter() throws IOException, GitAPIException {
@ -170,7 +169,7 @@ public void testMultipleCleanFilter() throws IOException, GitAPIException {
File script = writeTempFile("sed s/o/e/g");
File script2 = writeTempFile("sed s/f/x/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + slashify(script.getPath()));
@ -187,6 +186,7 @@ public void testMultipleCleanFilter() throws IOException, GitAPIException {
// TODO: multiple clean filters for one file???
}
}
/**
* The path of an added file name contains ';' and afterwards malicious
@ -203,7 +203,7 @@ public void testCommandInjection() throws IOException, GitAPIException {
writeTrashFile("; echo virus", "foo\n");
File script = writeTempFile("sed s/o/e/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + slashify(script.getPath()) + " %f");
@ -215,13 +215,14 @@ public void testCommandInjection() throws IOException, GitAPIException {
assertEquals("[; echo virus, mode:100644, content:fee\n]",
indexState(CONTENT));
}
}
@Test
public void testBadCleanFilter() throws IOException, GitAPIException {
writeTrashFile("a.txt", "foo");
File script = writeTempFile("sedfoo s/o/e/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + script.getPath());
@ -235,13 +236,14 @@ public void testBadCleanFilter() throws IOException, GitAPIException {
assertEquals(127, e.getReturnCode());
}
}
}
@Test
public void testBadCleanFilter2() throws IOException, GitAPIException {
writeTrashFile("a.txt", "foo");
File script = writeTempFile("sed s/o/e/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"shfoo " + script.getPath());
@ -255,6 +257,7 @@ public void testBadCleanFilter2() throws IOException, GitAPIException {
assertEquals(127, e.getReturnCode());
}
}
}
@Test
public void testCleanFilterReturning12() throws IOException,
@ -262,7 +265,7 @@ public void testCleanFilterReturning12() throws IOException,
writeTrashFile("a.txt", "foo");
File script = writeTempFile("exit 12");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "clean",
"sh " + slashify(script.getPath()));
@ -276,13 +279,14 @@ public void testCleanFilterReturning12() throws IOException,
assertEquals(12, e.getReturnCode());
}
}
}
@Test
public void testNotApplicableFilter() throws IOException, GitAPIException {
writeTrashFile("a.txt", "foo");
File script = writeTempFile("sed s/o/e/g");
Git git = new Git(db);
try (Git git = new Git(db)) {
StoredConfig config = git.getRepository().getConfig();
config.setString("filter", "tstFilter", "something",
"sh " + script.getPath());
@ -291,7 +295,9 @@ public void testNotApplicableFilter() throws IOException, GitAPIException {
git.add().addFilepattern("a.txt").call();
assertEquals("[a.txt, mode:100644, content:foo]", indexState(CONTENT));
assertEquals("[a.txt, mode:100644, content:foo]",
indexState(CONTENT));
}
}
private File writeTempFile(String body) throws IOException {
@ -309,7 +315,7 @@ public void testAddExistingSingleSmallFileWithNewLine() throws IOException,
writer.print("row1\r\nrow2");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
db.getConfig().setString("core", null, "autocrlf", "false");
git.add().addFilepattern("a.txt").call();
assertEquals("[a.txt, mode:100644, content:row1\r\nrow2]",
@ -323,6 +329,7 @@ public void testAddExistingSingleSmallFileWithNewLine() throws IOException,
assertEquals("[a.txt, mode:100644, content:row1\nrow2]",
indexState(CONTENT));
}
}
@Test
public void testAddExistingSingleMediumSizeFileWithNewLine()
@ -338,7 +345,7 @@ public void testAddExistingSingleMediumSizeFileWithNewLine()
writer.print(crData);
writer.close();
String lfData = data.toString().replaceAll("\r", "");
Git git = new Git(db);
try (Git git = new Git(db)) {
db.getConfig().setString("core", null, "autocrlf", "false");
git.add().addFilepattern("a.txt").call();
assertEquals("[a.txt, mode:100644, content:" + data + "]",
@ -352,6 +359,7 @@ public void testAddExistingSingleMediumSizeFileWithNewLine()
assertEquals("[a.txt, mode:100644, content:" + lfData + "]",
indexState(CONTENT));
}
}
@Test
public void testAddExistingSingleBinaryFile() throws IOException,
@ -362,7 +370,7 @@ public void testAddExistingSingleBinaryFile() throws IOException,
writer.print("row1\r\nrow2\u0000");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
db.getConfig().setString("core", null, "autocrlf", "false");
git.add().addFilepattern("a.txt").call();
assertEquals("[a.txt, mode:100644, content:row1\r\nrow2\u0000]",
@ -376,6 +384,7 @@ public void testAddExistingSingleBinaryFile() throws IOException,
assertEquals("[a.txt, mode:100644, content:row1\r\nrow2\u0000]",
indexState(CONTENT));
}
}
@Test
public void testAddExistingSingleFileInSubDir() throws IOException,
@ -387,14 +396,14 @@ public void testAddExistingSingleFileInSubDir() throws IOException,
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("sub/a.txt").call();
assertEquals(
"[sub/a.txt, mode:100644, content:content]",
indexState(CONTENT));
}
}
@Test
public void testAddExistingSingleFileTwice() throws IOException,
@ -405,7 +414,7 @@ public void testAddExistingSingleFileTwice() throws IOException,
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
DirCache dc = git.add().addFilepattern("a.txt").call();
dc.getEntry(0).getObjectId();
@ -420,6 +429,7 @@ public void testAddExistingSingleFileTwice() throws IOException,
"[a.txt, mode:100644, content:other content]",
indexState(CONTENT));
}
}
@Test
public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
@ -429,7 +439,7 @@ public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
DirCache dc = git.add().addFilepattern("a.txt").call();
dc.getEntry(0).getObjectId();
@ -446,6 +456,7 @@ public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
"[a.txt, mode:100644, content:other content]",
indexState(CONTENT));
}
}
@Test
public void testAddRemovedFile() throws Exception {
@ -455,7 +466,7 @@ public void testAddRemovedFile() throws Exception {
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
DirCache dc = git.add().addFilepattern("a.txt").call();
dc.getEntry(0).getObjectId();
@ -468,6 +479,7 @@ public void testAddRemovedFile() throws Exception {
"[a.txt, mode:100644, content:content]",
indexState(CONTENT));
}
}
@Test
public void testAddRemovedCommittedFile() throws Exception {
@ -477,7 +489,7 @@ public void testAddRemovedCommittedFile() throws Exception {
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
DirCache dc = git.add().addFilepattern("a.txt").call();
git.commit().setMessage("commit a.txt").call();
@ -492,6 +504,7 @@ public void testAddRemovedCommittedFile() throws Exception {
"[a.txt, mode:100644, content:content]",
indexState(CONTENT));
}
}
@Test
public void testAddWithConflicts() throws Exception {
@ -538,7 +551,7 @@ public void testAddWithConflicts() throws Exception {
// now the test begins
Git git = new Git(db);
try (Git git = new Git(db)) {
dc = git.add().addFilepattern("a.txt").call();
assertEquals(
@ -546,6 +559,7 @@ public void testAddWithConflicts() throws Exception {
"[b.txt, mode:100644, content:content b]",
indexState(CONTENT));
}
}
@Test
public void testAddTwoFiles() throws Exception {
@ -561,13 +575,14 @@ public void testAddTwoFiles() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("a.txt").addFilepattern("b.txt").call();
assertEquals(
"[a.txt, mode:100644, content:content]" +
"[b.txt, mode:100644, content:content b]",
indexState(CONTENT));
}
}
@Test
public void testAddFolder() throws Exception {
@ -584,13 +599,14 @@ public void testAddFolder() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("sub").call();
assertEquals(
"[sub/a.txt, mode:100644, content:content]" +
"[sub/b.txt, mode:100644, content:content b]",
indexState(CONTENT));
}
}
@Test
public void testAddIgnoredFile() throws Exception {
@ -613,13 +629,14 @@ public void testAddIgnoredFile() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("sub").call();
assertEquals(
"[sub/a.txt, mode:100644, content:content]",
indexState(CONTENT));
}
}
@Test
public void testAddWholeRepo() throws Exception {
@ -636,13 +653,14 @@ public void testAddWholeRepo() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern(".").call();
assertEquals(
"[sub/a.txt, mode:100644, content:content]" +
"[sub/b.txt, mode:100644, content:content b]",
indexState(CONTENT));
}
}
// the same three cases as in testAddWithParameterUpdate
// file a exists in workdir and in index -> added
@ -663,7 +681,7 @@ public void testAddWithoutParameterUpdate() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("sub").call();
assertEquals(
@ -698,6 +716,7 @@ public void testAddWithoutParameterUpdate() throws Exception {
"[sub/c.txt, mode:100644, content:content c]",
indexState(CONTENT));
}
}
// file a exists in workdir and in index -> added
// file b exists not in workdir but in index -> deleted
@ -717,7 +736,7 @@ public void testAddWithParameterUpdate() throws Exception {
writer.print("content b");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("sub").call();
assertEquals(
@ -750,10 +769,11 @@ public void testAddWithParameterUpdate() throws Exception {
"[sub/a.txt, mode:100644, content:modified content]",
indexState(CONTENT));
}
}
@Test
public void testAssumeUnchanged() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String path = "a.txt";
writeTrashFile(path, "content");
git.add().addFilepattern(path).call();
@ -782,6 +802,7 @@ public void testAssumeUnchanged() throws Exception {
indexState(CONTENT
| ASSUME_UNCHANGED));
}
}
@Test
public void testReplaceFileWithDirectory()

View File

@ -85,7 +85,7 @@ public void tearDown() {
@Test
public void archiveHeadAllFiles() throws IOException, GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("file_1.txt", "content_1_1");
git.add().addFilepattern("file_1.txt").call();
git.commit().setMessage("create file").call();
@ -103,10 +103,11 @@ public void archiveHeadAllFiles() throws IOException, GitAPIException {
assertEquals(UNEXPECTED_FILE_CONTENTS, "content_1_2", format.getByPath("file_1.txt"));
assertEquals(UNEXPECTED_FILE_CONTENTS, "content_2_2", format.getByPath("file_2.txt"));
}
}
@Test
public void archiveHeadSpecificPath() throws IOException, GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("file_1.txt", "content_1_1");
git.add().addFilepattern("file_1.txt").call();
git.commit().setMessage("create file").call();
@ -126,10 +127,11 @@ public void archiveHeadSpecificPath() throws IOException, GitAPIException {
assertEquals(UNEXPECTED_FILE_CONTENTS, "content_2_2", format.getByPath(expectedFilePath));
assertNull(UNEXPECTED_TREE_CONTENTS, format.getByPath("some_directory"));
}
}
@Test
public void archiveByIdSpecificFile() throws IOException, GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("file_1.txt", "content_1_1");
git.add().addFilepattern("file_1.txt").call();
RevCommit first = git.commit().setMessage("create file").call();
@ -154,10 +156,11 @@ public void archiveByIdSpecificFile() throws IOException, GitAPIException {
assertEquals(UNEXPECTED_ARCHIVE_SIZE, 1, format.size());
assertEquals(UNEXPECTED_FILE_CONTENTS, "content_1_1", format.getByPath("file_1.txt"));
}
}
@Test
public void archiveByDirectoryPath() throws GitAPIException, IOException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("file_0.txt", "content_0_1");
git.add().addFilepattern("file_0.txt").call();
git.commit().setMessage("commit_1").call();
@ -183,6 +186,7 @@ public void archiveByDirectoryPath() throws GitAPIException, IOException {
assertNull(UNEXPECTED_TREE_CONTENTS, format.getByPath("some_directory"));
assertNull(UNEXPECTED_TREE_CONTENTS, format.getByPath("some_directory/nested_directory"));
}
}
private class MockFormat implements ArchiveCommand.Format<MockOutputStream> {

View File

@ -72,8 +72,7 @@ private static String join(String... lines) {
@Test
public void testSingleRevision() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content = new String[] { "first", "second", "third" };
writeTrashFile("file.txt", join(content));
@ -91,11 +90,11 @@ public void testSingleRevision() throws Exception {
assertEquals(i, lines.getSourceLine(i));
}
}
}
@Test
public void testTwoRevisions() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "first", "second" };
writeTrashFile("file.txt", join(content1));
git.add().addFilepattern("file.txt").call();
@ -120,6 +119,7 @@ public void testTwoRevisions() throws Exception {
assertEquals(commit2, lines.getSourceCommit(2));
assertEquals(2, lines.getSourceLine(2));
}
}
@Test
public void testRename() throws Exception {
@ -138,8 +138,7 @@ public void testMoveToOtherDir() throws Exception {
private void testRename(final String sourcePath, final String destPath)
throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "a", "b", "c" };
writeTrashFile(sourcePath, join(content1));
git.add().addFilepattern(sourcePath).call();
@ -172,11 +171,11 @@ private void testRename(final String sourcePath, final String destPath)
assertEquals(2, lines.getSourceLine(2));
assertEquals(destPath, lines.getSourcePath(2));
}
}
@Test
public void testTwoRenames() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
// Commit 1: Add file.txt
String[] content1 = new String[] { "a" };
writeTrashFile("file.txt", join(content1));
@ -214,11 +213,11 @@ public void testTwoRenames() throws Exception {
assertEquals(1, lines.getSourceLine(1));
assertEquals("file1.txt", lines.getSourcePath(1));
}
}
@Test
public void testDeleteTrailingLines() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "a", "b", "c", "d" };
String[] content2 = new String[] { "a", "b" };
@ -246,11 +245,11 @@ public void testDeleteTrailingLines() throws Exception {
assertEquals(0, lines.getSourceLine(0));
assertEquals(1, lines.getSourceLine(1));
}
}
@Test
public void testDeleteMiddleLines() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "a", "b", "c", "d", "e" };
String[] content2 = new String[] { "a", "c", "e" };
@ -281,11 +280,11 @@ public void testDeleteMiddleLines() throws Exception {
assertEquals(commit1, lines.getSourceCommit(2));
assertEquals(2, lines.getSourceLine(2));
}
}
@Test
public void testEditAllLines() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "a", "1" };
String[] content2 = new String[] { "b", "2" };
@ -305,11 +304,11 @@ public void testEditAllLines() throws Exception {
assertEquals(commit2, lines.getSourceCommit(0));
assertEquals(commit2, lines.getSourceCommit(1));
}
}
@Test
public void testMiddleClearAllLines() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
String[] content1 = new String[] { "a", "b", "c" };
writeTrashFile("file.txt", join(content1));
@ -333,6 +332,7 @@ public void testMiddleClearAllLines() throws Exception {
assertEquals(commit3, lines.getSourceCommit(1));
assertEquals(commit3, lines.getSourceCommit(2));
}
}
@Test
public void testCoreAutoCrlf1() throws Exception {
@ -361,7 +361,7 @@ public void testCoreAutoCrlf5() throws Exception {
private void testCoreAutoCrlf(AutoCRLF modeForCommitting,
AutoCRLF modeForReset) throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
FileBasedConfig config = db.getConfig();
config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_AUTOCRLF, modeForCommitting);
@ -388,11 +388,11 @@ private void testCoreAutoCrlf(AutoCRLF modeForCommitting,
assertEquals(commit, lines.getSourceCommit(1));
assertEquals(commit, lines.getSourceCommit(2));
}
}
@Test
public void testConflictingMerge1() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit base = commitFile("file.txt", join("0", "1", "2", "3", "4"),
"master");
@ -422,13 +422,13 @@ public void testConflictingMerge1() throws Exception {
assertEquals(merge, lines.getSourceCommit(3));
assertEquals(base, lines.getSourceCommit(4));
}
}
// this test inverts the order of the master and side commit and is
// otherwise identical to testConflictingMerge1
@Test
public void testConflictingMerge2() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit base = commitFile("file.txt", join("0", "1", "2", "3", "4"),
"master");
@ -458,10 +458,11 @@ public void testConflictingMerge2() throws Exception {
assertEquals(merge, lines.getSourceCommit(3));
assertEquals(base, lines.getSourceCommit(4));
}
}
@Test
public void testWhitespaceMerge() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit base = commitFile("file.txt", join("0", "1", "2"), "master");
RevCommit side = commitFile("file.txt", join("0", "1", " 2 side "),
"side");
@ -488,3 +489,4 @@ public void testWhitespaceMerge() throws Exception {
assertEquals(side, lines.getSourceCommit(2));
}
}
}

View File

@ -88,8 +88,7 @@ public void testCherryPickNoCommit() throws IOException,
private void doTestCherryPick(boolean noCommit) throws IOException,
JGitInternalException,
GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("a", "first line\nsec. line\nthird line\n");
git.add().addFilepattern("a").call();
RevCommit firstCommit = git.commit().setMessage("create a").call();
@ -128,12 +127,12 @@ private void doTestCherryPick(boolean noCommit) throws IOException,
assertEquals("create a", history.next().getFullMessage());
assertFalse(history.hasNext());
}
}
@Test
public void testSequentialCherryPick() throws IOException, JGitInternalException,
GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
writeTrashFile("a", "first line\nsec. line\nthird line\n");
git.add().addFilepattern("a").call();
RevCommit firstCommit = git.commit().setMessage("create a").call();
@ -164,10 +163,11 @@ public void testSequentialCherryPick() throws IOException, JGitInternalException
assertEquals("create a", history.next().getFullMessage());
assertFalse(history.hasNext());
}
}
@Test
public void testCherryPickDirtyIndex() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
// modify and add file a
@ -178,10 +178,11 @@ public void testCherryPickDirtyIndex() throws Exception {
doCherryPickAndCheckResult(git, sideCommit,
MergeFailureReason.DIRTY_INDEX);
}
}
@Test
public void testCherryPickDirtyWorktree() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
// modify file a
@ -191,10 +192,11 @@ public void testCherryPickDirtyWorktree() throws Exception {
doCherryPickAndCheckResult(git, sideCommit,
MergeFailureReason.DIRTY_WORKTREE);
}
}
@Test
public void testCherryPickConflictResolution() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
CherryPickResult result = git.cherryPick().include(sideCommit.getId())
@ -219,6 +221,7 @@ public void testCherryPickConflictResolution() throws Exception {
assertEquals(RepositoryState.SAFE, db.getRepositoryState());
}
}
@Test
public void testCherryPickConflictResolutionNoCOmmit() throws Exception {
@ -251,8 +254,7 @@ public void testCherryPickConflictResolutionNoCOmmit() throws Exception {
@Test
public void testCherryPickConflictReset() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
CherryPickResult result = git.cherryPick().include(sideCommit.getId())
@ -269,11 +271,12 @@ public void testCherryPickConflictReset() throws Exception {
assertFalse(new File(db.getDirectory(), Constants.CHERRY_PICK_HEAD)
.exists());
}
}
@Test
public void testCherryPickOverExecutableChangeOnNonExectuableFileSystem()
throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
File file = writeTrashFile("test.txt", "a");
assertNotNull(git.add().addFilepattern("test.txt").call());
assertNotNull(git.commit().setMessage("commit1").call());
@ -305,10 +308,11 @@ public void testCherryPickOverExecutableChangeOnNonExectuableFileSystem()
assertNotNull(result);
assertEquals(CherryPickStatus.OK, result.getStatus());
}
}
@Test
public void testCherryPickConflictMarkers() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
CherryPickResult result = git.cherryPick().include(sideCommit.getId())
@ -318,10 +322,11 @@ public void testCherryPickConflictMarkers() throws Exception {
String expected = "<<<<<<< master\na(master)\n=======\na(side)\n>>>>>>> 527460a side\n";
checkFile(new File(db.getWorkTree(), "a"), expected);
}
}
@Test
public void testCherryPickOurCommitName() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
CherryPickResult result = git.cherryPick().include(sideCommit.getId())
@ -331,6 +336,7 @@ public void testCherryPickOurCommitName() throws Exception {
String expected = "<<<<<<< custom name\na(master)\n=======\na(side)\n>>>>>>> 527460a side\n";
checkFile(new File(db.getWorkTree(), "a"), expected);
}
}
private RevCommit prepareCherryPick(final Git git) throws Exception {
// create, add and commit file a
@ -399,8 +405,7 @@ private void doCherryPickAndCheckResult(final Git git,
*/
@Test
public void testCherryPickMerge() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
commitFile("file", "1\n2\n3\n", "master");
commitFile("file", "1\n2\n3\n", "side");
checkoutBranch("refs/heads/side");
@ -439,3 +444,4 @@ public void testCherryPickMerge() throws Exception {
checkFile(new File(db.getWorkTree(), "file"), "a\n2\n3\n");
}
}
}

View File

@ -46,6 +46,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
import java.io.File;
import java.io.IOException;
@ -78,7 +79,7 @@ public void testSomeCommits() throws JGitInternalException, IOException,
GitAPIException {
// do 4 commits
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
git.commit().setMessage("second commit").setCommitter(committer).call();
git.commit().setMessage("third commit").setAuthor(author).call();
@ -109,13 +110,13 @@ public void testSomeCommits() throws JGitInternalException, IOException,
reader = db.getReflogReader(db.getBranch());
assertTrue(reader.getLastEntry().getComment().startsWith("commit:"));
}
}
@Test
public void testLogWithFilter() throws IOException, JGitInternalException,
GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
// create first file
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
@ -162,12 +163,12 @@ public void testLogWithFilter() throws IOException, JGitInternalException,
}
assertEquals(2, count);
}
}
// try to do a commit without specifying a message. Should fail!
@Test
public void testWrongParams() throws GitAPIException {
Git git = new Git(db);
try {
try (Git git = new Git(db)) {
git.commit().setAuthor(author).call();
fail("Didn't get the expected exception");
} catch (NoMessageException e) {
@ -179,7 +180,7 @@ public void testWrongParams() throws GitAPIException {
// exceptions
@Test
public void testMultipleInvocations() throws GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
CommitCommand commitCmd = git.commit();
commitCmd.setMessage("initial commit").call();
try {
@ -199,11 +200,12 @@ public void testMultipleInvocations() throws GitAPIException {
// expected
}
}
}
@Test
public void testMergeEmptyBranches() throws IOException,
JGitInternalException, GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
RefUpdate r = db.updateRef("refs/heads/side");
r.setNewObjectId(db.resolve(Constants.HEAD));
@ -222,6 +224,7 @@ public void testMergeEmptyBranches() throws IOException,
assertEquals(parents[1], second);
assertEquals(2, parents.length);
}
}
@Test
public void testAddUnstagedChanges() throws IOException,
@ -232,7 +235,7 @@ public void testAddUnstagedChanges() throws IOException,
writer.print("content");
writer.close();
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("a.txt").call();
RevCommit commit = git.commit().setMessage("initial commit").call();
TreeWalk tw = TreeWalk.forPath(db, "a.txt", commit.getTree());
@ -253,13 +256,12 @@ public void testAddUnstagedChanges() throws IOException,
assertEquals("db00fd65b218578127ea51f3dffac701f12f486a",
tw.getObjectId(0).getName());
}
}
@Test
public void testModeChange() throws IOException, GitAPIException {
if (System.getProperty("os.name").startsWith("Windows"))
return; // SKIP
Git git = new Git(db);
assumeFalse(System.getProperty("os.name").startsWith("Windows"));// SKIP
try (Git git = new Git(db)) {
// create file
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
@ -283,13 +285,14 @@ public void testModeChange() throws IOException, GitAPIException {
git.commit().setMessage("mode change").setCommitter(committer)
.setOnly("a.txt").call();
}
}
@Test
public void testCommitRange() throws GitAPIException,
JGitInternalException, MissingObjectException,
IncorrectObjectTypeException {
// do 4 commits and set the range to the second and fourth one
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("first commit").call();
RevCommit second = git.commit().setMessage("second commit")
.setCommitter(committer).call();
@ -318,11 +321,12 @@ public void testCommitRange() throws GitAPIException,
}
assertEquals(l, -1);
}
}
@Test
public void testCommitAmend() throws JGitInternalException, IOException,
GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("first comit").call(); // typo
git.commit().setAmend(true).setMessage("first commit").call();
@ -340,11 +344,12 @@ public void testCommitAmend() throws JGitInternalException, IOException,
assertTrue(reader.getLastEntry().getComment()
.startsWith("commit (amend):"));
}
}
@Test
public void testInsertChangeId() throws JGitInternalException,
GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
String messageHeader = "Some header line\n\nSome detail explanation\n";
String changeIdTemplate = "\nChange-Id: I"
+ ObjectId.zeroId().getName() + "\n";
@ -398,3 +403,4 @@ public void testInsertChangeId() throws JGitInternalException,
"Change-Id: I" + ObjectId.zeroId().getName()));
}
}
}

View File

@ -62,28 +62,30 @@ public class TagCommandTest extends RepositoryTestCase {
@Test
public void testTaggingOnHead() throws GitAPIException, IOException {
Git git = new Git(db);
try (Git git = new Git(db);
RevWalk walk = new RevWalk(db)) {
RevCommit commit = git.commit().setMessage("initial commit").call();
Ref tagRef = git.tag().setName("tag").call();
assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId());
RevWalk walk = new RevWalk(db);
assertEquals("tag", walk.parseTag(tagRef.getObjectId()).getTagName());
}
}
@Test
public void testTagging() throws GitAPIException, JGitInternalException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
RevCommit commit = git.commit().setMessage("second commit").call();
git.commit().setMessage("third commit").call();
Ref tagRef = git.tag().setObjectId(commit).setName("tag").call();
assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId());
}
}
@Test
public void testUnannotatedTagging() throws GitAPIException,
JGitInternalException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
RevCommit commit = git.commit().setMessage("second commit").call();
git.commit().setMessage("third commit").call();
@ -91,10 +93,11 @@ public void testUnannotatedTagging() throws GitAPIException,
.setAnnotated(false).call();
assertEquals(commit.getId(), tagRef.getObjectId());
}
}
@Test
public void testEmptyTagName() throws GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
try {
// forget to tag name
@ -104,10 +107,11 @@ public void testEmptyTagName() throws GitAPIException {
// should hit here
}
}
}
@Test
public void testInvalidTagName() throws GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
try {
git.tag().setName("bad~tag~name").setMessage("some message").call();
@ -116,10 +120,11 @@ public void testInvalidTagName() throws GitAPIException {
// should hit here
}
}
}
@Test
public void testFailureOnSignedTags() throws GitAPIException {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
try {
git.tag().setSigned(true).setName("tag").call();
@ -128,10 +133,11 @@ public void testFailureOnSignedTags() throws GitAPIException {
// should hit here
}
}
}
@Test
public void testDelete() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
Ref tagRef = git.tag().setName("tag").call();
assertEquals(1, db.getTags().size());
@ -150,10 +156,11 @@ public void testDelete() throws Exception {
assertEquals(2, deleted.size());
assertEquals(0, db.getTags().size());
}
}
@Test
public void testDeleteFullName() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
Ref tagRef = git.tag().setName("tag").call();
assertEquals(1, db.getTags().size());
@ -164,56 +171,62 @@ public void testDeleteFullName() throws Exception {
assertEquals(tagRef.getName(), deleted.get(0));
assertEquals(0, db.getTags().size());
}
}
@Test
public void testDeleteEmptyTagNames() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
List<String> deleted = git.tagDelete().setTags().call();
assertEquals(0, deleted.size());
}
}
@Test
public void testDeleteNonExisting() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
List<String> deleted = git.tagDelete().setTags("tag").call();
assertEquals(0, deleted.size());
}
}
@Test
public void testDeleteBadName() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
List<String> deleted = git.tagDelete().setTags("bad~tag~name")
.call();
assertEquals(0, deleted.size());
}
}
@Test
public void testShouldNotBlowUpIfThereAreNoTagsInRepository()
throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("*").call();
git.commit().setMessage("initial commit").call();
List<Ref> list = git.tagList().call();
assertEquals(0, list.size());
}
}
@Test
public void testShouldNotBlowUpIfThereAreNoCommitsInRepository()
throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
List<Ref> list = git.tagList().call();
assertEquals(0, list.size());
}
}
@Test
public void testListAllTagsInRepositoryInOrder() throws Exception {
Git git = new Git(db);
try (Git git = new Git(db)) {
git.add().addFilepattern("*").call();
git.commit().setMessage("initial commit").call();
@ -228,5 +241,6 @@ public void testListAllTagsInRepositoryInOrder() throws Exception {
assertEquals("refs/tags/v2", list.get(1).getName());
assertEquals("refs/tags/v3", list.get(2).getName());
}
}
}

View File

@ -317,17 +317,17 @@ public void testDiff() throws Exception {
File folder = new File(db.getDirectory().getParent(), "folder");
FileUtils.mkdir(folder);
write(new File(folder, "folder.txt"), "folder");
Git git = new Git(db);
try (Git git = new Git(db);
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os))) {
git.add().addFilepattern(".").call();
git.commit().setMessage("Initial commit").call();
write(new File(folder, "folder.txt"), "folder change");
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os));
dfmt.setRepository(db);
dfmt.setPathFilter(PathFilter.create("folder"));
DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache());
FileTreeIterator newTree = new FileTreeIterator(db);
dfmt.format(oldTree, newTree);
dfmt.flush();
@ -342,6 +342,7 @@ public void testDiff() throws Exception {
assertEquals(expected, actual);
}
}
@Test
public void testDiffRootNullToTree() throws Exception {
@ -349,13 +350,13 @@ public void testDiffRootNullToTree() throws Exception {
File folder = new File(db.getDirectory().getParent(), "folder");
FileUtils.mkdir(folder);
write(new File(folder, "folder.txt"), "folder");
Git git = new Git(db);
try (Git git = new Git(db);
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os))) {
git.add().addFilepattern(".").call();
RevCommit commit = git.commit().setMessage("Initial commit").call();
write(new File(folder, "folder.txt"), "folder change");
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os));
dfmt.setRepository(db);
dfmt.setPathFilter(PathFilter.create("folder"));
dfmt.format(null, commit.getTree().getId());
@ -373,6 +374,7 @@ public void testDiffRootNullToTree() throws Exception {
assertEquals(expected, actual);
}
}
@Test
public void testDiffRootTreeToNull() throws Exception {
@ -380,13 +382,13 @@ public void testDiffRootTreeToNull() throws Exception {
File folder = new File(db.getDirectory().getParent(), "folder");
FileUtils.mkdir(folder);
write(new File(folder, "folder.txt"), "folder");
Git git = new Git(db);
try (Git git = new Git(db);
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os));) {
git.add().addFilepattern(".").call();
RevCommit commit = git.commit().setMessage("Initial commit").call();
write(new File(folder, "folder.txt"), "folder change");
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os));
dfmt.setRepository(db);
dfmt.setPathFilter(PathFilter.create("folder"));
dfmt.format(commit.getTree().getId(), null);
@ -404,11 +406,12 @@ public void testDiffRootTreeToNull() throws Exception {
assertEquals(expected, actual);
}
}
@Test
public void testDiffNullToNull() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os));
try (ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter dfmt = new DiffFormatter(new SafeBufferedOutputStream(os))) {
dfmt.setRepository(db);
dfmt.format((AnyObjectId) null, null);
dfmt.flush();
@ -418,6 +421,7 @@ public void testDiffNullToNull() throws Exception {
assertEquals(expected, actual);
}
}
private static String makeDiffHeader(String pathA, String pathB,
ObjectId aId,

View File

@ -126,8 +126,9 @@ public void testIncrementalBundle() throws Exception {
assertNull(newRepo.resolve("refs/heads/a"));
// Next an incremental bundle
try (RevWalk rw = new RevWalk(db)) {
bundle = makeBundle("refs/heads/cc", db.resolve("c").name(),
new RevWalk(db).parseCommit(db.resolve("a").toObjectId()));
rw.parseCommit(db.resolve("a").toObjectId()));
fetchResult = fetchFromBundle(newRepo, bundle);
advertisedRef = fetchResult.getAdvertisedRef("refs/heads/cc");
assertEquals(db.resolve("c").name(), advertisedRef.getObjectId().name());
@ -146,6 +147,7 @@ public void testIncrementalBundle() throws Exception {
.indexOf(db.resolve("refs/heads/a").name()) >= 0);
}
}
}
@Test
public void testAbortWrite() throws Exception {

View File

@ -195,25 +195,31 @@ public void flush() throws IOException {
assertEquals(1, flushCnt[0]);
}
@SuppressWarnings("unused")
private void createSideBandOutputStream(int chan, int sz, OutputStream os)
throws Exception {
try (SideBandOutputStream s = new SideBandOutputStream(chan, sz, os)) {
// Unused
}
}
@Test
public void testConstructor_RejectsBadChannel() {
public void testConstructor_RejectsBadChannel() throws Exception {
try {
new SideBandOutputStream(-1, MAX_BUF, rawOut);
createSideBandOutputStream(-1, MAX_BUF, rawOut);
fail("Accepted -1 channel number");
} catch (IllegalArgumentException e) {
assertEquals("channel -1 must be in range [1, 255]", e.getMessage());
}
try {
new SideBandOutputStream(0, MAX_BUF, rawOut);
createSideBandOutputStream(0, MAX_BUF, rawOut);
fail("Accepted 0 channel number");
} catch (IllegalArgumentException e) {
assertEquals("channel 0 must be in range [1, 255]", e.getMessage());
}
try {
new SideBandOutputStream(256, MAX_BUF, rawOut);
createSideBandOutputStream(256, MAX_BUF, rawOut);
fail("Accepted 256 channel number");
} catch (IllegalArgumentException e) {
assertEquals("channel 256 must be in range [1, 255]", e
@ -221,32 +227,31 @@ public void testConstructor_RejectsBadChannel() {
}
}
@SuppressWarnings("unused")
@Test
public void testConstructor_RejectsBadBufferSize() {
public void testConstructor_RejectsBadBufferSize() throws Exception {
try {
new SideBandOutputStream(CH_DATA, -1, rawOut);
createSideBandOutputStream(CH_DATA, -1, rawOut);
fail("Accepted -1 for buffer size");
} catch (IllegalArgumentException e) {
assertEquals("packet size -1 must be >= 5", e.getMessage());
}
try {
new SideBandOutputStream(CH_DATA, 0, rawOut);
createSideBandOutputStream(CH_DATA, 0, rawOut);
fail("Accepted 0 for buffer size");
} catch (IllegalArgumentException e) {
assertEquals("packet size 0 must be >= 5", e.getMessage());
}
try {
new SideBandOutputStream(CH_DATA, 1, rawOut);
createSideBandOutputStream(CH_DATA, 1, rawOut);
fail("Accepted 1 for buffer size");
} catch (IllegalArgumentException e) {
assertEquals("packet size 1 must be >= 5", e.getMessage());
}
try {
new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut);
createSideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut);
fail("Accepted " + Integer.MAX_VALUE + " for buffer size");
} catch (IllegalArgumentException e) {
assertEquals(MessageFormat.format(

View File

@ -103,8 +103,9 @@ public void apply(DirCacheEntry ent) {
});
assertTrue(dce.commit());
}
new Git(db).commit().setMessage("Adding link").call();
new Git(db).reset().setMode(ResetType.HARD).call();
try (Git git = new Git(db)) {
git.commit().setMessage("Adding link").call();
git.reset().setMode(ResetType.HARD).call();
DirCacheIterator dci = new DirCacheIterator(db.readDirCache());
FileTreeIterator fti = new FileTreeIterator(db);
@ -116,6 +117,7 @@ public void apply(DirCacheEntry ent) {
assertFalse(fti.isModified(dci.getDirCacheEntry(), true,
db.newObjectReader()));
}
}
/**
* Like #testSymlinkNotModifiedThoughNormalized but there is no
@ -142,8 +144,9 @@ public void apply(DirCacheEntry ent) {
});
assertTrue(dce.commit());
}
new Git(db).commit().setMessage("Adding link").call();
new Git(db).reset().setMode(ResetType.HARD).call();
try (Git git = new Git(db)) {
git.commit().setMessage("Adding link").call();
git.reset().setMode(ResetType.HARD).call();
DirCacheIterator dci = new DirCacheIterator(db.readDirCache());
FileTreeIterator fti = new FileTreeIterator(db);
@ -155,6 +158,7 @@ public void apply(DirCacheEntry ent) {
assertFalse(fti.isModified(dci.getDirCacheEntry(), true,
db.newObjectReader()));
}
}
/**
* Like #testSymlinkNotModifiedThoughNormalized but here the link is
@ -182,8 +186,9 @@ public void apply(DirCacheEntry ent) {
});
assertTrue(dce.commit());
}
new Git(db).commit().setMessage("Adding link").call();
new Git(db).reset().setMode(ResetType.HARD).call();
try (Git git = new Git(db)) {
git.commit().setMessage("Adding link").call();
git.reset().setMode(ResetType.HARD).call();
FileUtils.delete(new File(trash, "link"), FileUtils.NONE);
FS.DETECTED.createSymLink(new File(trash, "link"), "newtarget");
@ -199,3 +204,4 @@ public void apply(DirCacheEntry ent) {
db.newObjectReader()));
}
}
}