diff options
author | Mykola Nikishov <mn@mn.com.ua> | 2009-12-18 01:03:51 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2009-12-19 00:47:06 +0100 |
commit | 21b6f3434ebc84f493405d890a3768d55375a721 (patch) | |
tree | 053f332f953824628686addd90b415d9a9650395 /org.eclipse.jgit.pgm | |
parent | f8f75f8a52a30cf2a7d793ba15cd74410ba64534 (diff) | |
download | jgit-21b6f3434ebc84f493405d890a3768d55375a721.tar.gz jgit-21b6f3434ebc84f493405d890a3768d55375a721.zip |
Method to get a 'humanish' name from a path
Change-Id: Iec0688232bd59d4626111d77633109918e8e1df3
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index a136df5618..3fe50d6682 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -93,15 +93,11 @@ class Clone extends AbstractFetchCommand { final URIish uri = new URIish(sourceUri); if (localName == null) { - String p = uri.getPath(); - while (p.endsWith("/")) - p = p.substring(0, p.length() - 1); - final int s = p.lastIndexOf('/'); - if (s < 0) + try { + localName = uri.getHumanishName(); + } catch (IllegalArgumentException e) { throw die("cannot guess local name from " + sourceUri); - localName = p.substring(s + 1); - if (localName.endsWith(".git")) - localName = localName.substring(0, localName.length() - 4); + } } if (gitdir == null) gitdir = new File(localName, ".git"); |