about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiMirror.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-13 12:00:23 +0000
committerEric Wong <e@80x24.org>2023-03-13 12:45:58 +0000
commit0989c0bc6cbd6b3b0605a681034fc3203e0dcab9 (patch)
treeb5408d5fe8d2018f0f0b8a1976d8e2f0d9e52a6c /lib/PublicInbox/LeiMirror.pm
parent13c4334908d30c92e3c6954c21f47f2125e0a0ee (diff)
downloadpublic-inbox-0989c0bc6cbd6b3b0605a681034fc3203e0dcab9.tar.gz
This should ensure we display the "git config gitweb.owner
$OWNER" command invocation properly and also ensures we set the
description properly without triggering wide character warnings.

Also tested with a smallish iproute2 repo
(/pub/scm/linux/kernel/git/toke/iproute2.git) using my mirror:

  public-inbox-clone --remote-manifest=pub/manifest.js.gz \
    --include='*/toke/iproute2.git' --inbox-config=never \
    https://80x24.org/lore $DST

Anyways, I'm fairly certain this change and its tests are
correct; but I still struggle to understand Perl's approach to
Unicode and it's interactions with various JSON implementations.

Fixes: 0830817c132cb105 ("lei_mirror: show non-ASCII owner properly w/ --verbose")
Diffstat (limited to 'lib/PublicInbox/LeiMirror.pm')
-rw-r--r--lib/PublicInbox/LeiMirror.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 3ec8170f..18932cf4 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -259,8 +259,7 @@ sub run_reap {
 sub start_cmd {
         my ($self, $cmd, $opt, $fini) = @_;
         do_reap($self);
-        utf8::decode(my $msg = "# @$cmd");
-        $self->{lei}->qerr($msg);
+        $self->{lei}->qerr("# @$cmd");
         return if $self->{dry_run};
         $LIVE->{spawn($cmd, undef, $opt)} = [ \&reap_cmd, $self, $cmd, $fini ]
 }
@@ -633,7 +632,7 @@ sub clone_v1 {
         }
 
         my $d = $self->{-ent} ? $self->{-ent}->{description} : undef;
-        $self->{'txt.description'} = $d if defined $d;
+        utf8::encode($self->{'txt.description'} = $d) if defined $d;
         (!defined($d) && !$end) and
                 _get_txt_start($self, 'description', $fini);
 
@@ -823,6 +822,7 @@ sub update_ent {
         $new = $self->{-ent}->{owner} // return;
         $cur = $self->{-local_manifest}->{$key}->{owner} // "\0";
         return if $cur eq $new;
+        utf8::encode($new); # to octets
         my $cmd = [ qw(git config -f), "$dst/config", 'gitweb.owner', $new ];
         start_cmd($self, $cmd, { 2 => $self->{lei}->{2} });
 }