Re: [RFC] git repo info: exposing repository paths
- From
Pushkar Singh <pushkarkumarsingh1970@gmail.com>
- Date
- Feb 18, 2026, 18:35 UTC
- Message-ID
- <20260218183511.17195-1-pushkarkumarsingh1970@gmail.com>
- In-Reply-To
- <aYxzmjoxQHccqTAl@pks.im>
Hi,
On Wed, Feb 11, 2026 at 01:18:34PM +0100, Patrick Steinhardt wrote:
> git-rev-parse(1) has been growing functionality over time that > simply doesn't have anything to do with revisions, so I think it's good > to give such functionality a new home in git-repo(1).
I spent some time going through the initial git-repo implementation thread [1], as well as Lucas's recent WIP series [2] adding "--format=default" and "--keys" support to "git repo info".
Looking at the current implementation, it seems that adding new values is primarily done by extending repo_info_fields[]. With the recent "--keys" support in place, that mechanism feels like the natural place to expose additional repository metadata.
In that direction, I would like to explore extending the existing "path.*" namespace with a few additional stable repository paths that are currently obtained through "git rev-parse", namely:
- path.git-dir - path.common-dir - path.objects-dir
These correspond to well-defined repository state and are already available via helpers such as repo_get_git_dir() and repo_get_common_dir(). The idea would be to add them as new entries in repo_info_fields[], reusing the existing output handling, without introducing new flags or changing the current structure.
For now, I am intentionally avoiding invocation-dependent values such as "git-prefix" or "is-inside-work-tree", and focusing only on paths derived directly from the repository instance.
Regarding relative versus absolute semantics, I would follow the direction of the ongoing "--path-format" discussion and align with whatever default behavior is agreed upon there.
If this sounds reasonable, I can prototype support for "path.git-dir" and "path.common-dir" first as a minimal step and continue the discussion based on that.
Thanks, Pushkar
[1] Initial git-repo introduction thread: https://public-inbox.org/git/20250610152117.14826-1-lucasseikioshiro@gmail.com/t/#u
[2] repo: add --format=default and --keys series: https://lore.kernel.org/git/aZLARuSCuy8wYLUA@pks.im/T/#u