summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorSverre Rabbelier <srabbelier@gmail.com>2010-03-29 11:48:26 -0500
committerJunio C Hamano <gitster@pobox.com>2010-03-31 09:37:26 -0700
commit88f3b2b0a21f712d14b0b7a7fda30f578027424a (patch)
tree16ac36f21738bf336f0ece16dd0efd6bfe2394ca /transport-helper.c
parent580d5f83e71f7f9e61cdb181e21c10b09c81f6e5 (diff)
downloadgit-88f3b2b0a21f712d14b0b7a7fda30f578027424a.tar.gz
remote-helpers: allow requesing the path to the .git directory
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 2638781c5b..c8705b78d6 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",