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

[WIP PATCH 4/4] Teach checkout-index to recursively checkout submodules

From
Jens Lehmann <jens.lehmann@web.de>
Date
Apr 9, 2010, 21:40 UTC
Message-ID
<4BBF9ED3.9010502@web.de>
In-Reply-To
<4BBF9D6F.2000006@web.de>

Change the default behavior of "git checkout-index" to check out submodules too. This can be prevented by using the new "--ignore-submodules" option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 Documentation/git-checkout-index.txt |    9 ++++++++-
 builtin/checkout-index.c             |    6 ++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-checkout-index.txt b/Documentation/git-checkout-index.txt
index d6aa6e1..dbd6625 100644
--- a/Documentation/git-checkout-index.txt
+++ b/Documentation/git-checkout-index.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
 		   [--stage=<number>|all]
-		   [--temp]
+		   [--temp] [--ignore-submodules]
 		   [-z] [--stdin]
 		   [--] [<file>]\*

@@ -68,6 +68,13 @@ OPTIONS
 	Only meaningful with `--stdin`; paths are separated with
 	NUL character instead of LF.

+--ignore-submodules::
+	Since version 1.8.0 the default behavior is to checkout populated
+	submodules recursively. When this option is used, the work trees of
+	submodules will not be updated, only the hash recorded in the
+	superproject will be changed (this was the default behavior until
+	1.8.0).
+
 \--::
 	Do not interpret any more arguments as options.

diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index c35bad3..1e16d0d 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -213,7 +213,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 	int all = 0;
 	int read_from_stdin = 0;
 	int prefix_length;
-	int force = 0, quiet = 0, not_new = 0;
+	int force = 0, quiet = 0, not_new = 0, ignore_submodules = 0;
 	struct option builtin_checkout_index_options[] = {
 		OPT_BOOLEAN('a', "all", &all,
 			"checks out all files in the index"),
@@ -238,6 +238,8 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 		OPT_CALLBACK(0, "stage", NULL, NULL,
 			"copy out the files from named stage",
 			option_parse_stage),
+		OPT_BOOLEAN(0, "ignore-submodules", &ignore_submodules,
+			"don't update submodule work trees"),
 		OPT_END()
 	};

@@ -254,7 +256,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 	state.force = force;
 	state.quiet = quiet;
 	state.not_new = not_new;
-	state.ignore_submodules = 1;
+	state.ignore_submodules = ignore_submodules;

 	if (state.base_dir_len || to_tempfile) {
 		/* when --prefix is specified we do not
-- 
1.7.1.rc0.248.g09203
Previous: Jens LehmannNext: Junio C Hamano
Message 10 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.