aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Thun2011-03-15 20:36:56 (EDT)
committerPhilipp Thun2011-03-15 20:36:56 (EDT)
commitc0112f97a1509d9b87da46f7a2a28206e26c616c (patch)
treeef9f003894acbc5b284a861dfc541d9d4c2f8ed9
parent8aef29c114910b8212306880d914c085e94a2fcd (diff)
downloadjgit-c0112f97a1509d9b87da46f7a2a28206e26c616c.zip
jgit-c0112f97a1509d9b87da46f7a2a28206e26c616c.tar.gz
jgit-c0112f97a1509d9b87da46f7a2a28206e26c616c.tar.bz2
Use parent directory in InitCommand if directory is "."refs/changes/30/2730/1
If no directory is set before executing an InitCommand, the current directory (".") is used by default. By calling File.getParentFile() we get the actual directory this points to. Using this directory makes it easier to read paths. Change-Id: I6245941395dae920e4f90b8985be6ef3cce570d3 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
index d68f4e2..5b96cdd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
@@ -82,8 +82,10 @@ public class InitCommand implements Callable<Git> {
builder.setGitDir(d);
} else if (builder.getGitDir() == null) {
File d = new File(".");
+ if (d.getParentFile() != null)
+ d = d.getParentFile();
if (!bare)
- d = new File(d, Constants.DOT_GIT).getCanonicalFile();
+ d = new File(d, Constants.DOT_GIT);
builder.setGitDir(d);
}
Repository repository = builder.build();