diff options
12 files changed, 39 insertions, 38 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java index 6920e91886..f45e5f67a7 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java @@ -324,7 +324,7 @@ public abstract class LocalDiskRepositoryTestCase extends TestCase { putPersonIdent(env, "AUTHOR", author); putPersonIdent(env, "COMMITTER", committer); - final File cwd = db.getWorkDir(); + final File cwd = db.getWorkTree(); final Process p = Runtime.getRuntime().exec(argv, toEnvArray(env), cwd); p.getOutputStream().close(); p.getErrorStream().close(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index 60663438fc..cc59a6eb5a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -183,7 +183,7 @@ class Clone extends AbstractFetchCommand { final Tree tree = commit.getTree(); final WorkDirCheckout co; - co = new WorkDirCheckout(db, db.getWorkDir(), index, tree); + co = new WorkDirCheckout(db, db.getWorkTree(), index, tree); co.checkout(); index.write(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java index 1b8711dc9d..b0cc5248c9 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java @@ -67,7 +67,7 @@ class Rm extends TextBuiltin { @Override protected void run() throws Exception { - root = db.getWorkDir(); + root = db.getWorkTree(); final DirCache dirc = DirCache.lock(db); final DirCacheBuilder edit = dirc.builder(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java index 4f0e338e8d..b563f07910 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java @@ -91,7 +91,7 @@ class Ipzilla extends TextBuiltin { } if (output == null) - output = new File(db.getWorkDir(), IpLogMeta.IPLOG_CONFIG_FILE); + output = new File(db.getWorkTree(), IpLogMeta.IPLOG_CONFIG_FILE); IpLogMeta meta = new IpLogMeta(); meta.syncCQs(output, ipzilla, username, password); diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java index dd3b51efc7..c5591b9bfd 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java @@ -116,7 +116,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { protected void setUp() throws Exception { super.setUp(); db = createWorkRepository(); - trash = db.getWorkDir(); + trash = db.getWorkTree(); } public void testCreateEmptyIndex() throws Exception { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java index c965c67664..773d2f0556 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java @@ -100,20 +100,20 @@ public class MergeCommandTest extends RepositoryTestCase { addNewFileToIndex("file1"); RevCommit first = git.commit().setMessage("initial commit").call(); - assertTrue(new File(db.getWorkDir(), "file1").exists()); + assertTrue(new File(db.getWorkTree(), "file1").exists()); createBranch(first, "refs/heads/branch1"); addNewFileToIndex("file2"); RevCommit second = git.commit().setMessage("second commit").call(); - assertTrue(new File(db.getWorkDir(), "file2").exists()); + assertTrue(new File(db.getWorkTree(), "file2").exists()); checkoutBranch("refs/heads/branch1"); - assertFalse(new File(db.getWorkDir(), "file2").exists()); + assertFalse(new File(db.getWorkTree(), "file2").exists()); MergeResult result = git.merge().include(db.getRef(Constants.MASTER)).call(); - assertTrue(new File(db.getWorkDir(), "file1").exists()); - assertTrue(new File(db.getWorkDir(), "file2").exists()); + assertTrue(new File(db.getWorkTree(), "file1").exists()); + assertTrue(new File(db.getWorkTree(), "file2").exists()); assertEquals(MergeResult.MergeStatus.FAST_FORWARD, result.getMergeStatus()); assertEquals(second, result.getNewHead()); } @@ -132,8 +132,8 @@ public class MergeCommandTest extends RepositoryTestCase { git.commit().setMessage("third commit").call(); checkoutBranch("refs/heads/branch1"); - assertFalse(new File(db.getWorkDir(), "file2").exists()); - assertFalse(new File(db.getWorkDir(), "file3").exists()); + assertFalse(new File(db.getWorkTree(), "file2").exists()); + assertFalse(new File(db.getWorkTree(), "file3").exists()); MergeCommand merge = git.merge(); merge.include(second.getId()); @@ -152,7 +152,7 @@ public class MergeCommandTest extends RepositoryTestCase { } private void checkoutBranch(String branchName) throws Exception { - File workDir = db.getWorkDir(); + File workDir = db.getWorkTree(); if (workDir != null) { WorkDirCheckout workDirCheckout = new WorkDirCheckout(db, workDir, db.mapCommit(Constants.HEAD).getTree(), @@ -176,7 +176,7 @@ public class MergeCommandTest extends RepositoryTestCase { File writeTrashFile = writeTrashFile(filename, filename); GitIndex index = db.getIndex(); - Entry entry = index.add(db.getWorkDir(), writeTrashFile); + Entry entry = index.add(db.getWorkTree(), writeTrashFile); entry.update(writeTrashFile); index.write(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java index 187d3ae9da..52cb46bae1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java @@ -73,7 +73,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { throws Exception { File gitDir = getFile("workdir", Constants.DOT_GIT); Repository repo = new FileRepository(gitDir); - String workdir = repo.getWorkDir().getName(); + String workdir = repo.getWorkTree().getName(); assertEquals(workdir, "workdir"); } @@ -132,7 +132,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { public void testExceptionThrown_BareRepoGetWorkDir() throws Exception { File gitDir = getFile("workdir"); try { - new FileRepository(gitDir).getWorkDir(); + new FileRepository(gitDir).getWorkTree(); fail("Expected IllegalStateException missing"); } catch (IllegalStateException e) { // expected @@ -202,7 +202,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { private void assertWorkdirPath(Repository repo, String... expected) throws IOException { File exp = getFile(expected).getCanonicalFile(); - File act = repo.getWorkDir().getCanonicalFile(); + File act = repo.getWorkTree().getCanonicalFile(); assertEquals("Wrong working Directory", exp, act); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java index 64df65b4c2..cc45722447 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java @@ -83,7 +83,7 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase { protected File writeTrashFile(final String name, final String data) throws IOException { - File path = new File(db.getWorkDir(), name); + File path = new File(db.getWorkTree(), name); write(path, data); return path; } @@ -111,6 +111,6 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase { protected void setUp() throws Exception { super.setUp(); db = createWorkRepository(); - trash = db.getWorkDir(); + trash = db.getWorkTree(); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java index 8dd5ae2bd0..aab57aa594 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java @@ -104,7 +104,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setGitDir(theDir).build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(repo1Parent, r.getWorkDir()); + assertEqualsPath(repo1Parent, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); } @@ -125,7 +125,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { FileRepository r = new FileRepositoryBuilder().setGitDir(theDir) .setWorkTree(repo1Parent.getParentFile()).build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(repo1Parent.getParentFile(), r.getWorkDir()); + assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); } @@ -145,7 +145,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setWorkTree(repo1Parent).build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(repo1Parent, r.getWorkDir()); + assertEqualsPath(repo1Parent, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); } @@ -170,7 +170,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setGitDir(theDir).build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(workdir, r.getWorkDir()); + assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); } @@ -195,7 +195,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setGitDir(theDir).build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(workdir, r.getWorkDir()); + assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectsDirectory()); } @@ -223,7 +223,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { .setIndexFile(indexFile) // .build(); assertEqualsPath(theDir, r.getDirectory()); - assertEqualsPath(theDir.getParentFile(), r.getWorkDir()); + assertEqualsPath(theDir.getParentFile(), r.getWorkTree()); assertEqualsPath(indexFile, r.getIndexFile()); assertEqualsPath(objDir, r.getObjectsDirectory()); assertNotNull(r.mapCommit("6db9c2ebf75590eef973081736730a9ea169a0c4")); @@ -726,10 +726,10 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { assertEquals("", Repository.stripWorkDir(relBase, relNonFile)); assertEquals("", Repository.stripWorkDir(absBase, absNonFile)); - assertEquals("", Repository.stripWorkDir(db.getWorkDir(), db.getWorkDir())); + assertEquals("", Repository.stripWorkDir(db.getWorkTree(), db.getWorkTree())); - File file = new File(new File(db.getWorkDir(), "subdir"), "File.java"); - assertEquals("subdir/File.java", Repository.stripWorkDir(db.getWorkDir(), file)); + File file = new File(new File(db.getWorkTree(), "subdir"), "File.java"); + assertEquals("subdir/File.java", Repository.stripWorkDir(db.getWorkTree(), file)); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index 00a0309152..76a3bc4794 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -163,7 +163,7 @@ public class MergeCommand extends GitCommand<MergeResult> { RevCommit newHeadCommit) throws IOException, CheckoutConflictException { GitIndex index = repo.getIndex(); - File workDir = repo.getWorkDir(); + File workDir = repo.getWorkTree(); if (workDir != null) { WorkDirCheckout workDirCheckout = new WorkDirCheckout(repo, workDir, headCommit.asCommit(revWalk).getTree(), index, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java index d655a97eb9..2e491af5a7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java @@ -89,7 +89,7 @@ public class IndexDiff { * @throws IOException */ public boolean diff() throws IOException { - final File root = index.getRepository().getWorkDir(); + final File root = index.getRepository().getWorkTree(); new IndexTreeWalker(index, tree, root, new AbstractIndexTreeVisitor() { public void visitEntry(TreeEntry treeEntry, Entry indexEntry, File file) { if (treeEntry == null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 939d923a74..7b32d69a0e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -96,7 +96,7 @@ public abstract class Repository { static private final List<RepositoryListener> allListeners = new Vector<RepositoryListener>(); // thread safe /** If not bare, the top level directory of the working files. */ - private final File workDir; + private final File workTree; /** If not bare, the index file caching the working file states. */ private final File indexFile; @@ -110,7 +110,7 @@ public abstract class Repository { protected Repository(final BaseRepositoryBuilder options) { gitDir = options.getGitDir(); fs = options.getFS(); - workDir = options.getWorkTree(); + workTree = options.getWorkTree(); indexFile = options.getIndexFile(); } @@ -886,7 +886,7 @@ public abstract class Repository { return RepositoryState.BARE; // Pre Git-1.6 logic - if (new File(getWorkDir(), ".dotest").exists()) + if (new File(getWorkTree(), ".dotest").exists()) return RepositoryState.REBASING; if (new File(getDirectory(), ".dotest-merge").exists()) return RepositoryState.REBASING_INTERACTIVE; @@ -1011,19 +1011,20 @@ public abstract class Repository { * @return the "bare"-ness of this Repository */ public boolean isBare() { - return workDir == null; + return workTree == null; } /** - * @return the workdir file, i.e. where the files are checked out + * @return the root directory of the working tree, where files are checked + * out for viewing and editing. * @throws IllegalStateException - * if the repository is "bare" + * if the repository is bare and has no working directory. */ - public File getWorkDir() throws IllegalStateException { + public File getWorkTree() throws IllegalStateException { if (isBare()) throw new IllegalStateException( JGitText.get().bareRepositoryNoWorkdirAndIndex); - return workDir; + return workTree; } /** |