From: Sverre Rabbelier Date: Fri, 06 Nov 2009 22:52:44 GMT Subject: [PATCH v3 10/12] Allow helpers to request the path to the .git directory 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 --- 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