]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: drop needless checks for old git
authorEric Wong <e@80x24.org>
Thu, 26 Jan 2023 09:32:57 +0000 (09:32 +0000)
committerEric Wong <e@80x24.org>
Fri, 27 Jan 2023 08:19:17 +0000 (08:19 +0000)
`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

index 70adfd4522bd1f0624352173dbb039f95ceef154..3e2b435c923b57db78848f8d9b88919241e44466 100644 (file)
@@ -340,11 +340,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;
        }
@@ -419,12 +417,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);
 }