commit: rename `copy_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, `copy_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>

Patrick Steinhardt committed Jan 15, 2026 at 10:35 UTC ff9fb2cfe6efb26b9d25dc5c114ab56126f9003e
6 files changed +16 -7
builtin/commit.c
+1 -1
@@ -1849,7 +1849,7 @@ int cmd_commit(int argc,
1849 } else if (amend) {
1850 if (!reflog_msg)
1851 reflog_msg = "commit (amend)";
1852 - parents = copy_commit_list(current_head->parents);
1852 + parents = commit_list_copy(current_head->parents);
1853 } else if (whence == FROM_MERGE) {
1854 struct strbuf m = STRBUF_INIT;
1855 FILE *fp;
commit.c
+1 -1
@@ -680,7 +680,7 @@ unsigned commit_list_count(const struct commit_list *l)
680 return c;
681 }
682
683 -struct commit_list *copy_commit_list(const struct commit_list *list)
683 +struct commit_list *commit_list_copy(const struct commit_list *list)
684 {
685 struct commit_list *head = NULL;
686 struct commit_list **pp = &head;
commit.h
+10 -1
@@ -186,13 +186,22 @@ struct commit_list *commit_list_insert_by_date(struct commit *item,
186 void commit_list_sort_by_date(struct commit_list **list);
187
188 /* Shallow copy of the input list */
189 -struct commit_list *copy_commit_list(const struct commit_list *list);
189 +struct commit_list *commit_list_copy(const struct commit_list *list);
190
191 /* Modify list in-place to reverse it, returning new head; list will be tail */
192 struct commit_list *reverse_commit_list(struct commit_list *list);
193
194 void free_commit_list(struct commit_list *list);
195
196 +/*
197 + * Deprecated compatibility functions for `struct commit_list`, to be removed
198 + * once Git 2.53 is released.
199 + */
200 +static inline struct commit_list *copy_commit_list(struct commit_list *l)
201 +{
202 + return commit_list_copy(l);
203 +}
204 +
205 struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
206
207 const char *repo_logmsg_reencode(struct repository *r,
merge-ort.c
+1 -1
@@ -5301,7 +5301,7 @@ static void merge_ort_internal(struct merge_options *opt,
5301 struct commit *h2,
5302 struct merge_result *result)
5303 {
5304 - struct commit_list *merge_bases = copy_commit_list(_merge_bases);
5304 + struct commit_list *merge_bases = commit_list_copy(_merge_bases);
5305 struct commit *next;
5306 struct commit *merged_merge_bases;
5307 const char *ancestor_name;
revision.c
+2 -2
@@ -4224,7 +4224,7 @@ static void save_parents(struct rev_info *revs, struct commit *commit)
4224 if (*pp)
4225 return;
4226 if (commit->parents)
4227 - *pp = copy_commit_list(commit->parents);
4227 + *pp = commit_list_copy(commit->parents);
4228 else
4229 *pp = EMPTY_PARENT_LIST;
4230 }
@@ -4294,7 +4294,7 @@ static void track_linear(struct rev_info *revs, struct commit *commit)
4294 commit->object.flags |= TRACK_LINEAR;
4295 }
4296 free_commit_list(revs->previous_parents);
4297 - revs->previous_parents = copy_commit_list(commit->parents);
4297 + revs->previous_parents = commit_list_copy(commit->parents);
4298 }
4299
4300 static struct commit *get_revision_1(struct rev_info *revs)
sequencer.c
+1 -1
@@ -1566,7 +1566,7 @@ static int try_to_commit(struct repository *r,
1566 res = error(_("unable to parse commit author"));
1567 goto out;
1568 }
1569 - parents = copy_commit_list(current_head->parents);
1569 + parents = commit_list_copy(current_head->parents);
1570 extra = read_commit_extra_headers(current_head, exclude_gpgsig);
1571 } else if (current_head &&
1572 (!(flags & CREATE_ROOT_COMMIT) || (flags & AMEND_MSG))) {