Thread (33 messages) flat view 33 messages, 3 authors, 2016-06-15
DORMANTno replies

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 11/13] Allow helpers to request the path to the .git directory

From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:47:40
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---

	Daniel, is this a good idea, or should we perhaps tell the
	helper the location of the git repository otherwise?

 transport-helper.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index a80d803..4f95e7b 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -51,6 +51,12 @@ static struct child_process *get_helper(struct transport *transport)
 			data->fetch = 1;
 		if (!strcmp(buf.buf, "import"))
 			data->import = 1;
+		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);
+		}
 	}
 	return data->helper;
 }
-- 
1.6.5.2.295.g0d105
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help