diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-01-15 10:35:34 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-15 05:32:31 -0800 |
| commit | 9f18d089c51fba2776fe1fece877a359c47417f7 (patch) | |
| tree | e51d5ec9b79ebda7f0b928d7c71f4d36adad4a81 /builtin | |
| parent | a468f3cefab32eed7d9a12bd6b93719d38ec67a6 (diff) | |
| download | git-9f18d089c51fba2776fe1fece877a359c47417f7.tar.xz | |
commit: rename `free_commit_list()` to conform to coding guidelines
Our coding guidelines say that:
Functions that operate on `struct S` are named `S_<verb>()` and should
generally receive a pointer to `struct S` as first parameter.
While most of the functions related to `struct commit_list` already
follow that naming schema, `free_commit_list()` doesn't.
Rename the function to address this and adjust all of its callers. Add a
compatibility wrapper for the old function name to ease the transition
and avoid any semantic conflicts with in-flight patch series. This
wrapper will be removed once Git 2.53 has been released.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/am.c | 2 | ||||
| -rw-r--r-- | builtin/commit-tree.c | 2 | ||||
| -rw-r--r-- | builtin/commit.c | 2 | ||||
| -rw-r--r-- | builtin/describe.c | 2 | ||||
| -rw-r--r-- | builtin/diff-tree.c | 2 | ||||
| -rw-r--r-- | builtin/gc.c | 2 | ||||
| -rw-r--r-- | builtin/log.c | 12 | ||||
| -rw-r--r-- | builtin/merge-base.c | 14 | ||||
| -rw-r--r-- | builtin/merge-tree.c | 2 | ||||
| -rw-r--r-- | builtin/merge.c | 16 | ||||
| -rw-r--r-- | builtin/pull.c | 8 | ||||
| -rw-r--r-- | builtin/rebase.c | 4 | ||||
| -rw-r--r-- | builtin/rev-list.c | 2 | ||||
| -rw-r--r-- | builtin/show-branch.c | 2 | ||||
| -rw-r--r-- | builtin/stash.c | 10 |
15 files changed, 41 insertions, 41 deletions
diff --git a/builtin/am.c b/builtin/am.c index 277c2e7937..97a7b1d46a 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1726,7 +1726,7 @@ static void do_commit(const struct am_state *state) run_hooks(the_repository, "post-applypatch"); - free_commit_list(parents); + commit_list_free(parents); strbuf_release(&sb); } diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 5189e685a7..30535db131 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -154,7 +154,7 @@ int cmd_commit_tree(int argc, ret = 0; out: - free_commit_list(parents); + commit_list_free(parents); strbuf_release(&buffer); return ret; } diff --git a/builtin/commit.c b/builtin/commit.c index 0aa3690b04..b1315b512b 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1978,7 +1978,7 @@ int cmd_commit(int argc, cleanup: free_commit_extra_headers(extra); - free_commit_list(parents); + commit_list_free(parents); strbuf_release(&author_ident); strbuf_release(&err); strbuf_release(&sb); diff --git a/builtin/describe.c b/builtin/describe.c index 989a78d715..abfe3525a5 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -558,7 +558,7 @@ static void process_object(struct object *obj, const char *path, void *data) describe_commit(pcd->current_commit, pcd->dst); strbuf_addf(pcd->dst, ":%s", path); } - free_commit_list(pcd->revs->commits); + commit_list_free(pcd->revs->commits); pcd->revs->commits = NULL; } } diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 49dd4d00eb..cd35d1c915 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -33,7 +33,7 @@ static int stdin_diff_commit(struct commit *commit, const char *p) struct commit *parent = lookup_commit(the_repository, &oid); if (!pptr) { /* Free the real parent list */ - free_commit_list(commit->parents); + commit_list_free(commit->parents); commit->parents = NULL; pptr = &(commit->parents); } diff --git a/builtin/gc.c b/builtin/gc.c index 92c6e7b954..6c529c429e 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1166,7 +1166,7 @@ static int dfs_on_ref(const struct reference *ref, void *cb_data) } } - free_commit_list(stack); + commit_list_free(stack); return result; } diff --git a/builtin/log.c b/builtin/log.c index 5c9a8ef363..d43ca693bf 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -424,7 +424,7 @@ static int cmd_log_walk_no_free(struct rev_info *rev) */ free_commit_buffer(the_repository->parsed_objects, commit); - free_commit_list(commit->parents); + commit_list_free(commit->parents); commit->parents = NULL; } if (saved_nrl < rev->diffopt.needed_rename_limit) @@ -1697,12 +1697,12 @@ static struct commit *get_base_commit(const struct format_config *cfg, if (die_on_failure) { die(_("could not find exact merge base")); } else { - free_commit_list(base_list); + commit_list_free(base_list); return NULL; } } base = base_list->item; - free_commit_list(base_list); + commit_list_free(base_list); } else { if (die_on_failure) die(_("failed to get upstream, if you want to record base commit automatically,\n" @@ -1732,14 +1732,14 @@ static struct commit *get_base_commit(const struct format_config *cfg, if (die_on_failure) { die(_("failed to find exact merge base")); } else { - free_commit_list(merge_base); + commit_list_free(merge_base); free(rev); return NULL; } } rev[i] = merge_base->item; - free_commit_list(merge_base); + commit_list_free(merge_base); } if (rev_nr % 2) @@ -2610,7 +2610,7 @@ int cmd_cherry(int argc, print_commit(sign, commit, verbose, abbrev, revs.diffopt.file); } - free_commit_list(list); + commit_list_free(list); free_patch_ids(&ids); return 0; } diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 3f82781245..c7ee97fa6a 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -15,7 +15,7 @@ static int show_merge_base(struct commit **rev, size_t rev_nr, int show_all) if (repo_get_merge_bases_many_dirty(the_repository, rev[0], rev_nr - 1, rev + 1, &result) < 0) { - free_commit_list(result); + commit_list_free(result); return -1; } @@ -28,7 +28,7 @@ static int show_merge_base(struct commit **rev, size_t rev_nr, int show_all) break; } - free_commit_list(result); + commit_list_free(result); return 0; } @@ -71,7 +71,7 @@ static int handle_independent(int count, const char **args) for (rev = revs; rev; rev = rev->next) printf("%s\n", oid_to_hex(&rev->item->object.oid)); - free_commit_list(revs); + commit_list_free(revs); return 0; } @@ -85,11 +85,11 @@ static int handle_octopus(int count, const char **args, int show_all) commit_list_insert(get_commit_reference(args[i]), &revs); if (get_octopus_merge_bases(revs, &result) < 0) { - free_commit_list(revs); - free_commit_list(result); + commit_list_free(revs); + commit_list_free(result); return 128; } - free_commit_list(revs); + commit_list_free(revs); reduce_heads_replace(&result); if (!result) @@ -101,7 +101,7 @@ static int handle_octopus(int count, const char **args, int show_all) break; } - free_commit_list(result); + commit_list_free(result); return 0; } diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 979a55d3b2..e141fef3ce 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -485,7 +485,7 @@ static int real_merge(struct merge_tree_options *o, die(_("refusing to merge unrelated histories")); merge_bases = commit_list_reverse(merge_bases); merge_incore_recursive(&opt, merge_bases, parent1, parent2, &result); - free_commit_list(merge_bases); + commit_list_free(merge_bases); } if (result.clean < 0) diff --git a/builtin/merge.c b/builtin/merge.c index c421a11b0b..6a0831a658 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -831,7 +831,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common, LOCK_DIE_ON_ERROR); clean = merge_ort_recursive(&o, head, remoteheads->item, reversed, &result); - free_commit_list(reversed); + commit_list_free(reversed); strbuf_release(&o.obuf); if (clean < 0) { @@ -1006,7 +1006,7 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads) finish(head, remoteheads, &result_commit, "In-index merge"); remove_merge_branch_state(the_repository); - free_commit_list(parents); + commit_list_free(parents); return 0; } @@ -1022,7 +1022,7 @@ static int finish_automerge(struct commit *head, struct object_id result_commit; write_tree_trivial(result_tree); - free_commit_list(common); + commit_list_free(common); parents = remoteheads; if (!head_subsumed || fast_forward == FF_NO) commit_list_insert(head, &parents); @@ -1035,7 +1035,7 @@ static int finish_automerge(struct commit *head, strbuf_release(&buf); remove_merge_branch_state(the_repository); - free_commit_list(parents); + commit_list_free(parents); return 0; } @@ -1197,7 +1197,7 @@ static struct commit_list *reduce_parents(struct commit *head_commit, /* Find what parents to record by checking independent ones. */ parents = reduce_heads(remoteheads); - free_commit_list(remoteheads); + commit_list_free(remoteheads); remoteheads = NULL; remotes = &remoteheads; @@ -1748,7 +1748,7 @@ int cmd_merge(int argc, exit(128); common_item = common_one->item; - free_commit_list(common_one); + commit_list_free(common_one); if (!oideq(&common_item->object.oid, &j->item->object.oid)) { up_to_date = 0; break; @@ -1880,8 +1880,8 @@ int cmd_merge(int argc, done: if (!automerge_was_ok) { - free_commit_list(common); - free_commit_list(remoteheads); + commit_list_free(common); + commit_list_free(remoteheads); } strbuf_release(&buf); free(branch_to_free); diff --git a/builtin/pull.c b/builtin/pull.c index 3ff748e0b3..6ad420ce6f 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -704,14 +704,14 @@ static int get_octopus_merge_base(struct object_id *merge_base, if (get_octopus_merge_bases(revs, &result) < 0) exit(128); - free_commit_list(revs); + commit_list_free(revs); reduce_heads_replace(&result); if (!result) return 1; oidcpy(merge_base, &result->item->object.oid); - free_commit_list(result); + commit_list_free(result); return 0; } @@ -803,7 +803,7 @@ static int get_can_ff(struct object_id *orig_head, commit_list_insert(head, &list); merge_head = lookup_commit_reference(the_repository, orig_merge_head); ret = repo_is_descendant_of(the_repository, merge_head, list); - free_commit_list(list); + commit_list_free(list); if (ret < 0) exit(128); return ret; @@ -828,7 +828,7 @@ static int already_up_to_date(struct object_id *orig_head, theirs = lookup_commit_reference(the_repository, &merge_heads->oid[i]); commit_list_insert(theirs, &list); ok = repo_is_descendant_of(the_repository, ours, list); - free_commit_list(list); + commit_list_free(list); if (ok < 0) exit(128); if (!ok) diff --git a/builtin/rebase.c b/builtin/rebase.c index c468828189..c487e10907 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -912,7 +912,7 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream, res = 1; done: - free_commit_list(merge_bases); + commit_list_free(merge_bases); return res && is_linear_history(onto, head); } @@ -929,7 +929,7 @@ static void fill_branch_base(struct rebase_options *options, else oidcpy(branch_base, &merge_bases->item->object.oid); - free_commit_list(merge_bases); + commit_list_free(merge_bases); } static int parse_opt_am(const struct option *opt, const char *arg, int unset) diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 99f876ba85..ddea8aa251 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -216,7 +216,7 @@ static inline void finish_object__ma(struct object *obj, const char *name) static void finish_commit(struct commit *commit) { - free_commit_list(commit->parents); + commit_list_free(commit->parents); commit->parents = NULL; free_commit_buffer(the_repository->parsed_objects, commit); diff --git a/builtin/show-branch.c b/builtin/show-branch.c index f3ebc1d4ea..f02831b085 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -1008,7 +1008,7 @@ int cmd_show_branch(int ac, out: for (size_t i = 0; i < ARRAY_SIZE(reflog_msg); i++) free(reflog_msg[i]); - free_commit_list(seen); + commit_list_free(seen); clear_prio_queue(&queue); free(args_copy); free(head); diff --git a/builtin/stash.c b/builtin/stash.c index 4cb2351787..aea68a16aa 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1495,7 +1495,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b goto done; } - free_commit_list(parents); + commit_list_free(parents); parents = NULL; if (include_untracked) { @@ -1564,7 +1564,7 @@ done: strbuf_release(&commit_tree_label); strbuf_release(&msg); strbuf_release(&untracked_files); - free_commit_list(parents); + commit_list_free(parents); free(branch_name_buf); return ret; } @@ -2184,7 +2184,7 @@ static int do_import_stash(struct repository *r, const char *rev) out: if (this && buffer) repo_unuse_commit_buffer(r, this, buffer); - free_commit_list(items); + commit_list_free(items); free(msg); return res; @@ -2318,7 +2318,7 @@ static int do_export_stash(struct repository *r, next = commit_list_append(prev, next); next = commit_list_append(stash, next); res = write_commit_with_parents(r, &out, &stash->object.oid, parents); - free_commit_list(parents); + commit_list_free(parents); if (res) goto out; prev = lookup_commit_reference(r, &out); @@ -2330,7 +2330,7 @@ static int do_export_stash(struct repository *r, puts(oid_to_hex(&prev->object.oid)); out: strbuf_release(&revision); - free_commit_list(items); + commit_list_free(items); return res; } |
