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/checkout-index.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/checkout-index.c')
-rw-r--r--builtin/checkout-index.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 97e06e8c52..c2aee450c4 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -75,8 +75,8 @@ static int checkout_file(const char *name, const char *prefix)
if (pos < 0)
pos = -pos - 1;
- while (pos < active_nr) {
- struct cache_entry *ce = active_cache[pos];
+ while (pos < the_index.cache_nr) {
+ struct cache_entry *ce = the_index.cache[pos];
if (ce_namelen(ce) != namelen ||
memcmp(ce->name, name, namelen))
break;
@@ -136,8 +136,8 @@ static int checkout_all(const char *prefix, int prefix_length)
int i, errs = 0;
struct cache_entry *last_ce = NULL;
- for (i = 0; i < active_nr ; i++) {
- struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr ; i++) {
+ struct cache_entry *ce = the_index.cache[i];
if (S_ISSPARSEDIR(ce->ce_mode)) {
if (!ce_skip_worktree(ce))
@@ -151,7 +151,7 @@ static int checkout_all(const char *prefix, int prefix_length)
*/
if (ignore_skip_worktree) {
ensure_full_index(&the_index);
- ce = active_cache[i];
+ ce = the_index.cache[i];
}
}