Browse Source

Merge "Make --git-dir optional for 'jgit init'"

stable-0.12
Chris Aniszczyk 14 years ago committed by Code Review
parent
commit
2df51d9427
  1. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java

@ -69,6 +69,7 @@ class Init extends TextBuiltin {
protected void run() throws Exception { protected void run() throws Exception {
InitCommand command = Git.init(); InitCommand command = Git.init();
command.setBare(bare); command.setBare(bare);
if (gitdir != null)
command.setDirectory(new File(gitdir)); command.setDirectory(new File(gitdir));
Repository repository = command.call().getRepository(); Repository repository = command.call().getRepository();
out.println(MessageFormat.format( out.println(MessageFormat.format(

2
org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java

@ -83,7 +83,7 @@ public class InitCommand implements Callable<Git> {
} else if (builder.getGitDir() == null) { } else if (builder.getGitDir() == null) {
File d = new File("."); File d = new File(".");
if (!bare) if (!bare)
d = new File(d, Constants.DOT_GIT); d = new File(d, Constants.DOT_GIT).getCanonicalFile();
builder.setGitDir(d); builder.setGitDir(d);
} }
Repository repository = builder.build(); Repository repository = builder.build();

Loading…
Cancel
Save