Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
submodule.c: tighten scope of changed_submodule_names struct
author
Stefan Beller
<sbeller@google.com>
Thu, 29 Nov 2018 00:27:51 +0000
(16:27 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 5 Dec 2018 02:42:31 +0000
(11:42 +0900)
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>
submodule.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
08a297b
)
diff --git
a/submodule.c
b/submodule.c
index 3c388f85cc63d211856b895a68a569c9a08d5137..f93f0aff82dcc1a75f9a40d8e5197a43c3aa17bc 100644
(file)
--- a/
submodule.c
+++ b/
submodule.c
@@
-25,7
+25,6
@@
#include "commit-reach.h"
static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
#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;
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);
}
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;
{
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))
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);
}
free_submodules_oids(&changed_submodules);
@@
-1221,8
+1222,10
@@
struct submodule_parallel_fetch {
int default_option;
int quiet;
int result;
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)
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(
case RECURSE_SUBMODULES_ON_DEMAND:
if (!submodule ||
!string_list_lookup(
- &changed_submodule_names,
+ &
spf->
changed_submodule_names,
submodule->name))
continue;
default_argv = "on-demand";
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 */
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,
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:
argv_array_clear(&spf.args);
out:
- string_list_clear(&changed_submodule_names, 1);
+ string_list_clear(&
spf.
changed_submodule_names, 1);
return spf.result;
}
return spf.result;
}