From 39b99c2514230f419fae8c2b52a7d55eaad1cd44 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 7 Apr 2023 12:40:51 +0000 Subject: umask: rely on the OnDestroy-based call where applicable This lets us get rid of some awkwardness around the old API and single-use subroutines while saving us some LoC. --- script/public-inbox-convert | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'script') diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 750adca4..96931cbf 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -89,7 +89,8 @@ sub link_or_copy ($$) { File::Copy::cp($src, $dst) or die "cp $src, $dst failed: $!\n"; } -$old->with_umask(sub { +{ + my $restore = $old->with_umask; my $old_cfg = "$old->{inboxdir}/config"; local $ENV{GIT_CONFIG} = $old_cfg; my $new_cfg = "$new->{inboxdir}/all.git/config"; @@ -110,12 +111,10 @@ $old->with_umask(sub { my $desc = "$old->{inboxdir}/description"; link_or_copy($desc, "$new->{inboxdir}/description") if -e $desc; my $clone = "$old->{inboxdir}/cloneurl"; - if (-e $clone) { - warn <<""; + warn <<"" if -e $clone; $clone may not be valid after migrating to v2, not copying - } -}); +} my $state = ''; my $head = $old->{ref_head} || 'HEAD'; my ($rd, $pid) = $old->git->popen(qw(fast-export --use-done-feature), $head); -- cgit v1.2.3-24-ge0c7