* [PATCH 2/6] another step towards git SHA-256 support
2022-10-20 8:43 6% [PATCH 0/6] trivial clone|fetch-related stuff Eric Wong
@ 2022-10-20 8:43 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-10-20 8:43 UTC (permalink / raw)
To: meta
While SHA-256 isn't supported for inboxes, yet
xt/git-http-backend.t now runs properly against a SHA-256 code
repository
---
lib/PublicInbox/GitHTTPBackend.pm | 12 +++++-------
t/git.t | 4 ++--
t/import.t | 4 ++--
t/mda.t | 4 ++--
xt/git-http-backend.t | 4 ++--
5 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 3aae5454..72b8e6c3 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -23,10 +23,8 @@ my @text = qw[HEAD info/refs info/attributes
objects/info/(?:http-alternates|alternates|packs)
cloneurl description];
-my @binary = qw!
- objects/[a-f0-9]{2}/[a-f0-9]{38}
- objects/pack/pack-[a-f0-9]{40}\.(?:pack|idx)
- !;
+my @binary = ('objects/[a-f0-9]{2}/[a-f0-9]{38,62}',
+ 'objects/pack/pack-[a-f0-9]{40,64}\.(?:pack|idx)');
our $ANY = join('|', @binary, @text, 'git-upload-pack');
my $BIN = join('|', @binary);
@@ -62,13 +60,13 @@ sub serve_dumb {
my $h = [];
my $type;
- if ($path =~ m!\Aobjects/[a-f0-9]{2}/[a-f0-9]{38}\z!) {
+ if ($path =~ m!\Aobjects/[a-f0-9]{2}/[a-f0-9]{38,62}\z!) {
$type = 'application/x-git-loose-object';
cache_one_year($h);
- } elsif ($path =~ m!\Aobjects/pack/pack-[a-f0-9]{40}\.pack\z!) {
+ } elsif ($path =~ m!\Aobjects/pack/pack-[a-f0-9]{40,64}\.pack\z!) {
$type = 'application/x-git-packed-objects';
cache_one_year($h);
- } elsif ($path =~ m!\Aobjects/pack/pack-[a-f0-9]{40}\.idx\z!) {
+ } elsif ($path =~ m!\Aobjects/pack/pack-[a-f0-9]{40,64}\.idx\z!) {
$type = 'application/x-git-packed-objects-toc';
cache_one_year($h);
} elsif ($path =~ /\A(?:$TEXT)\z/o) {
diff --git a/t/git.t b/t/git.t
index 56fc8d95..d8957e42 100644
--- a/t/git.t
+++ b/t/git.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use Test::More;
@@ -44,7 +44,7 @@ use PublicInbox::Git;
my $f = 'HEAD:foo.txt';
my @x = $gcf->check($f);
is(scalar @x, 3, 'returned 3 element array for existing file');
- like($x[0], qr/\A[a-f0-9]{40}\z/, 'returns obj ID in 1st element');
+ like($x[0], qr/\A[a-f0-9]{40,64}\z/, 'returns obj ID in 1st element');
is('blob', $x[1], 'returns obj type in 2nd element');
like($x[2], qr/\A\d+\z/, 'returns obj size in 3rd element');
diff --git a/t/import.t b/t/import.t
index ae76858b..4ba74022 100644
--- a/t/import.t
+++ b/t/import.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
@@ -30,7 +30,7 @@ my $smsg = bless {}, 'PublicInbox::Smsg' if $v2;
like($im->add($mime, undef, $smsg), qr/\A:[0-9]+\z/, 'added one message');
if ($v2) {
- like($smsg->{blob}, qr/\A[a-f0-9]{40}\z/, 'got last object_id');
+ like($smsg->{blob}, qr/\A[a-f0-9]{40,64}\z/, 'got last object_id');
my @cmd = ('git', "--git-dir=$git->{git_dir}", qw(hash-object --stdin));
open my $in, '+<', undef or BAIL_OUT "open(+<): $!";
print $in $mime->as_string or die "write failed: $!";
diff --git a/t/mda.t b/t/mda.t
index d20cdb92..e3c5cdff 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
@@ -97,7 +97,7 @@ EOF
local $ENV{PATH} = $main_path;
ok(run_script(['-mda'], undef, { 0 => \$in }));
my $rev = $git->qx(qw(rev-list HEAD));
- like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
+ like($rev, qr/\A[a-f0-9]{40,64}/, "good revision committed");
chomp $rev;
my $cmt = $git->cat_file($rev);
like($$cmt, qr/^author Me <me\@example\.com> 0 \+0000\n/m,
diff --git a/xt/git-http-backend.t b/xt/git-http-backend.t
index adadebb0..1f3ba063 100644
--- a/xt/git-http-backend.t
+++ b/xt/git-http-backend.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
# Ensure buffering behavior in -httpd doesn't cause runaway memory use
@@ -53,7 +53,7 @@ SKIP: {
}
}
skip "no packs found in $git_dir" unless defined $pack;
- if ($pack !~ m!(/objects/pack/pack-[a-f0-9]{40}.pack)\z!) {
+ if ($pack !~ m!(/objects/pack/pack-[a-f0-9]{40,64}.pack)\z!) {
skip "bad pack name: $pack";
}
my $url = $1;
^ permalink raw reply related [relevance 7%]
* [PATCH 0/6] trivial clone|fetch-related stuff
@ 2022-10-20 8:43 6% Eric Wong
2022-10-20 8:43 7% ` [PATCH 2/6] another step towards git SHA-256 support Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-10-20 8:43 UTC (permalink / raw)
To: meta
Much bigger, barely-tested changes in the pipeline to support
cloning + updating multi-inbox mirrors (without unnecessary
sleeps and delays[1]). Here's some trivial stuff first.
Of course, I have a SHA-256 coderepo somewhere, so more
tweaks on that front.
4/6 is the only user-visible change, but hopefully nobody
is parsing stderr.
Eric Wong (6):
clone|fetch: preserve mtime of modified manifest.js.gz
another step towards git SHA-256 support
githttpbackend: remove unused $BIN variable
treewide: replace /^I: / prefix with /^# /
lei_mirror: make _finish_add_external call more obvious
lei_mirror: delimit names by `\n' to improve die message
examples/grok-pull.post_update_hook.sh | 2 +-
lib/PublicInbox/ExtSearchIdx.pm | 26 ++++++++++++--------------
lib/PublicInbox/Fetch.pm | 2 ++
lib/PublicInbox/Gcf2.pm | 4 ++--
lib/PublicInbox/GitHTTPBackend.pm | 13 +++++--------
lib/PublicInbox/InboxIdle.pm | 8 +++-----
lib/PublicInbox/LeiMirror.pm | 5 ++++-
lib/PublicInbox/MiscIdx.pm | 2 +-
lib/PublicInbox/OverIdx.pm | 6 +++---
lib/PublicInbox/Watch.pm | 4 ++--
script/public-inbox-watch | 6 +++---
t/extsearch.t | 6 +++---
t/git.t | 4 ++--
t/imapd.t | 6 +++---
t/import.t | 4 ++--
t/mda.t | 4 ++--
xt/git-http-backend.t | 4 ++--
17 files changed, 52 insertions(+), 54 deletions(-)
[1] grokmirror seems to sleep a bit more than it should:
https://lore.kernel.org/tools/20211013110344.GA10632@dcvr/
(And I probably have dain-bramage from insomnia :<)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-10-20 8:43 6% [PATCH 0/6] trivial clone|fetch-related stuff Eric Wong
2022-10-20 8:43 7% ` [PATCH 2/6] another step towards git SHA-256 support 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).