@matheusbsbs / matheus-bagliano / commits / 88f3b2b0a2
Fork 0

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>

Sverre Rabbelier committed Mar 29, 2010 at 11:48 UTC 88f3b2b0a21f712d14b0b7a7fda30f578027424a
1 file changed +5
transport-helper.c
+5
@@ -170,6 +170,11 @@ static struct child_process *get_helper(struct transport *transport)
170 refspecs[refspec_nr++] = strdup(buf.buf + strlen("refspec "));
171 } else if (!strcmp(capname, "connect")) {
172 data->connect = 1;
173 + } else if (!strcmp(buf.buf, "gitdir")) {
174 + struct strbuf gitdir = STRBUF_INIT;
175 + strbuf_addf(&gitdir, "gitdir %s\n", get_git_dir());
176 + sendline(data, &gitdir);
177 + strbuf_release(&gitdir);
178 } else if (mandatory) {
179 die("Unknown mandatory capability %s. This remote "
180 "helper probably needs newer version of Git.\n",