diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-08-25 20:57:52 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2017-08-25 20:57:52 -0400 |
commit | 40f40e496a9da2c41692c990a733be28e7bd819b (patch) | |
tree | 2725b153c8f8d836dd4576203eae59d2c9d73774 /org.eclipse.jgit | |
parent | 0e12692d8cff234525a889bbf540a8d2504dfb46 (diff) | |
parent | 88e453995d9bb7a9167b4a0028932550c00b49b9 (diff) | |
download | jgit-40f40e496a9da2c41692c990a733be28e7bd819b.tar.gz jgit-40f40e496a9da2c41692c990a733be28e7bd819b.zip |
Merge "Fix default directory set when setDirectory wasn't called."
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index d450c64679..bde8e63d1d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -50,6 +50,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.api.errors.JGitInternalException; @@ -157,6 +158,16 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { } /** + * Get the git directory. This is primarily used for tests. + * + * @return the git directory + */ + @Nullable + File getDirectory() { + return directory; + } + + /** * Executes the {@code Clone} command. * * The Git instance returned by this command needs to be closed by the @@ -232,9 +243,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { return false; } - private void verifyDirectories(URIish u) { + void verifyDirectories(URIish u) { if (directory == null && gitDir == null) { - directory = new File(u.getHumanishName(), Constants.DOT_GIT); + directory = new File(u.getHumanishName() + (bare ? Constants.DOT_GIT_EXT : "")); //$NON-NLS-1$ } directoryExistsInitially = directory != null && directory.exists(); gitDirExistsInitially = gitDir != null && gitDir.exists(); |