]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology/repo_utils: strip only .git suffix
authorPatrick Donnelly <pdonnell@ibm.com>
Wed, 27 May 2026 15:38:13 +0000 (11:38 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Wed, 27 May 2026 15:38:52 +0000 (11:38 -0400)
Previous code with strip any trailing letters in .git.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
teuthology/repo_utils.py

index bb959b5c226da4ca5f877ad213c0f9bedd0f9fea..ced53ba4814dab7536b2361f4aec7d9781ecc2fd 100644 (file)
@@ -405,9 +405,10 @@ def url_to_dirname(url):
         file:///my/dir/has/ceph.git -> my_dir_has_ceph
     """
     # Strip protocol from left-hand side
-    string = re.match('(?:.*://|.*@)(.*)', url).groups()[0]
+    string = re.match('(?:.*://|.*@)(.*)', url).group(1)
     # Strip '.git' from the right-hand side
-    string = string.rstrip('.git')
+    if string.endswith('.git'):
+        string = string[:-4]
     # Replace certain characters with underscores
     string = re.sub('[:/]', '_', string)
     # Remove duplicate underscores