diff options
Diffstat (limited to 'org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java')
-rw-r--r-- | org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java index 6ab42936ba..f81713d2a8 100644 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java +++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java @@ -34,6 +34,7 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.lib.GitIndex.Entry; import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.storage.file.FileRepository; /** * Helper class for creating and filling a test repository @@ -51,12 +52,12 @@ public class TestRepository { * @throws IOException */ public TestRepository(File gitDir) throws IOException { - repository = new Repository(gitDir); + repository = new FileRepository(gitDir); repository.create(); try { - workdirPrefix = repository.getWorkDir().getCanonicalPath(); + workdirPrefix = repository.getWorkTree().getCanonicalPath(); } catch (IOException err) { - workdirPrefix = repository.getWorkDir().getAbsolutePath(); + workdirPrefix = repository.getWorkTree().getAbsolutePath(); } workdirPrefix = workdirPrefix.replace('\\', '/'); if (!workdirPrefix.endsWith("/")) //$NON-NLS-1$ @@ -71,9 +72,9 @@ public class TestRepository { public TestRepository(Repository repository) throws IOException { this.repository = repository; try { - workdirPrefix = repository.getWorkDir().getCanonicalPath(); + workdirPrefix = repository.getWorkTree().getCanonicalPath(); } catch (IOException err) { - workdirPrefix = repository.getWorkDir().getAbsolutePath(); + workdirPrefix = repository.getWorkTree().getAbsolutePath(); } workdirPrefix = workdirPrefix.replace('\\', '/'); if (!workdirPrefix.endsWith("/")) //$NON-NLS-1$ @@ -103,7 +104,7 @@ public class TestRepository { public RevCommit createInitialCommit(String message) throws IOException, NoHeadException, NoMessageException, ConcurrentRefUpdateException, JGitInternalException, WrongRepositoryStateException { - String repoPath = repository.getWorkDir().getAbsolutePath(); + String repoPath = repository.getWorkTree().getAbsolutePath(); File file = new File(repoPath, "dummy"); file.createNewFile(); track(file); @@ -144,7 +145,7 @@ public class TestRepository { */ public void track(File file) throws IOException { GitIndex index = repository.getIndex(); - Entry entry = index.add(repository.getWorkDir(), file); + Entry entry = index.add(repository.getWorkTree(), file); entry.setAssumeValid(false); index.write(); } @@ -184,8 +185,8 @@ public class TestRepository { GitIndex index = repository.getIndex(); Entry entry = index.getEntry(getRepoRelativePath(file.getLocation().toOSString())); assertNotNull(entry); - if (entry.isModified(repository.getWorkDir())) - entry.update(new File(repository.getWorkDir(), entry.getName())); + if (entry.isModified(repository.getWorkTree())) + entry.update(new File(repository.getWorkTree(), entry.getName())); index.write(); } |