unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20230126093257.1058494-3-e@80x24.org> (raw)
In-Reply-To: <20230126093257.1058494-1-e@80x24.org>

`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);
 }
 

      parent reply	other threads:[~2023-01-26  9:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26  9:32 [PATCH 0/2] use `git cat-file --batch-command' if available Eric Wong
2023-01-26  9:32 ` [PATCH 1/2] git: use --batch-command in git 2.36+ to save processes Eric Wong
2023-01-27  8:14   ` Eric Wong
2023-01-27  8:17     ` Eric Wong
2023-02-09  1:29   ` Eric Wong
2023-02-20  8:19     ` [PATCH] git_async_cat: don't mis-abort replaced process Eric Wong
2023-01-26  9:32 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230126093257.1058494-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).