summaryrefslogtreecommitdiffstats
path: root/builtin/rm.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-19 14:07:34 +0100
committerJunio C Hamano <gitster@pobox.com>2022-11-21 04:06:15 +0100
commitdc594180d9e62438cb664c678f5e5bd229154c75 (patch)
tree10b94b968ae39d1f78cdac0fdaa3238f744f5c41 /builtin/rm.c
parentcocci & cache.h: apply a selection of "pending" index-compatibility (diff)
downloadgit-dc594180d9e62438cb664c678f5e5bd229154c75.tar.xz
git-dc594180d9e62438cb664c678f5e5bd229154c75.zip
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/rm.c')
-rw-r--r--builtin/rm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin/rm.c b/builtin/rm.c
index c717cdc97f..2b23eb2543 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -35,8 +35,8 @@ static int get_ours_cache_pos(const char *path, int pos)
{
int i = -pos - 1;
- while ((i < active_nr) && !strcmp(active_cache[i]->name, path)) {
- if (ce_stage(active_cache[i]) == 2)
+ while ((i < the_index.cache_nr) && !strcmp(the_index.cache[i]->name, path)) {
+ if (ce_stage(the_index.cache[i]) == 2)
return i;
i++;
}
@@ -78,7 +78,7 @@ static void submodules_absorb_gitdir_if_needed(void)
if (pos < 0)
continue;
}
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (!S_ISGITLINK(ce->ce_mode) ||
!file_exists(ce->name) ||
@@ -127,11 +127,11 @@ static int check_local_mod(struct object_id *head, int index_only)
if (pos < 0)
continue;
- if (!S_ISGITLINK(active_cache[pos]->ce_mode) ||
+ if (!S_ISGITLINK(the_index.cache[pos]->ce_mode) ||
is_empty_dir(name))
continue;
}
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (lstat(ce->name, &st) < 0) {
if (!is_missing_file_error(errno))
@@ -303,8 +303,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
if (pathspec_needs_expanded_index(&the_index, &pathspec))
ensure_full_index(&the_index);
- 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 (!include_sparse &&
(ce_skip_worktree(ce) ||