From 203bd6626767015dfb04d421c572b26a34e9cecf Mon Sep 17 00:00:00 2001
From: "Shawn O. Pearce" <spearce@spearce.org>
Date: Fri, 25 Jun 2010 17:53:03 -0700
Subject: Rename Repository getWorkDir to getWorkTree

This better matches with the name used in the environment
(GIT_WORK_TREE), in the configuration file (core.worktree),
and in our builder object.

Since we are already breaking a good chunk of other code
related to repository access, and this fairly easy to fix
in an application's code base, I'm not going to offer the
wrapper getWorkDir() method.

Change-Id: Ib698ba4bbc213c48114f342378cecfe377e37bb7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/eclipse/jgit/api/MergeCommand.java          |  2 +-
 .../src/org/eclipse/jgit/lib/IndexDiff.java             |  2 +-
 .../src/org/eclipse/jgit/lib/Repository.java            | 17 +++++++++--------
 3 files changed, 11 insertions(+), 10 deletions(-)

(limited to 'org.eclipse.jgit/src/org')

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;
 	}
 
 	/**
-- 
cgit v1.2.3