Re: [PATCH v4 02/10] repo: add path keys to repo info
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Feb 27, 2026, 09:04 UTC
- Message-ID
- <3c4d4909-4eb1-47f4-b601-8f877a07ddd5@gmail.com>
- In-Reply-To
- <6d5b9ff07566e1cc28a672cf1f47988e9c8c45da.1772140487.git.gitgitgadget@gmail.com>
Hi Eslam
On 26/02/2026 21:14, Eslam reda ragheb via GitGitGadget wrote:
Show 5 quoted lines
> From: Eslam reda ragheb <eslam.reda.div@gmail.com> > > 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.
Show 8 quoted lines
> 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 <eslam.reda.div@gmail.com> > ---
Show 8 quoted lines
> @@ -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.
Show 6 quoted lines
> + { "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 },
> };
>