From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 159EC1FA29 for ; Thu, 26 Jan 2023 09:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1674725580; bh=OvNlcIotn1BasJRSc8vdxMqL0/Q8egwNqilTcugsmqs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B5c4JALnXsuNtglEagxt4RF9AYuQceCNfyIujdpT8VJqneXQk5dNESt7YNeijuqWY ifiUctQ3vnI8sB2u8S2ZVPtH55gNOTCq2nPnhlO8iX3zEKujUas4miHTAZvoHsw8l7 dTW2kf/u1k6UqnjaBFxQfEO0cODGQbGgjOsktoNA= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] git: drop needless checks for old git Date: Thu, 26 Jan 2023 09:32:57 +0000 Message-Id: <20230126093257.1058494-3-e@80x24.org> In-Reply-To: <20230126093257.1058494-1-e@80x24.org> References: <20230126093257.1058494-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: `ambiguous' was added in git 2.21, and `dangling' was the only other possible phrase which was inadvertantly slipped in prior to 2.21. Thus there's no need to check for `notdir' or `loop' responses since we aren't using `git cat-file --follow-symlinks' anywhere. --- lib/PublicInbox/Git.pm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 63458ec6..1c77b4ce 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -330,11 +330,9 @@ sub check_async_step ($$) { chomp(my $line = my_readline($self->{in_c}, $rbuf)); my ($hex, $type, $size) = split(/ /, $line); - # Future versions of git.git may have type=ambiguous, but for now, - # we must handle 'dangling' below (and maybe some other oddball - # stuff): + # git <2.21 would show `dangling' (2.21+ shows `ambiguous') # https://public-inbox.org/git/20190118033845.s2vlrb3wd3m2jfzu@dcvr/T/ - if ($hex eq 'dangling' || $hex eq 'notdir' || $hex eq 'loop') { + if ($hex eq 'dangling') { my $ret = my_read($self->{in_c}, $rbuf, $type + 1); $self->fail(defined($ret) ? 'read EOF' : "read: $!") if !$ret; } @@ -409,12 +407,9 @@ sub check { check_async_wait($self); my ($hex, $type, $size) = @$result; - # Future versions of git.git may show 'ambiguous', but for now, - # we must handle 'dangling' below (and maybe some other oddball - # stuff): + # git <2.21 would show `dangling' (2.21+ shows `ambiguous') # https://public-inbox.org/git/20190118033845.s2vlrb3wd3m2jfzu@dcvr/T/ - return if $type eq 'missing' || $type eq 'ambiguous'; - return if $hex eq 'dangling' || $hex eq 'notdir' || $hex eq 'loop'; + return if $type =~ /\A(?:missing|ambiguous)\z/ || $hex eq 'dangling'; ($hex, $type, $size); }