Merge changes I3a74cc84,I219f864f
* changes: [findbugs] Do not ignore exceptional return value of createNewFile() Do not create files to be updated before checkout of DirCache entry
This commit is contained in:
commit
9ffcf2a8b3
|
@ -47,7 +47,6 @@
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -58,6 +57,7 @@
|
||||||
import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException;
|
import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException;
|
||||||
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
|
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
|
||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
import org.eclipse.jgit.util.FileUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class FileResolverTest extends LocalDiskRepositoryTestCase {
|
public class FileResolverTest extends LocalDiskRepositoryTestCase {
|
||||||
|
@ -116,8 +116,7 @@ public void testExportOk() throws IOException {
|
||||||
fail("did not honor export-all flag");
|
fail("did not honor export-all flag");
|
||||||
}
|
}
|
||||||
|
|
||||||
export.createNewFile();
|
FileUtils.createNewFile(export);
|
||||||
assertTrue("has git-daemon-export-ok", export.exists());
|
|
||||||
resolver = new FileResolver(base, false /* require flag */);
|
resolver = new FileResolver(base, false /* require flag */);
|
||||||
try {
|
try {
|
||||||
resolver.open(null, name).close();
|
resolver.open(null, name).close();
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
import org.eclipse.jgit.revwalk.RevCommit;
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
import org.eclipse.jgit.treewalk.FileTreeIterator;
|
import org.eclipse.jgit.treewalk.FileTreeIterator;
|
||||||
import org.eclipse.jgit.treewalk.TreeWalk;
|
import org.eclipse.jgit.treewalk.TreeWalk;
|
||||||
|
import org.eclipse.jgit.util.FileUtils;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -537,8 +538,7 @@ private void deleteFileInFolderAndCommit() throws Exception {
|
||||||
|
|
||||||
private void createEmptyFolder() throws Exception {
|
private void createEmptyFolder() throws Exception {
|
||||||
File path = new File(db.getWorkTree(), FOLDER);
|
File path = new File(db.getWorkTree(), FOLDER);
|
||||||
path.mkdir();
|
FileUtils.mkdir(path);
|
||||||
assertTrue(path.isDirectory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private RevCommit createEmptyFolderAndCommit() throws Exception {
|
private RevCommit createEmptyFolderAndCommit() throws Exception {
|
||||||
|
@ -548,14 +548,12 @@ private RevCommit createEmptyFolderAndCommit() throws Exception {
|
||||||
|
|
||||||
private void createEmptyFolderUntracked() throws Exception {
|
private void createEmptyFolderUntracked() throws Exception {
|
||||||
File path = new File(db.getWorkTree(), UNTRACKED_FOLDER);
|
File path = new File(db.getWorkTree(), UNTRACKED_FOLDER);
|
||||||
path.mkdir();
|
FileUtils.mkdir(path);
|
||||||
assertTrue(path.isDirectory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createEmptyFolderIgnored() throws Exception {
|
private void createEmptyFolderIgnored() throws Exception {
|
||||||
File path = new File(db.getWorkTree(), IGNORED_FOLDER);
|
File path = new File(db.getWorkTree(), IGNORED_FOLDER);
|
||||||
path.mkdir();
|
FileUtils.mkdir(path);
|
||||||
assertTrue(path.isDirectory());
|
|
||||||
writeTrashFile(GITIGNORE, GITIGNORE + "\n" + IGNORED_FOLDER + "/");
|
writeTrashFile(GITIGNORE, GITIGNORE + "\n" + IGNORED_FOLDER + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,6 @@ public boolean checkout() throws IOException {
|
||||||
if (!file.getParentFile().mkdirs()) {
|
if (!file.getParentFile().mkdirs()) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
file.createNewFile();
|
|
||||||
DirCacheEntry entry = dc.getEntry(path);
|
DirCacheEntry entry = dc.getEntry(path);
|
||||||
checkoutEntry(repo, file, entry);
|
checkoutEntry(repo, file, entry);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue