From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 45C69203AA for ; Mon, 28 Nov 2022 05:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613564; bh=pAQDVo1Ke5lhB10QcJoZ4pxdqs8ta5e4Yua2GAeqV7g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0P4O+J7tciSiX4wThUAUVBeTRoU8679zZofBZKXSNO823ma59U3UAo3jCW62DNejV ESsYGX0aHayPmdlKHmhKIRIxB6ax4NsN8buHfB0FZBEe1yJVPccKwUHOrCwf+nz1x4 AevipQ6Z33U+9+MUlQtks96uJajKTuD10skskBUk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 55/95] lei_mirror: make basename more descriptive Date: Mon, 28 Nov 2022 05:31:52 +0000 Message-Id: <20221128053232.291618-56-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This makes it easier for humans to distinguish between "Alice/project.git" and "Bob/project.git" --- lib/PublicInbox/LeiMirror.pm | 7 +++++-- 1 file 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') {