Subject: Re: [PATCH v4 02/10] repo: add path keys to repo info

From: Phillip Wood <[email-masked]>
Date: Fri, 27 Feb 2026 09:04:04 +0000

Hi Eslam

On 26/02/2026 21:14, Eslam reda ragheb via GitGitGadget wrote:
> From: Eslam reda ragheb <[email-masked]>
> 
> Add a path category to git repo info with key-value pairs that
> mirror repository paths users commonly retrieve via rev-parse and
> git-path lookups.

I think that makes sense, I'm not sure about some of the paths though, 
see below.

> This makes scripting against repo metadata more direct and avoids
> shelling out to multiple commands for related paths.

You can get more than one path at a time from "git rev-parse" so I'm not 
sure what this is saying.

It would be helpful to include the tests and Documentation for the new 
keys in this patch.

> The new keys are introduced as explicit path.* entries in
> repo_info_fields and are resolved through dedicated helpers.
> 
> This keeps lookup behavior predictable and makes future path
> additions straightforward.
> 
> Signed-off-by: Eslam reda ragheb <[email-masked]>
> ---

> @@ -74,6 +197,20 @@ static const struct field repo_info_fields[] = {
>   	{ "layout.bare", get_layout_bare },
>   	{ "layout.shallow", get_layout_shallow },
>   	{ "object.format", get_object_format },
> +	{ "path.common-dir", get_path_common_dir },
> +	{ "path.config-file", get_path_config_file },
> +	{ "path.git-dir", get_path_git_dir },
> +	{ "path.git-prefix", get_path_git_prefix },

I'm not sure about calling this 'git-prefix', 'prefix' might be more 
appropriate as it is about prefixing paths in the worktree rather than 
the git_dir.

> +	{ "path.grafts-file", get_path_grafts_file },
> +	{ "path.hooks-directory", get_path_hooks_directory },
> +	{ "path.index-file", get_path_index_file },
> +	{ "path.logs-directory", get_path_logs_directory },

We're moving away from file based refs and reflogs so I'm not sure 
adding this, pick-refs-file or refs-directory is a good idea as we 
should not be encouraging people to access these files directly.

> +	{ "path.objects-directory", get_path_objects_directory },
> +	{ "path.packed-refs-file", get_path_packed_refs_file },
> +	{ "path.refs-directory", get_path_refs_directory },
> +	{ "path.shallow-file", get_path_shallow_file },
> +	{ "path.superproject-working-tree", get_path_superproject_working_tree },
> +	{ "path.toplevel", get_path_toplevel },

'path.toplevel' matches the git-rev-parse option but 'path.work-tree' 
might be more descriptive?

What happens if 'path.toplevel' is requested in a bare repository?

Thanks

Phillip

>   	{ "references.format", get_references_format },
>   };
>