submodule--helper style: add \n\n after variable declarations

Since the preceding commit fixed style issues with \n\n among the declared variables let's fix the minor stylistic issues with those variables not being consistently followed by a \n\n. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 1, 2022 at 01:17 UTC 0b83b2b03a322a7948ddb453ab8766594ca239de
1 file changed +23 -2
builtin/submodule--helper.c
+23 -2
@@ -167,6 +167,7 @@ static int module_list_compute(int argc, const char **argv,
167 {
168 int i, result = 0;
169 char *ps_matched = NULL;
170 +
171 parse_pathspec(pathspec, 0,
172 PATHSPEC_PREFER_FULL,
173 prefix, argv);
@@ -248,6 +249,7 @@ static void for_each_listed_submodule(const struct module_list *list,
249 each_submodule_fn fn, void *cb_data)
250 {
251 int i;
252 +
253 for (i = 0; i < list->nr; i++)
254 fn(list->entries[i], cb_data);
255 }
@@ -267,7 +269,6 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
269 struct foreach_cb *info = cb_data;
270 const char *path = list_item->name;
271 const struct object_id *ce_oid = &list_item->oid;
270 -
272 const struct submodule *sub;
273 struct child_process cp = CHILD_PROCESS_INIT;
274 char *displaypath;
@@ -456,6 +457,7 @@ static void init_submodule(const char *path, const char *prefix,
457 if (starts_with_dot_dot_slash(url) ||
458 starts_with_dot_slash(url)) {
459 char *oldurl = url;
460 +
461 url = resolve_relative_url(oldurl, NULL, 0);
462 free(oldurl);
463 }
@@ -493,6 +495,7 @@ static void init_submodule(const char *path, const char *prefix,
495 static void init_submodule_cb(const struct cache_entry *list_item, void *cb_data)
496 {
497 struct init_cb *info = cb_data;
498 +
499 init_submodule(list_item->name, info->prefix, info->flags);
500 }
501
@@ -562,6 +565,7 @@ static int handle_submodule_head_ref(const char *refname,
565 void *cb_data)
566 {
567 struct object_id *output = cb_data;
568 +
569 if (oid)
570 oidcpy(output, oid);
571
@@ -668,6 +672,7 @@ static void status_submodule_cb(const struct cache_entry *list_item,
672 void *cb_data)
673 {
674 struct status_cb *info = cb_data;
675 +
676 status_submodule(list_item->name, &list_item->oid, list_item->ce_flags,
677 info->prefix, info->flags);
678 }
@@ -820,6 +825,7 @@ static void generate_submodule_summary(struct summary_cb *info,
825 if (!info->cached && oideq(&p->oid_dst, null_oid())) {
826 if (S_ISGITLINK(p->mod_dst)) {
827 struct ref_store *refs = get_submodule_ref_store(p->sm_path);
828 +
829 if (refs)
830 refs_head_ref(refs, handle_submodule_head_ref, &p->oid_dst);
831 } else if (S_ISLNK(p->mod_dst) || S_ISREG(p->mod_dst)) {
@@ -1158,6 +1164,7 @@ static void sync_submodule(const char *path, const char *prefix,
1164 if (starts_with_dot_dot_slash(sub->url) ||
1165 starts_with_dot_slash(sub->url)) {
1166 char *up_path = get_up_path(path);
1167 +
1168 sub_origin_url = resolve_relative_url(sub->url, up_path, 1);
1169 super_config_url = resolve_relative_url(sub->url, NULL, 1);
1170 free(up_path);
@@ -1233,6 +1240,7 @@ cleanup:
1240 static void sync_submodule_cb(const struct cache_entry *list_item, void *cb_data)
1241 {
1242 struct sync_cb *info = cb_data;
1243 +
1244 sync_submodule(list_item->name, info->prefix, info->flags);
1245 }
1246
@@ -1312,6 +1320,7 @@ static void deinit_submodule(const char *path, const char *prefix,
1320
1321 if (!(flags & OPT_FORCE)) {
1322 struct child_process cp_rm = CHILD_PROCESS_INIT;
1323 +
1324 cp_rm.git_cmd = 1;
1325 strvec_pushl(&cp_rm.args, "rm", "-qn",
1326 path, NULL);
@@ -1348,6 +1357,7 @@ static void deinit_submodule(const char *path, const char *prefix,
1357 /* remove the .git/config entries (unless the user already did it) */
1358 if (!capture_command(&cp_config, &sb_config, 0) && sb_config.len) {
1359 char *sub_key = xstrfmt("submodule.%s", sub->name);
1360 +
1361 /*
1362 * remove the whole section so we have a clean state when
1363 * the user later decides to init this submodule again
@@ -1585,6 +1595,7 @@ static int clone_submodule(struct module_clone_data *clone_data)
1595 strvec_pushl(&cp.args, "--depth", clone_data->depth, NULL);
1596 if (clone_data->reference.nr) {
1597 struct string_list_item *item;
1598 +
1599 for_each_string_list_item(item, &clone_data->reference)
1600 strvec_pushl(&cp.args, "--reference",
1601 item->string, NULL);
@@ -1935,6 +1946,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
1946 strvec_pushl(&child->args, "--url", url, NULL);
1947 if (suc->update_data->references.nr) {
1948 struct string_list_item *item;
1949 +
1950 for_each_string_list_item(item, &suc->update_data->references)
1951 strvec_pushl(&child->args, "--reference", item->string, NULL);
1952 }
@@ -1967,6 +1979,7 @@ static int update_clone_get_next_task(struct child_process *child,
1979 ce = suc->update_data->list.entries[suc->current];
1980 if (prepare_to_clone_next_submodule(ce, child, suc, err)) {
1981 int *p = xmalloc(sizeof(*p));
1982 +
1983 *p = suc->current;
1984 *idx_task_cb = p;
1985 suc->current++;
@@ -1982,6 +1995,7 @@ static int update_clone_get_next_task(struct child_process *child,
1995 index = suc->current - suc->update_data->list.nr;
1996 if (index < suc->failed_clones_nr) {
1997 int *p;
1998 +
1999 ce = suc->failed_clones[index];
2000 if (!prepare_to_clone_next_submodule(ce, child, suc, err)) {
2001 suc->current ++;
@@ -2005,6 +2019,7 @@ static int update_clone_start_failure(struct strbuf *err,
2019 void *idx_task_cb)
2020 {
2021 struct submodule_update_clone *suc = suc_cb;
2022 +
2023 suc->quickstop = 1;
2024 return 1;
2025 }
@@ -2016,9 +2031,9 @@ static int update_clone_task_finished(int result,
2031 {
2032 const struct cache_entry *ce;
2033 struct submodule_update_clone *suc = suc_cb;
2019 -
2034 int *idxP = idx_task_cb;
2035 int idx = *idxP;
2036 +
2037 free(idxP);
2038
2039 if (!result)
@@ -2051,6 +2066,7 @@ static int git_update_clone_config(const char *var, const char *value,
2066 void *cb)
2067 {
2068 int *max_jobs = cb;
2069 +
2070 if (!strcmp(var, "submodule.fetchjobs"))
2071 *max_jobs = parse_submodule_fetchjobs(var, value);
2072 return 0;
@@ -2091,6 +2107,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str
2107 if (oid) {
2108 char *hex = oid_to_hex(oid);
2109 char *remote = get_default_remote();
2110 +
2111 strvec_pushl(&cp.args, remote, hex, NULL);
2112 free(remote);
2113 }
@@ -2340,6 +2357,7 @@ static void update_data_to_args(struct update_data *update_data, struct strvec *
2357
2358 if (update_data->references.nr) {
2359 struct string_list_item *item;
2360 +
2361 for_each_string_list_item(item, &update_data->references)
2362 strvec_pushl(args, "--reference", item->string, NULL);
2363 }
@@ -2872,8 +2890,10 @@ static void append_fetch_remotes(struct strbuf *msg, const char *git_dir_path)
2890 if (!capture_command(&cp_remote, &sb_remote_out, 0)) {
2891 char *next_line;
2892 char *line = sb_remote_out.buf;
2893 +
2894 while ((next_line = strchr(line, '\n')) != NULL) {
2895 size_t len = next_line - line;
2896 +
2897 if (strip_suffix_mem(line, &len, " (fetch)"))
2898 strbuf_addf(msg, " %.*s\n", (int)len, line);
2899 line = next_line + 1;
@@ -3180,6 +3200,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
3200 int exit_code = -1;
3201 struct strbuf sb = STRBUF_INIT;
3202 struct child_process cp = CHILD_PROCESS_INIT;
3203 +
3204 cp.git_cmd = 1;
3205 cp.no_stdout = 1;
3206 strvec_pushl(&cp.args, "add", "--dry-run", "--ignore-missing",