Subject: Re: [PATCH v6 14/16] refs/iterator: implement seeking for packed-ref iterators

From: shejialuo <[email-masked]>
Date: Fri, 4 Apr 2025 15:18:12 +0800

On Thu, Apr 03, 2025 at 10:18:31PM +0000, brian m. carlson wrote:
> On 2025-04-03 at 19:56:39, Elijah Newren wrote:
> > In this case, the utf-8 characters will have individual bytes whose
> > values are greater than 127, which for a signed character will be
> > represented by a negative number.  I tried tweaking the loop to:
> > 

That's good catch.

> >         while (prefix && *prefix) {
> >             if ((unsigned char)*refname < (unsigned char)*prefix) {
> >                 printf("Comparing %d to %d\n",
> >                        *refname, *prefix);
> >                 printf("Comparing %s to %s\n",
> >                        refname, prefix);
> >                 BUG("packed-refs backend yielded reference preceding
> > its prefix");
> 
> I was mentioning this to Elijah earlier, but I think we might want to
> use more emojis in testing things like refs and other text patterns in
> our testsuite.  Because most of them are in astral planes, that will
> help us exercise our UTF-8 and UTF-16 surrogate handling, which is also
> relevant to a variety of languages, like Chinese, which we obviously
> want to support but which contributors may be less familiar with.  Since
> emoji are more universal, it's easier for anyone to add a test for these
> kinds of cases and we might be able to catch some of these kinds of
> things earlier.
> 

I somehow feel strange that people would like to use emoji(unicode) for
ref name, because if the user doesn't install the corresponding iconic
font, the user cannot see anything meaningful.

Anyway, we may create unicode ref name or commit message to improve test
coverage.

> That's in addition to the fact that many people use emojis in things
> like commit messages because they're fun and we want to make those work.
> 
> Next time I'm sending patches, I'll endeavour to cover a wider variety
> of codepoints in my testing.
> -- 
> brian m. carlson (they/them)
> Toronto, Ontario, CA

Thanks,
Jialuo