[GSoC PATCH v2 0/4] teach git repo info to handle path keys
- From
K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
- Date
- Jun 5, 2026, 16:30 UTC
- Message-ID
- <20260605163012.181089-1-jayatheerthkulkarni2005@gmail.com>
- In-Reply-To
- <20260601151950.30686-1-jayatheerthkulkarni2005@gmail.com>
Hi everyone,
This series teaches `git repo info` to handle `path.*` keys, so scripts can easily discover repository paths.
The commits are divided into 4 parts:
1. path: extract the path-formatting logic from rev-parse and
expose it via path.h with a better naming convention.
2. rev-parse: refactor the command to use the exported function
and enum.
3. repo: introduce path.gitdir with standardized tests and docs.
4. repo: introduce path.commondir.About patches 3 and 4: In our last discussion [1], we didn't reach a definitive conclusion about paths in repo info, but based on the feedback, explicitly offering both relative and absolute options made the most sense. So, patches 3 and 4 add both `path.<field>.absolute` and `path.<field>.relative` for `gitdir` and `commondir`.
There are still a few open questions. Tagging Justin, Lucas, Junio, Phillip, brian, and Ayush.
Questions:
1. Should there still be a --path-format flag?
2. Should we consider a default option?
Currently we have path.gitdir.absolute. Should we consider an
option where a plain `path.gitdir` returns some default?
If yes:
2.1 Should we keep the default the same as rev-parse? Or should
either relative or absolute be the default?
2.2 When printing using --all, should the default be printed,
or should we print both absolute and relative?
3. Is printing both absolute and relative in a single call using
--all acceptable? If no, what's a better approach?I have discussed these changes with both Justin and Lucas internally and wanted to gather opinions from the wider community before moving forward.
Changes since v1:
* Lucas's feedback: Added corner cases covering GIT_COMMON_DIR and GIT_DIR. Parameterized the test helper fields instead of hardcoding them. Also fixed the subject prefix to [GSoC PATCH v2].
* Junio's feedback: Added a clearer description of what the series does up front. I also realized the commit messages for patches 3 and 4 explained the "what" and not the "why", so I have (hopefully) improved them :)
* Phillip's feedback: Changed the helper function name and combined the two enums into one, which made a lot of sense.
I have also added comments within the path.h files to document the API.
* About lexicographical order: "Breaking" wasn't the right term before, but I do believe keeping .absolute and .relative as suffixes is a better choice. I prefer having the two choices side-by-side grouped by entity, rather than a cluster of absolute keys followed by relative ones. Open to hearing if the latter is preferred!
Thanks for this round of feedback guys, this has been fruitful!
P.S - I realized that I didn't add the link to Lucas's patch thread last time :) sorry bout that!
[1] https://public-inbox.org/git/041DCF2E-75FB-4B0A-9128-FDBB1A6DAC3C@gmail.com/T/#t
K Jayatheerth (4): path: introduce format_path() for centralized path formatting rev-parse: use format_path for path formatting repo: add path.gitdir with absolute and relative suffix formatting repo: add path.commondir with absolute and relative suffix formatting
Documentation/git-repo.adoc | 15 ++++++ builtin/repo.c | 50 +++++++++++++++++ builtin/rev-parse.c | 103 ++++++++---------------------------- path.c | 58 ++++++++++++++++++++ path.h | 30 +++++++++++ t/t1900-repo-info.sh | 40 ++++++++++++++ 6 files changed, 216 insertions(+), 80 deletions(-)
-- 2.54.0