git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Rasmus Jonsson <wasmus@zom.bi>, git@vger.kernel.org
Subject: Re: [GSoC][PATCH 1/1] t1050: clean up checks for file existence
Date: Sat, 22 Feb 2020 18:03:17 +0000	[thread overview]
Message-ID: <20200222180317.GF6462@camp.crustytoothpaste.net> (raw)
In-Reply-To: <xmqqtv3i5xhx.fsf@gitster-ct.c.googlers.com>

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

On 2020-02-22 at 17:43:06, Junio C Hamano wrote:
> > @@ -65,7 +66,7 @@ test_expect_success 'add a large file or two' '
> >  	test $cnt = 2 &&
> >  	for l in .git/objects/??/??????????????????????????????????????
> 
> It is totally an unrelated tangent, but brian, are the lines of this
> kind on your radar?  The object names in SHA-256 world would not be
> caught with the pattern right?  The fix probably belongs to next to
> where OID_REGEX is defined in test-lib.sh (this is a glob and not a
> regex, though).  Perhaps the original should have been written like
> 
> 	# somewhere in test-lib.sh
> 	HEXGLOB='[0-9a-f]'
> 	HEXGLOB38=$HEXGLOB$HEXGLOB$HEXGLOB$HEXGLOB$HEXGLOB$HEXGLOB ;# 6
> 	HEXGLOB38=$HEXGLOB38$HEXGLOB38$HEXGLOB38$HEXGLOB38$HEXGLOB38$HEXGLOB38 ;# 36
> 	HEXGLOB38=$HEXGLOB$HEXGLOB$HEXGLOB38
> 
> 	OBJFANOUTGLOB=$HEXGLOB$HEXGLOB
> 	OBJFILEGLOB=$HEXGLOB38
> 
> 	...
> 
> 	for l in .git/objects/$OBJFANOUTGLOB/$OBJFILEGLOB
> 
> and then SHA-256 series would just update OBJFANOUTGLOB and
> OBJFILEGLOB patterns, or something like that?

I actually just saw that particular file the other day, but had not yet
written a patch.  I think we could write a pattern for that which would
be useful.

We do have test_oid_to_path, which takes an object ID and inserts a
slash after the first two characters, so we could do something like
this:

  for l in .git/objects/$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')

That's not very readable, though.  I'll try to find something a little
better, or hide it somewhere behind a variable in the test setup code
with a comment.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

  reply	other threads:[~2020-02-22 18:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22  7:13 [GSoC][PATCH 0/1] Introduction & microproject Rasmus Jonsson
2020-02-22  7:13 ` [GSoC][PATCH 1/1] t1050: clean up checks for file existence Rasmus Jonsson
2020-02-22 17:43   ` Junio C Hamano
2020-02-22 18:03     ` brian m. carlson [this message]
2020-02-22 17:50   ` Junio C Hamano
2020-02-24  6:03   ` Jeff King
2020-02-23  0:50 ` [GSoC][PATCH v2] t1050: replace test -f with test_path_is_file Rasmus Jonsson

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

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

  git send-email \
    --in-reply-to=20200222180317.GF6462@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=wasmus@zom.bi \
    /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 NNTP newsgroup(s).