submodule.c: tighten scope of changed_submodule_names struct
The `changed_submodule_names` are only used for fetching, so let's make it part of the struct that is passed around for fetching submodules. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									08a297bd49
								
							
						
					
					
						commit
						16dd6fe133
					
				
							
								
								
									
										19
									
								
								submodule.c
								
								
								
								
							
							
						
						
									
										19
									
								
								submodule.c
								
								
								
								
							| 
						 | 
				
			
			@ -25,7 +25,6 @@
 | 
			
		|||
#include "commit-reach.h"
 | 
			
		||||
 | 
			
		||||
static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
 | 
			
		||||
static struct string_list changed_submodule_names = STRING_LIST_INIT_DUP;
 | 
			
		||||
static int initialized_fetch_ref_tips;
 | 
			
		||||
static struct oid_array ref_tips_before_fetch;
 | 
			
		||||
static struct oid_array ref_tips_after_fetch;
 | 
			
		||||
| 
						 | 
				
			
			@ -1136,7 +1135,8 @@ void check_for_new_submodule_commits(struct object_id *oid)
 | 
			
		|||
	oid_array_append(&ref_tips_after_fetch, oid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void calculate_changed_submodule_paths(struct repository *r)
 | 
			
		||||
static void calculate_changed_submodule_paths(struct repository *r,
 | 
			
		||||
		struct string_list *changed_submodule_names)
 | 
			
		||||
{
 | 
			
		||||
	struct argv_array argv = ARGV_ARRAY_INIT;
 | 
			
		||||
	struct string_list changed_submodules = STRING_LIST_INIT_DUP;
 | 
			
		||||
| 
						 | 
				
			
			@ -1174,7 +1174,8 @@ static void calculate_changed_submodule_paths(struct repository *r)
 | 
			
		|||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (!submodule_has_commits(r, path, commits))
 | 
			
		||||
			string_list_append(&changed_submodule_names, name->string);
 | 
			
		||||
			string_list_append(changed_submodule_names,
 | 
			
		||||
					   name->string);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	free_submodules_oids(&changed_submodules);
 | 
			
		||||
| 
						 | 
				
			
			@ -1221,8 +1222,10 @@ struct submodule_parallel_fetch {
 | 
			
		|||
	int default_option;
 | 
			
		||||
	int quiet;
 | 
			
		||||
	int result;
 | 
			
		||||
 | 
			
		||||
	struct string_list changed_submodule_names;
 | 
			
		||||
};
 | 
			
		||||
#define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0, 0}
 | 
			
		||||
#define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0, 0, STRING_LIST_INIT_DUP }
 | 
			
		||||
 | 
			
		||||
static int get_fetch_recurse_config(const struct submodule *submodule,
 | 
			
		||||
				    struct submodule_parallel_fetch *spf)
 | 
			
		||||
| 
						 | 
				
			
			@ -1284,7 +1287,7 @@ static int get_next_submodule(struct child_process *cp,
 | 
			
		|||
		case RECURSE_SUBMODULES_ON_DEMAND:
 | 
			
		||||
			if (!submodule ||
 | 
			
		||||
			    !string_list_lookup(
 | 
			
		||||
					&changed_submodule_names,
 | 
			
		||||
					&spf->changed_submodule_names,
 | 
			
		||||
					submodule->name))
 | 
			
		||||
				continue;
 | 
			
		||||
			default_argv = "on-demand";
 | 
			
		||||
| 
						 | 
				
			
			@ -1376,8 +1379,8 @@ int fetch_populated_submodules(struct repository *r,
 | 
			
		|||
	argv_array_push(&spf.args, "--recurse-submodules-default");
 | 
			
		||||
	/* default value, "--submodule-prefix" and its value are added later */
 | 
			
		||||
 | 
			
		||||
	calculate_changed_submodule_paths(r);
 | 
			
		||||
	string_list_sort(&changed_submodule_names);
 | 
			
		||||
	calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
 | 
			
		||||
	string_list_sort(&spf.changed_submodule_names);
 | 
			
		||||
	run_processes_parallel(max_parallel_jobs,
 | 
			
		||||
			       get_next_submodule,
 | 
			
		||||
			       fetch_start_failure,
 | 
			
		||||
| 
						 | 
				
			
			@ -1386,7 +1389,7 @@ int fetch_populated_submodules(struct repository *r,
 | 
			
		|||
 | 
			
		||||
	argv_array_clear(&spf.args);
 | 
			
		||||
out:
 | 
			
		||||
	string_list_clear(&changed_submodule_names, 1);
 | 
			
		||||
	string_list_clear(&spf.changed_submodule_names, 1);
 | 
			
		||||
	return spf.result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue