Thread (3 messages) 3 messages, 2 authors, 2016-06-16

Re: [PATCH 11/15] diff: ignore submodules excluded by groups

From: Junio C Hamano <hidden>
Date: 2016-06-16 02:19:05

Stefan Beller [off-list ref] writes:
We do not need to do anything special to initialize the `submodule_groups`
pointer as the diff options setup will fill in 0 by default.

Signed-off-by: Stefan Beller <redacted>
---
 diff.c | 3 +++
 diff.h | 1 +
 2 files changed, 4 insertions(+)
Isn't this going in the opposite way from what you described in 0/15
with analogy to how "ignore" mechanism works?  Just like a path is
tracked once it is tracked, whether it matches an ignore pattern,
shouldn't we be getting a summary for a submodule for any submodule
once submodule/.git/HEAD is there (i.e. we can give a comparison),
whether it is specified by a separate mechanism that acts from
sideways (e.g. the "default group").
quoted hunk
diff --git a/diff.c b/diff.c
index 059123c..5808d8a 100644
--- a/diff.c
+++ b/diff.c
@@ -4921,10 +4921,13 @@ static int is_submodule_ignored(const char *path, struct diff_options *options)
 {
 	int ignored = 0;
 	unsigned orig_flags = options->flags;
+	const struct submodule *sub = submodule_from_path(null_sha1, path);
 	if (!DIFF_OPT_TST(options, OVERRIDE_SUBMODULE_CONFIG))
 		set_diffopt_flags_from_submodule_config(options, path);
 	if (DIFF_OPT_TST(options, IGNORE_SUBMODULES))
 		ignored = 1;
+	if (!submodule_in_group(options->submodule_groups, sub))
+		ignored = 1;
 	options->flags = orig_flags;
 	return ignored;
 }
diff --git a/diff.h b/diff.h
index e7d68ed..7d499fb 100644
--- a/diff.h
+++ b/diff.h
@@ -178,6 +178,7 @@ struct diff_options {
 	void *output_prefix_data;
 
 	int diff_path_counter;
+	struct string_list *submodule_groups;
 };
 
 enum color_diff {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help