public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: jayesh0104 <jayeshdaga99@gmail.com>
To: git@vger.kernel.org
Cc: jayesh0104 <jayeshdaga99@gmail.com>
Subject: [PATCH] repo-info: add paths.git_dir field
Date: Fri,  6 Mar 2026 16:18:22 +0000	[thread overview]
Message-ID: <20260306161822.328127-1-jayeshdaga99@gmail.com> (raw)

Expose the repository's Git directory path through `git repo info`.

This value is currently available via:

    git rev-parse --git-dir

Adding it to `git repo info` allows scripts to retrieve it
through a structured interface.

Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>
---
 builtin/repo.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/builtin/repo.c b/builtin/repo.c
index f943be7451..7535192878 100644
--- a/builtin/repo.c
+++ b/builtin/repo.c
@@ -61,12 +61,17 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
 		      ref_storage_format_to_name(repo->ref_storage_format));
 	return 0;
 }
-
+static int get_paths_git_dir(struct repository *repo, struct strbuf *buf)
+{
+	strbuf_addstr(buf, repo_get_git_dir(repo));
+	return 0;
+}
 /* repo_info_field keys must be in lexicographical order */
 static const struct repo_info_field repo_info_field[] = {
 	{ "layout.bare", get_layout_bare },
 	{ "layout.shallow", get_layout_shallow },
 	{ "object.format", get_object_format },
+	{ "paths.git_dir", get_paths_git_dir },
 	{ "references.format", get_references_format },
 };
 
-- 
2.43.0


                 reply	other threads:[~2026-03-06 16:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260306161822.328127-1-jayeshdaga99@gmail.com \
    --to=jayeshdaga99@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox