From 0ce61caefbcada30fb1cc4f3b037560f1ba4a8b7 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Tue, 10 Dec 2013 00:13:08 +0100 Subject: [PATCH] Canonicalize worktree path in BaseRepositoryBuilder if set via config This is the case for submodules in .git/modules, which typically have a worktree config of "../../../dir". This can confuse callers, which e.g. try to call Repository.stripWorkDir with it. Bug: 423644 Change-Id: I0c00953f73f9316a66d0fc10eab52d8779c88f00 Signed-off-by: Robin Stocker Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index db622f319..7a6ddb39a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -695,7 +695,7 @@ private File guessWorkTreeOrFail() throws IOException { String path = cfg.getString(CONFIG_CORE_SECTION, null, CONFIG_KEY_WORKTREE); if (path != null) - return safeFS().resolve(getGitDir(), path); + return safeFS().resolve(getGitDir(), path).getCanonicalFile(); // If core.bare is set, honor its value. Assume workTree is // the parent directory of the repository.