summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 ():