Re: [PATCH v3 5/8] environment: move "precomposed_unicode" into `struct repo_config_values`
- From
Tian Yuchen <cat@malon.dev>
- Date
- May 15, 2026, 17:15 UTC
- Message-ID
- <f4aa8cac-232a-440e-ae12-5e76c799a110@malon.dev>
- In-Reply-To
- <20260423165432.143598-6-belkid98@gmail.com>
On 4/24/26 00:54, Olamide Caleb Bello wrote:
Show 8 quoted lines
> struct dirent_prec_psx *precompose_utf8_readdir(PREC_DIR *prec_dir)
> {
> + struct repo_config_values *cfg = repo_config_values(the_repository);
> struct dirent *res;
> +
> res = readdir(prec_dir->dirp);
> if (res) {
> size_t namelenz = strlen(res->d_name) + 1; /* \0 */This 'precompose_utf8_readdir()' appears to be a wrapper for 'readdir()', so that Git thinks it is calling a standard POSIX function. Looking at it this way, I feel the architectural design here is a bit ambiguous. I think the role of 'readdir()' (or its wrapper) should be: "You give me a directory handle, and I give you a file entry". Conceptually, it shouldn’t even be related to Git: you can take a look at the rest of code of this wrapper.
Since there is a wrapper for 'readdir()', there must also be one for 'opendir()'. To me, initializing a flag like 'perform_precompose' when the PREC_DIR handle is created in 'opendir()' , and pass it down through the handle looks a bit more optimal. In other words, If one of them has to handle the repo pointer, I think it would be better to leave that to 'opendir()' ;)
Good night, yuchen