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

[PATCH v3 10/12] Allow helpers to request the path to the .git directory

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Nov 6, 2009, 22:52 UTC
Message-ID
<1257547966-14603-11-git-send-email-srabbelier@gmail.com>
In-Reply-To
<1257547966-14603-10-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>
---
	Rebased, but otherwise unchanged.
	Needs to be updated when we decide on a proper location for
	the helper specific info.
 transport-helper.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index d38dedf..7ea76fd 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -64,6 +64,12 @@ static struct child_process *get_helper(struct transport *transport)
 				   refspec_alloc);
 			refspecs[refspec_nr++] = strdup(buf.buf + strlen("refspec "));
 		}
+		if (!strcmp(buf.buf, "gitdir")) {
+			struct strbuf gitdir = STRBUF_INIT;
+			strbuf_addf(&gitdir, "gitdir %s\n", get_git_dir());
+			write_in_full(helper->in, gitdir.buf, gitdir.len);
+			strbuf_reset(&gitdir);
+		}
 	}
 	if (refspecs) {
 		data->refspec_nr = refspec_nr;
-- 
1.6.5.2.158.g6dacb
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 11 of 22 in “Reroll of the remote-vcs-helper series”
  1. 00/12 Reroll of the remote-vcs-helper seriesSverre Rabbelier, Nov 6, 2009
  2. 01/12 Fix memory leak in helper method for disconnectSverre Rabbelier, Nov 6, 2009
  3. 02/12 Allow programs to not depend on remotes having urlsSverre Rabbelier, Nov 6, 2009
  4. 03/12 Use a function to determine whether a remote is validSverre Rabbelier, Nov 6, 2009
  5. 04/12 Allow fetch to modify refsSverre Rabbelier, Nov 6, 2009
  6. 05/12 Add a config option for remotes to specify a foreign vcsSverre Rabbelier, Nov 6, 2009
  7. 06/12 Allow specifying the remote helper in the urlSverre Rabbelier, Nov 6, 2009
  8. 07/12 Add support for "import" helper commandSverre Rabbelier, Nov 6, 2009
  9. 08/12 Allow helper to map private ref names into normal namesSverre Rabbelier, Nov 6, 2009
  10. 09/12 Allow helpers to report in "list" command that the ref is unchangedSverre Rabbelier, Nov 6, 2009
  11. 10/12 Allow helpers to request the path to the .git directorySverre Rabbelier, Nov 6, 2009
  12. 11/12 Basic build infrastructure for Python scriptsSverre Rabbelier, Nov 6, 2009
  13. 12/12 Add Python support library for remote helpersSverre Rabbelier, Nov 6, 2009
  14. Andrzej K. HaczewskiNov 6, 2009
  15. Sverre RabbelierNov 6, 2009
  16. Johannes SchindelinNov 7, 2009
  17. Daniel BarkalowNov 6, 2009
  18. Sverre RabbelierNov 6, 2009
  19. Sverre RabbelierNov 9, 2009
  20. Junio C HamanoNov 9, 2009
  21. Sverre RabbelierNov 9, 2009
  22. Junio C HamanoNov 9, 2009

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.