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.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 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 8F3D81FD55 for ; Sat, 11 Jan 2020 22:35:04 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/9] solver: path_a may be undef from /dev/null Date: Sat, 11 Jan 2020 22:34:58 +0000 Message-Id: <20200111223503.24473-5-e@yhbt.net> In-Reply-To: <20200111223503.24473-1-e@yhbt.net> References: <20200111223503.24473-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This avoids uninitialized variable warnings when viewing newly-created files. --- lib/PublicInbox/SolverGit.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 8629f0da..62c925d4 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -169,7 +169,7 @@ sub extract_diff ($$) { my $patch = $9; # don't care for leading 'a/' and 'b/' - my (undef, @a) = split(m{/}, git_unquote($path_a)); + my (undef, @a) = split(m{/}, git_unquote($path_a)) if defined($path_a); my (undef, @b) = split(m{/}, git_unquote($path_b)); # get rid of path-traversal attempts and junk patches: @@ -177,7 +177,7 @@ sub extract_diff ($$) { state $bad_component = { map { $_ => 1 } ('', '.', '..') }; foreach (@a, @b) { return if $bad_component->{$_} } - $di->{path_a} = join('/', @a); + $di->{path_a} = join('/', @a) if @a; $di->{path_b} = join('/', @b); my $path = ++$self->{tot};