Re: [GSoC][PATCH 1/1] t1050: clean up checks for file existence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux