about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-11-28 05:31:52 +0000
committerEric Wong <e@80x24.org>2022-11-28 23:38:57 +0000
commit8d22b26f24c55545709023bc6df9a7136713f9d4 (patch)
treea81d6ce64c41b880fce81d0ea3c04ed5a03e4bd4 /lib/PublicInbox
parent449f87dee7c811466aabdf2c5cb19db11c3e8e53 (diff)
downloadpublic-inbox-8d22b26f24c55545709023bc6df9a7136713f9d4.tar.gz
This makes it easier for humans to distinguish between
"Alice/project.git" and "Bob/project.git"
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/LeiMirror.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 28fef6f9..3220f48d 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -386,8 +386,11 @@ sub forkgroup_prep {
                 }
         }
         my $key = $self->{-key} // die 'BUG: no -key';
-        my ($bn) = ($key =~ m{/([a-z0-9_,;=!\+\{\}\|][^/]*)(?:\.git)?\z}i);
-        my $rn = "$bn-".substr(sha256_hex($key), 0, 16);
+        my $rn = $key;
+        $rn =~ s!\A[\./]+!!s;
+        $rn =~ s/\.*?(?:\.git)?\.*?\z//s;
+        $rn =~ s![\@\{\}/:\?\[\]\^~\s\f[:cntrl:]\*]!_!isg;
+        $rn .= '-'.substr(sha256_hex($key), 0, 16);
         # --no-tags is required to avoid conflicts
         for ("url=$uri", "fetch=+refs/*:refs/remotes/$rn/*",
                         'tagopt=--no-tags') {