Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [WIP PATCH 1/4] Prepare checkout_entry() for recursive checkout of submodules

From: Jens Lehmann <hidden>
Date: 2016-06-15 22:48:35

Possibly related (same subject, not in this thread)

Am 09.04.2010 23:59, schrieb Junio C Hamano:
Jens Lehmann [off-list ref] writes:
quoted
+int checkout_submodule(const char *path, const unsigned char sha1[20], int force)
+{
+	struct strbuf buf = STRBUF_INIT;
+	struct child_process cp;
+	const char *hex_sha1 = sha1_to_hex(sha1);
+	const char *argv[] = {
+		"checkout",
+                force ? "-qf" : "-q",
+		hex_sha1,
+		NULL,
+	};
Why force -q?
Good question. I seem to have tried to silence the output of checkout
from run_command(), which AFIACS doesn't reach the console anyway
unless i want it to ... (while at the same time managing to mess up
the tabs in that line ... :-/ )

quoted
+	strbuf_addf(&buf, "%s/.git/", path);
+	if (!is_directory(buf.buf)) {
+		strbuf_release(&buf);
+		/* The submodule is not populated, so we can't check it out */
+		return 0;
+	}
This would give you an incorrect result if .git is a file that records
"gitdir: overthere" (see read_gitfile_gently() in setup.c); I would expect
it would become a fairly important ingredient if we ever enhance the
submodule support to add submodule that disappears/reappears in the
history.
Right. This assumption is also present in add_submodule_odb() (used by
show_submodule_summary()) and is_submodule_modified(), so i just reused
it. This should be addressed in another patch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help