Subject: Re: [PATCH v2 2/7] string-list: align string_list_split() with its _in_place() counterpart

From: shejialuo <[email-masked]>
Date: Fri, 1 Aug 2025 10:33:25 +0800

On Thu, Jul 31, 2025 at 03:46:01PM -0700, Junio C Hamano wrote:
> diff --git a/setup.c b/setup.c
> index 6f52dab64c..b9f5eb8b51 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -1460,8 +1460,9 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
>  
>  	if (env_ceiling_dirs) {
>  		int empty_entry_found = 0;
> +		static const char path_sep[] = { PATH_SEP, '\0' };
>  

I am a little confused why we need to use `static`? Would this function
be called many times?

And I have a design question: by using "PATH_SEP", we need to convert
this character to be string. Should we create a new variable named
"PATH_SEP_STR" or whatever to do that?

> -		string_list_split(&ceiling_dirs, env_ceiling_dirs, PATH_SEP, -1);
> +		string_list_split(&ceiling_dirs, env_ceiling_dirs, path_sep, -1);
>  		filter_string_list(&ceiling_dirs, 0,
>  				   canonicalize_ceiling_entry, &empty_entry_found);
>  		ceil_offset = longest_ancestor_length(dir->buf, &ceiling_dirs);

Thanks,
Jialuo