git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/7] remote-helpers: allow requesing the path to the .git directory

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Mar 29, 2010, 16:48 UTC
Message-ID
<1269881309-19690-5-git-send-email-srabbelier@gmail.com>
In-Reply-To
<1269881309-19690-1-git-send-email-srabbelier@gmail.com>

The 'gitdir' capability is reported by the remote helper if it requires the location of the .git directory. The location of the .git directory can then be used by the helper to store status files even when the current directory is not a git repository (such as is the case when cloning).

The location of the .git dir is specified as an absolute path.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
	This should probably be advertised as a required capability,
	but I haven't looked into those yet.
 transport-helper.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index 2638781..c8705b7 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -170,6 +170,11 @@ static struct child_process *get_helper(struct transport *transport)
 			refspecs[refspec_nr++] = strdup(buf.buf + strlen("refspec "));
 		} else if (!strcmp(capname, "connect")) {
 			data->connect = 1;
+		} else if (!strcmp(buf.buf, "gitdir")) {
+			struct strbuf gitdir = STRBUF_INIT;
+			strbuf_addf(&gitdir, "gitdir %s\n", get_git_dir());
+			sendline(data, &gitdir);
+			strbuf_release(&gitdir);
 		} else if (mandatory) {
 			die("Unknown mandatory capability %s. This remote "
 			    "helper probably needs newer version of Git.\n",
-- 
1.7.0.3.317.gbb04ec
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 5 of 14 in “remote-helpers: exporting”
  1. 0/7 remote-helpers: exportingSverre Rabbelier, Mar 29, 2010
  2. 1/7 clone: pass the remote name to remote_getSverre Rabbelier, Mar 29, 2010
  3. 2/7 clone: also configure url for bare clonesSverre Rabbelier, Mar 29, 2010
  4. 3/7 fast-import: always create marks_file directoriesSverre Rabbelier, Mar 29, 2010
  5. 4/7 remote-helpers: allow requesing the path to the .git directorySverre Rabbelier, Mar 29, 2010
  6. 5/7 remote-helpers: add support for an export commandSverre Rabbelier, Mar 29, 2010
  7. Daniel BarkalowMar 29, 2010
  8. Sverre RabbelierMar 29, 2010
  9. Junio C HamanoApr 1, 2010
  10. Sverre RabbelierApr 1, 2010
  11. 6/7 remote-helpers: add testgit helperSverre Rabbelier, Mar 29, 2010
  12. 7/7 remote-helpers: add tests for testgit helperSverre Rabbelier, Mar 29, 2010
  13. Jonathan NiederApr 12, 2010
  14. Sverre RabbelierApr 12, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.