gbp-clone: support repo URLs like "host:repo.git"
authorGuan Junchun <junchunx.guan@intel.com>
Sat, 12 Oct 2013 08:54:44 +0000 (16:54 +0800)
committerGuido Günther <agx@sigxcpu.org>
Tue, 22 Oct 2013 11:38:10 +0000 (13:38 +0200)
Previously, gbp didn't correctly parse this kind of URL and clone
failed.

Signed-off-by: Guan Junchun <junchunx.guan@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py

index cc723df..7e0b329 100644 (file)
@@ -1851,7 +1851,10 @@ class GitRepository(object):
                 raise GitRepositoryError("Error running git clone: %s" % stderr)
 
             if not name:
-                name = remote.rstrip('/').rsplit('/',1)[1]
+                try:
+                    name = remote.rstrip('/').rsplit('/',1)[1]
+                except IndexError:
+                    name = remote.split(':', 1)[1]
                 if (mirror or bare):
                     if not name.endswith('.git'):
                         name = "%s.git" % name