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/commit.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/commit.c')
-rw-r--r--builtin/commit.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 10a827b1f4..abbed75027 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -272,8 +272,8 @@ static int list_paths(struct string_list *list, const char *with_tree,
/* TODO: audit for interaction with sparse-index. */
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];
struct string_list_item *item;
if (ce->ce_flags & CE_UPDATE)
@@ -461,8 +461,8 @@ static const char *prepare_index(const char **argv, const char *prefix,
if (!only && !pathspec.nr) {
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
refresh_cache_or_die(refresh_flags);
- if (active_cache_changed
- || !cache_tree_fully_valid(active_cache_tree))
+ if (the_index.cache_changed
+ || !cache_tree_fully_valid(the_index.cache_tree))
update_main_cache_tree(WRITE_TREE_SILENT);
if (write_locked_index(&the_index, &index_lock,
COMMIT_LOCK | SKIP_IF_UNCHANGED))
@@ -998,10 +998,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++)
- if (ce_intent_to_add(active_cache[i]))
+ for (i = 0; i < the_index.cache_nr; i++)
+ if (ce_intent_to_add(the_index.cache[i]))
ita_nr++;
- committable = active_nr - ita_nr > 0;
+ committable = the_index.cache_nr - ita_nr > 0;
} else {
/*
* Unless the user did explicitly request a submodule
@@ -1823,7 +1823,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
append_merge_tag_headers(parents, &tail);
}
- if (commit_tree_extended(sb.buf, sb.len, &active_cache_tree->oid,
+ if (commit_tree_extended(sb.buf, sb.len, &the_index.cache_tree->oid,
parents, &oid, author_ident.buf, NULL,
sign_commit, extra)) {
rollback_index_files();