{"thread":{"id":"65154","subject":"[PATCH] repo-info: add paths.git_dir field","startedAt":"2026-03-06T16:19:34Z","lastAt":"2026-03-06T16:19:34Z","messageCount":1,"participants":["jayesh0104"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"538091","messageId":"20260306161822.328127-1-jayeshdaga99@gmail.com","threadId":"65154","inReplyTo":null,"subject":"[PATCH] repo-info: add paths.git_dir field","fromName":"jayesh0104","fromEmail":"jayeshdaga99@gmail.com","sentAt":"2026-03-06T16:18:22Z","receivedAt":"2026-03-06T16:19:34Z","isPatch":true,"sender":{"key":"jayeshdaga99@gmail.com","avatar":"https://avatars.githubusercontent.com/u/86013121?v=4"},"body":"Expose the repository's Git directory path through `git repo info`.\n\nThis value is currently available via:\n\n    git rev-parse --git-dir\n\nAdding it to `git repo info` allows scripts to retrieve it\nthrough a structured interface.\n\nSigned-off-by: Jayesh Daga <jayeshdaga99@gmail.com>\n---\n builtin/repo.c | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex f943be7451..7535192878 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -61,12 +61,17 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)\n \t\t      ref_storage_format_to_name(repo->ref_storage_format));\n \treturn 0;\n }\n-\n+static int get_paths_git_dir(struct repository *repo, struct strbuf *buf)\n+{\n+\tstrbuf_addstr(buf, repo_get_git_dir(repo));\n+\treturn 0;\n+}\n /* repo_info_field keys must be in lexicographical order */\n static const struct repo_info_field repo_info_field[] = {\n \t{ \"layout.bare\", get_layout_bare },\n \t{ \"layout.shallow\", get_layout_shallow },\n \t{ \"object.format\", get_object_format },\n+\t{ \"paths.git_dir\", get_paths_git_dir },\n \t{ \"references.format\", get_references_format },\n };\n \n-- \n2.43.0\n\n"}]}