diff options
author | Philipp Thun <philipp.thun@sap.com> | 2011-03-16 01:36:56 +0100 |
---|---|---|
committer | Philipp Thun <philipp.thun@sap.com> | 2011-03-16 01:36:56 +0100 |
commit | c0112f97a1509d9b87da46f7a2a28206e26c616c (patch) | |
tree | ef9f003894acbc5b284a861dfc541d9d4c2f8ed9 /org.eclipse.jgit/src | |
parent | 8aef29c114910b8212306880d914c085e94a2fcd (diff) | |
download | jgit-c0112f97a1509d9b87da46f7a2a28206e26c616c.tar.gz jgit-c0112f97a1509d9b87da46f7a2a28206e26c616c.zip |
Use parent directory in InitCommand if directory is "."
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>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java | 4 |
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 d68f4e27f2..5b96cddac6 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(); |