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>
This commit is contained in:
parent
8aef29c114
commit
c0112f97a1
|
@ -82,8 +82,10 @@ public Git call() throws JGitInternalException {
|
||||||
builder.setGitDir(d);
|
builder.setGitDir(d);
|
||||||
} else if (builder.getGitDir() == null) {
|
} else if (builder.getGitDir() == null) {
|
||||||
File d = new File(".");
|
File d = new File(".");
|
||||||
|
if (d.getParentFile() != null)
|
||||||
|
d = d.getParentFile();
|
||||||
if (!bare)
|
if (!bare)
|
||||||
d = new File(d, Constants.DOT_GIT).getCanonicalFile();
|
d = new File(d, Constants.DOT_GIT);
|
||||||
builder.setGitDir(d);
|
builder.setGitDir(d);
|
||||||
}
|
}
|
||||||
Repository repository = builder.build();
|
Repository repository = builder.build();
|
||||||
|
|
Loading…
Reference in New Issue