package org.eclipse.jgit.merge;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
public static MergeStrategy recursive = MergeStrategy.RECURSIVE;
@Theory
- public void failingPathsShouldNotResultInOKReturnValue(
+ public void failingDeleteOfDirectoryWithUntrackedContent(
MergeStrategy strategy) throws Exception {
File folder1 = new File(db.getWorkTree(), "folder1");
FileUtils.mkdir(folder1);
RevCommit head = git.commit().setMessage("Adding another file").call();
// Untracked file to cause failing path for delete() of folder1
+ // but that's ok.
file = new File(folder1, "file3.txt");
write(file, "folder1--file3.txt");
merger.setCommitNames(new String[] { "BASE", "HEAD", "other" });
merger.setWorkingTreeIterator(new FileTreeIterator(db));
boolean ok = merger.merge(head.getId(), other.getId());
-
- assertFalse(merger.getFailingPaths().isEmpty());
- assertFalse(ok);
+ assertTrue(ok);
+ assertTrue(file.exists());
}
/**
String fileName = toBeDeleted.get(i);
File f = new File(db.getWorkTree(), fileName);
if (!f.delete())
- failingPaths.put(fileName,
- MergeFailureReason.COULD_NOT_DELETE);
+ if (!f.isDirectory())
+ failingPaths.put(fileName,
+ MergeFailureReason.COULD_NOT_DELETE);
modifiedFiles.add(fileName);
}
} finally {