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

[WIP PATCH 2/4] Add "ignore_submodules" member to "struct unpack_trees_options"

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

To be able to checkout submodule content the new member "ignore_submodules" is added to "struct unpack_trees_options". In "unpack_callback()" it is used to initialize the recently introduced member with the same name in "struct checkout".

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
 archive.c           |    1 +
 builtin/clone.c     |    1 +
 builtin/commit.c    |    1 +
 builtin/merge.c     |    2 ++
 builtin/read-tree.c |    1 +
 builtin/reset.c     |    1 +
 diff-lib.c          |    2 ++
 merge-recursive.c   |    1 +
 unpack-trees.c      |    2 +-
 unpack-trees.h      |    3 ++-
 10 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/archive.c b/archive.c
index d700af3..d730bab 100644
--- a/archive.c
+++ b/archive.c
@@ -184,6 +184,7 @@ int write_archive_entries(struct archiver_args *args,
 		opts.src_index = &the_index;
 		opts.dst_index = &the_index;
 		opts.fn = oneway_merge;
+		opts.ignore_submodules = 1;
 		init_tree_desc(&t, args->tree->buffer, args->tree->size);
 		if (unpack_trees(1, &t, &opts))
 			return -1;
diff --git a/builtin/clone.c b/builtin/clone.c
index 05be999..f826fe9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -637,6 +637,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		opts.verbose_update = (option_verbosity > 0);
 		opts.src_index = &the_index;
 		opts.dst_index = &the_index;
+		opts.ignore_submodules = 1;

 		tree = parse_tree_indirect(our_head_points_at->old_sha1);
 		parse_tree(tree);
diff --git a/builtin/commit.c b/builtin/commit.c
index 017b8a5..419a4cf 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -257,6 +257,7 @@ static void create_base_index(void)
 	opts.dst_index = &the_index;

 	opts.fn = oneway_merge;
+	opts.ignore_submodules = 1;
 	tree = parse_tree_indirect(head_sha1);
 	if (!tree)
 		die("failed to unpack HEAD tree object");
diff --git a/builtin/merge.c b/builtin/merge.c
index 37d414b..e589404 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -532,6 +532,7 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,
 	if (!trees[nr_trees++])
 		return -1;
 	opts.fn = threeway_merge;
+	opts.ignore_submodules = 1;
 	cache_tree_free(&active_cache_tree);
 	for (i = 0; i < nr_trees; i++) {
 		parse_tree(trees[i]);
@@ -705,6 +706,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remote
 	opts.merge = 1;
 	opts.fn = twoway_merge;
 	opts.msgs = get_porcelain_error_msgs();
+	opts.ignore_submodules = 1;

 	trees[nr_trees] = parse_tree_indirect(head);
 	if (!trees[nr_trees++])
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 8bdcab1..cd3edfa 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -201,6 +201,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)

 	if (opts.debug_unpack)
 		opts.fn = debug_merge;
+	opts.ignore_submodules = 1;

 	cache_tree_free(&active_cache_tree);
 	for (i = 0; i < nr_trees; i++) {
diff --git a/builtin/reset.c b/builtin/reset.c
index 1283068..0ac7e6f 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -98,6 +98,7 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet
 		nr++;
 		opts.fn = twoway_merge;
 	}
+	opts.ignore_submodules = 1;

 	if (!fill_tree_descriptor(desc + nr - 1, sha1))
 		return error("Failed to find tree of %s.", sha1_to_hex(sha1));
diff --git a/diff-lib.c b/diff-lib.c
index c9f6e05..64264a9 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -451,6 +451,7 @@ int run_diff_index(struct rev_info *revs, int cached)
 	opts.unpack_data = revs;
 	opts.src_index = &the_index;
 	opts.dst_index = NULL;
+	opts.ignore_submodules = 1;

 	init_tree_desc(&t, tree->buffer, tree->size);
 	if (unpack_trees(1, &t, &opts))
@@ -509,6 +510,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
 	opts.unpack_data = &revs;
 	opts.src_index = &the_index;
 	opts.dst_index = &the_index;
+	opts.ignore_submodules = 1;

 	init_tree_desc(&t, tree->buffer, tree->size);
 	if (unpack_trees(1, &t, &opts))
diff --git a/merge-recursive.c b/merge-recursive.c
index 206c103..d294e62 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -186,6 +186,7 @@ static int git_merge_trees(int index_only,
 	opts.src_index = &the_index;
 	opts.dst_index = &the_index;
 	opts.msgs = get_porcelain_error_msgs();
+	opts.ignore_submodules = 1;

 	init_tree_desc_from_tree(t+0, common);
 	init_tree_desc_from_tree(t+1, head);
diff --git a/unpack-trees.c b/unpack-trees.c
index 151b422..6821d7d 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -711,7 +711,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 	state.force = 1;
 	state.quiet = 1;
 	state.refresh_cache = 1;
-	state.ignore_submodules = 1;
+	state.ignore_submodules = o->ignore_submodules;

 	memset(&el, 0, sizeof(el));
 	if (!core_apply_sparse_checkout || !o->update)
diff --git a/unpack-trees.h b/unpack-trees.h
index ef70eab..bbb49fd 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -33,7 +33,8 @@ struct unpack_trees_options {
 		     diff_index_cached,
 		     debug_unpack,
 		     skip_sparse_checkout,
-		     gently;
+		     gently,
+		     ignore_submodules;
 	const char *prefix;
 	int cache_bottom;
 	struct dir_struct *dir;
-- 
1.7.1.rc0.248.g09203
Previous: Jens LehmannNext: Jens Lehmann
Message 8 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.