Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-19 16:07:34 +0300
committerJunio C Hamano <gitster@pobox.com>2022-11-21 06:06:15 +0300
commitdc594180d9e62438cb664c678f5e5bd229154c75 (patch)
tree10b94b968ae39d1f78cdac0fdaa3238f744f5c41 /builtin/submodule--helper.c
parent031b2033e0b5c6276bbd93f276e1698f925fb498 (diff)
cocci & cache.h: apply variable section of "pending" index-compatibility
Mostly apply the part of "index-compatibility.pending.cocci" that renames the global variables like "active_nr", which are a shorthand to referencing (in that case) a struct member as "the_index.cache_nr". In doing so move more of "index-compatibility.pending.cocci" to "index-compatibility.cocci". In the case of "active_nr" we'd have a textual conflict with "ab/various-leak-fixes" in "next"[1]. Let's exclude that specific case while moving the rule over from "pending". 1. 407b94280f8 (commit: discard partial cache before (re-)reading it, 2022-11-08) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index a7683d3529..808865a5e3 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -199,8 +199,8 @@ static int module_list_compute(const char **argv,
if (read_cache() < 0)
die(_("index file corrupt"));
- for (i = 0; i < active_nr; i++) {
- const struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ const struct cache_entry *ce = the_index.cache[i];
if (!match_pathspec(&the_index, pathspec, ce->name, ce_namelen(ce),
0, ps_matched, 1) ||
@@ -209,8 +209,8 @@ static int module_list_compute(const char **argv,
ALLOC_GROW(list->entries, list->nr + 1, list->alloc);
list->entries[list->nr++] = ce;
- while (i + 1 < active_nr &&
- !strcmp(ce->name, active_cache[i + 1]->name))
+ while (i + 1 < the_index.cache_nr &&
+ !strcmp(ce->name, the_index.cache[i + 1]->name))
/*
* Skip entries with the same name in different stages
* to make sure an entry is returned only once.
@@ -3255,15 +3255,15 @@ static void die_on_index_match(const char *path, int force)
* need to check ps_matched[0] to know if a cache
* entry matched.
*/
- for (i = 0; i < active_nr; i++) {
- ce_path_match(&the_index, active_cache[i], &ps,
+ for (i = 0; i < the_index.cache_nr; i++) {
+ ce_path_match(&the_index, the_index.cache[i], &ps,
ps_matched);
if (ps_matched[0]) {
if (!force)
die(_("'%s' already exists in the index"),
path);
- if (!S_ISGITLINK(active_cache[i]->ce_mode))
+ if (!S_ISGITLINK(the_index.cache[i]->ce_mode))
die(_("'%s' already exists in the index "
"and is not a submodule"), path);
break;