From cb338c23d6d518947bf6f7240bf30e2ec232bd3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 28 Mar 2023 15:58:47 +0200 Subject: cocci: apply the "commit-reach.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "commit-reach.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- commit-reach.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commit-reach.c') diff --git a/commit-reach.c b/commit-reach.c index 2e33c599a8..a4b9eda723 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -162,7 +162,8 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in) for (j = ret; j; j = j->next) { struct commit_list *bases; - bases = get_merge_bases(i->item, j->item); + bases = repo_get_merge_bases(the_repository, i->item, + j->item); if (!new_commits) new_commits = bases; else -- cgit v1.2.3 From ecb5091fd4301ac647db0bd2504112b38f7ee06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 28 Mar 2023 15:58:48 +0200 Subject: cocci: apply the "commit.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "commit.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- commit-reach.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'commit-reach.c') diff --git a/commit-reach.c b/commit-reach.c index a4b9eda723..c88faf7e7b 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -585,7 +585,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid) return 0; new_commit = (struct commit *) o; - if (parse_commit(new_commit) < 0) + if (repo_parse_commit(the_repository, new_commit) < 0) return 0; commit_list_insert(old_commit, &old_commit_list); @@ -749,7 +749,7 @@ int can_all_from_reach_with_flag(struct object_array *from, } list[nr_commits] = (struct commit *)from_one; - if (parse_commit(list[nr_commits]) || + if (repo_parse_commit(the_repository, list[nr_commits]) || commit_graph_generation(list[nr_commits]) < min_generation) { result = 0; goto cleanup; @@ -784,7 +784,7 @@ int can_all_from_reach_with_flag(struct object_array *from, if (!(parent->item->object.flags & assign_flag)) { parent->item->object.flags |= assign_flag; - if (parse_commit(parent->item) || + if (repo_parse_commit(the_repository, parent->item) || parent->item->date < min_commit_date || commit_graph_generation(parent->item) < min_generation) continue; @@ -826,7 +826,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to, while (from_iter) { add_object_array(&from_iter->item->object, NULL, &from_objs); - if (!parse_commit(from_iter->item)) { + if (!repo_parse_commit(the_repository, from_iter->item)) { timestamp_t generation; if (from_iter->item->date < min_commit_date) min_commit_date = from_iter->item->date; @@ -840,7 +840,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to, } while (to_iter) { - if (!parse_commit(to_iter->item)) { + if (!repo_parse_commit(the_repository, to_iter->item)) { timestamp_t generation; if (to_iter->item->date < min_commit_date) min_commit_date = to_iter->item->date; @@ -890,7 +890,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, timestamp_t generation; struct commit *c = *item; - parse_commit(c); + repo_parse_commit(the_repository, c); generation = commit_graph_generation(c); if (generation < min_generation) min_generation = generation; @@ -905,7 +905,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, struct commit *c = *item; if (!(c->object.flags & PARENT2)) { c->object.flags |= PARENT2; - parse_commit(c); + repo_parse_commit(the_repository, c); prio_queue_put(&queue, *item); } @@ -924,7 +924,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, for (parents = current->parents; parents; parents = parents->next) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (commit_graph_generation(p) < min_generation) continue; -- cgit v1.2.3 From 4a93b899c19794c28b140bf78a13fb9c2b34f433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 28 Mar 2023 15:58:58 +0200 Subject: libs: use "struct repository *" argument, not "the_repository" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As can easily be seen from grepping in our sources, we had these uses of "the_repository" in various library code in cases where the function in question was already getting a "struct repository *" argument. Let's use that argument instead. Out of these changes only the changes to "cache-tree.c", "commit-reach.c", "shallow.c" and "upload-pack.c" would have cleanly applied before the migration away from the "repo_*()" wrapper macros in the preceding commits. The rest aren't new, as we'd previously implicitly refer to "the_repository", but it's now more obvious that we were doing the wrong thing all along, and should have used the parameter instead. The change to change "get_index_format_default(the_repository)" in "read-cache.c" to use the "r" variable instead should arguably have been part of [1], or in the subsequent cleanup in [2]. Let's do it here, as can be seen from the initial code in [3] it's not important that we use "the_repository" there, but would prefer to always use the current repository. This change excludes the "the_repository" use in "upload-pack.c"'s upload_pack_advertise(), as the in-flight [4] makes that change. 1. ee1f0c242ef (read-cache: add index.skipHash config option, 2023-01-06) 2. 6269f8eaad0 (treewide: always have a valid "index_state.repo" member, 2023-01-17) 3. 7211b9e7534 (repo-settings: consolidate some config settings, 2019-08-13) 4. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- commit-reach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit-reach.c') diff --git a/commit-reach.c b/commit-reach.c index c88faf7e7b..01eb11b595 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -448,7 +448,7 @@ int repo_is_descendant_of(struct repository *r, if (!with_commit) return 1; - if (generation_numbers_enabled(the_repository)) { + if (generation_numbers_enabled(r)) { struct commit_list *from_list = NULL; int result; commit_list_insert(commit, &from_list); -- cgit v1.2.3