git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] [GSOC] ref-filter: add %(raw) atom

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
May 30, 2021, 13:02 UTC
Message-ID
<c56734ba-c819-ccfe-f255-6cc890f6feef@gmail.com>
In-Reply-To
<CAOLTT8QmByyue25YLTa2-=oQ00K5Cs_eoSD3_y6wRYYToa=oxQ@mail.gmail.com>
Hi ZheNing
On 30/05/2021 07:26, ZheNing Hu wrote:
Show 29 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> 于2021年5月29日周六 下午9:23写道:
>>
>> On 27/05/2021 17:36, Felipe Contreras wrote:
>>> ZheNing Hu via GitGitGadget wrote:
>>> [...]
>>> All we have to do is define the end point, and then we don't need i:
>>>
>>>        static int memcasecmp(const char *s1, const char *s2, size_t n)
>>>        {
>>>                const char *end = s1 + n;
>>>                for (; s1 < end; s1++, s2++) {
>>>                        int diff = tolower(*s1) - tolower(*s2);
>>>                        if (diff)
>>>                                return diff;
>>>                }
>>>                return 0;
>>>        }
>>>
>>> (and I personally prefer lower to upper)
>>
>> We should be using tolower() as that is what POSIX specifies for
>> strcasecmp() [1] which we are trying to emulate and there are cases[2] where
>>          (tolower(c1) == tolower(c2)) != (toupper(c1) == toupper(c2))
>>
> 
> I don’t know if we overlooked a fact: This static `memcasecmp()`
> is not a POSIX version. `tolower()` or `toupper()` are in git-compat-util.h,
> sane_istest('\0', GIT_ALPHA) == false . So in `sane_case()`, whatever
> `tolower()`, `toupper()`, they just return '\0' itself.

Well spotted, thanks for pointing that out. So memcasecmp() and strcasecmp() may give different results. I'm not sure if that matters - as I understand it the main use for the 'raw' atom is with `git cat-file --batch` which does not support sorting. Also although strcasecmp() uses the current locale it does a byte-by-byte comparison so it is effectively ASCII only for UTF-8 anyway.

Best Wishes
Phillip
Show 12 quoted lines
>> Best Wishes
>>
>> Phillip
>>
>> [1] https://pubs.opengroup.org/onlinepubs/9699919799/
>> [2] https://en.wikipedia.org/wiki/Dotted_and_dotless_I#In_computing
>>
> 
> Thanks.
> --
> ZhenNing Hu
> 
Previous: ZheNing HuNext: Junio C Hamano
Message 15 of 41 in “[GSOC] ref-filter: add %(raw) atom”
  1. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 27, 2021
  2. 1/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 27, 2021
  3. Felipe ContrerasMay 27, 2021
  4. ZheNing HuMay 28, 2021
  5. Felipe ContrerasMay 28, 2021
  6. ZheNing HuMay 30, 2021
  7. Phillip WoodMay 29, 2021
  8. Felipe ContrerasMay 29, 2021
  9. Phillip WoodMay 29, 2021
  10. ZheNing HuMay 30, 2021
  11. Phillip WoodMay 30, 2021
  12. ZheNing HuMay 31, 2021
  13. Felipe ContrerasMay 31, 2021
  14. ZheNing HuMay 30, 2021
  15. Phillip WoodMay 30, 2021
  16. Junio C HamanoMay 28, 2021
  17. ZheNing HuMay 28, 2021
  18. Felipe ContrerasMay 28, 2021
  19. ZheNing HuMay 30, 2021
  20. 2/2 [GSOC] ref-filter: add %(header) atomZheNing Hu via GitGitGadget, May 27, 2021
  21. Felipe ContrerasMay 27, 2021
  22. Junio C HamanoMay 28, 2021
  23. Junio C HamanoMay 28, 2021
  24. ZheNing HuMay 28, 2021
  25. Felipe ContrerasMay 27, 2021
  26. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 30, 2021
  27. 1/2 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, May 30, 2021
  28. Junio C HamanoMay 31, 2021
  29. 2/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 30, 2021
  30. Junio C HamanoMay 31, 2021
  31. ZheNing HuMay 31, 2021
  32. Junio C HamanoJun 1, 2021
  33. ZheNing HuJun 1, 2021
  34. Junio C HamanoMay 31, 2021
  35. ZheNing HuMay 31, 2021
  36. Junio C HamanoJun 1, 2021
  37. ZheNing HuJun 1, 2021
  38. Johannes SchindelinJun 1, 2021
  39. Junio C HamanoMay 31, 2021
  40. Felipe ContrerasMay 31, 2021
  41. ZheNing HuJun 1, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.