* [PATCH 2/2] git: drop needless checks for old git
2023-01-26 9:32 4% [PATCH 0/2] use `git cat-file --batch-command' if available Eric Wong
@ 2023-01-26 9:32 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-01-26 9:32 UTC (permalink / raw)
To: meta
`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);
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/2] use `git cat-file --batch-command' if available
@ 2023-01-26 9:32 4% Eric Wong
2023-01-26 9:32 7% ` [PATCH 2/2] git: drop needless checks for old git Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-01-26 9:32 UTC (permalink / raw)
To: meta
This should reduce git processes needed to service solver
blob lookup/reconstruction requests.
Eric Wong (2):
git: use --batch-command in git 2.36+ to save processes
git: drop needless checks for old git
lib/PublicInbox/Git.pm | 153 +++++++++++++++++++++------------
lib/PublicInbox/GitAsyncCat.pm | 1 +
2 files changed, 98 insertions(+), 56 deletions(-)
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-01-26 9:32 4% [PATCH 0/2] use `git cat-file --batch-command' if available Eric Wong
2023-01-26 9:32 7% ` [PATCH 2/2] git: drop needless checks for old git Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).