summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2016-12-03 19:36:28 +0000
committerRay Strode <rstrode@redhat.com>2016-12-03 19:36:28 +0000
commit97a0d8b0d4819a4123a3895808aca9582967e01a (patch)
treef5bd58f3dd19e6b56f36823ff3a4a558a83c8cee
parent44543c267876afff2a8b7ad9e32b1a9063e6e877 (diff)
post-receive-mirror-github: handle nested repositories better
This commit changes dbus/dbus to dbus and spice/qemu to spice-qemu
-rwxr-xr-xpost-receive-mirror-github12
1 files changed, 8 insertions, 4 deletions
diff --git a/post-receive-mirror-github b/post-receive-mirror-github
index 292b3dc..c7e13c5 100755
--- a/post-receive-mirror-github
+++ b/post-receive-mirror-github
@@ -100,11 +100,15 @@ class GitHub:
return name
def get_repo_name ():
- repo_name = os.getcwd ().split("/")[-1]
- if repo_name == ".git":
- repo_name = os.getcwd ().split("/")[-2]
- elif repo_name.endswith(".git"):
+ repo_name = "".join(os.getcwd ().split("/git/")[1:]).replace('/','-')
+ if repo_name.endswith(".git"):
repo_name = repo_name[0:-4]
+
+ parts = repo_name.split("-")
+ while len(parts) >= 2 and parts[0] == parts[1]:
+ parts.remove(parts[0])
+ repo_name = "-".join(parts)
+
return repo_name
def main ():