git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 9, 2010, 21:59 UTC
Message-ID
<7vd3y81e3s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4BBF9DC9.8030905@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 11 quoted lines
> +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?
Show 6 quoted lines
> +	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.

Previous: Jens LehmannNext: Jens Lehmann
Message 3 of 13 in “Recursively checkout submodules”
  1. 0/4 Recursively checkout submodulesJens Lehmann, Apr 9, 2010
  2. 1/4 Prepare checkout_entry() for recursive checkout of submodulesJens Lehmann, Apr 9, 2010
  3. Junio C HamanoApr 9, 2010
  4. Jens LehmannApr 9, 2010
  5. Jens LehmannApr 10, 2010
  6. Junio C HamanoApr 10, 2010
  7. Jens LehmannApr 10, 2010
  8. 2/4 Add "ignore_submodules" member to "struct unpack_trees_options"Jens Lehmann, Apr 9, 2010
  9. 3/4 Teach checkout to recursively checkout submodulesJens Lehmann, Apr 9, 2010
  10. 4/4 Teach checkout-index to recursively checkout submodulesJens Lehmann, Apr 9, 2010
  11. Junio C HamanoApr 9, 2010
  12. Jens LehmannApr 9, 2010
  13. Junio C HamanoApr 10, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.