]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: rename `free_commit_list()` to conform to coding guidelines
authorPatrick Steinhardt <ps@pks.im>
Thu, 15 Jan 2026 09:35:34 +0000 (10:35 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jan 2026 13:32:31 +0000 (05:32 -0800)
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>
40 files changed:
bisect.c
blame.c
builtin/am.c
builtin/commit-tree.c
builtin/commit.c
builtin/describe.c
builtin/diff-tree.c
builtin/gc.c
builtin/log.c
builtin/merge-base.c
builtin/merge-tree.c
builtin/merge.c
builtin/pull.c
builtin/rebase.c
builtin/rev-list.c
builtin/show-branch.c
builtin/stash.c
commit-graph.c
commit-reach.c
commit.c
commit.h
contrib/coccinelle/free.cocci
diff-lib.c
fmt-merge-msg.c
line-log.c
log-tree.c
merge-ort-wrappers.c
merge-ort.c
notes-merge.c
notes-utils.c
object-name.c
pack-bitmap-write.c
ref-filter.c
reflog.c
remote.c
revision.c
sequencer.c
shallow.c
submodule.c
t/helper/test-reach.c

index 326b59c0dc70e7fe67eeadfb2d691790262d7bbc..b313f1324009b69e10468c8bab097482114254f0 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -257,7 +257,7 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
                        p = p->next;
        }
        if (p) {
-               free_commit_list(p->next);
+               commit_list_free(p->next);
                p->next = NULL;
        }
        strbuf_release(&buf);
@@ -438,7 +438,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
        if (best) {
                if (!(bisect_flags & FIND_BISECTION_ALL)) {
                        list->item = best->item;
-                       free_commit_list(list->next);
+                       commit_list_free(list->next);
                        best = list;
                        best->next = NULL;
                }
@@ -559,8 +559,8 @@ struct commit_list *filter_skipped(struct commit_list *list,
                } else {
                        if (!show_all) {
                                if (!skipped_first || !*skipped_first) {
-                                       free_commit_list(next);
-                                       free_commit_list(filtered);
+                                       commit_list_free(next);
+                                       commit_list_free(filtered);
                                        return list;
                                }
                        } else if (skipped_first && !*skipped_first) {
@@ -879,7 +879,7 @@ static enum bisect_error check_merge_bases(size_t rev_nr, struct commit **rev, i
                }
        }
 
-       free_commit_list(result);
+       commit_list_free(result);
        return res;
 }
 
@@ -1142,7 +1142,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
 
        res = bisect_checkout(bisect_rev, no_checkout);
 cleanup:
-       free_commit_list(tried);
+       commit_list_free(tried);
        release_revisions(&revs);
        strvec_clear(&rev_argv);
        return res;
diff --git a/blame.c b/blame.c
index cb0b08342308ef7599791abbcf4148e442a7c68e..a3c49d132e4ae1c7bc67b1d1c110e2d87099aa25 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -2368,7 +2368,7 @@ static struct commit_list *first_scapegoat(struct rev_info *revs, struct commit
                if (revs->first_parent_only &&
                    commit->parents &&
                    commit->parents->next) {
-                       free_commit_list(commit->parents->next);
+                       commit_list_free(commit->parents->next);
                        commit->parents->next = NULL;
                }
                return commit->parents;
index 277c2e7937dcc1f4d2e6e7bfb33df0c13fda64db..97a7b1d46a289296841c2a0d99f8edf3497fa6b3 100644 (file)
@@ -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);
 }
 
index 5189e685a7eccd5d6f7ec007f7b2db3c9b8d64dd..30535db131eaa6a3309e6e4383d17dbd8ce4fb57 100644 (file)
@@ -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;
 }
index 0aa3690b04b9554fecc0762c2dfdeaa578114210..b1315b512bd12d5979c8e869af7e6e367c3b4a3b 100644 (file)
@@ -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);
index 989a78d715d525ed925434986ff8c54063fe6217..abfe3525a5385bfa4dd302b35a92c0902a6da517 100644 (file)
@@ -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;
        }
 }
index 49dd4d00ebf1bcc644383ee99df3a9e05502b89b..cd35d1c91575b2fb9944774f4714137d29f39ed7 100644 (file)
@@ -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);
                }
index 92c6e7b954faffa06a6801c58052e602e4956421..6c529c429e766016c2d510f8bb88af9912186f14 100644 (file)
@@ -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;
 }
 
index 5c9a8ef3632906544a37a9bb66c4713dd774b722..d43ca693bf7a8a755c70219762ebe17e01d1d7e9 100644 (file)
@@ -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;
 }
index 3f82781245bd27d33e7c9bd3f4b40ba1d764eb07..c7ee97fa6ac62aa2c87d9bfac4606629b8c47965 100644 (file)
@@ -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;
 }
 
index 979a55d3b2983fb0810633fe855466c77b487ad0..e141fef3ce6148f351883342c53d08ad1f1b8113 100644 (file)
@@ -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)
index c421a11b0b69df13fd2ee3ebe416d1dfe1cd8bce..6a0831a6588701e565774aa86ae6ee705aded4dd 100644 (file)
@@ -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);
index 3ff748e0b3ea60d1d0d1b9a127462ae03550cdfd..6ad420ce6f9b41e9de96e04abd134735ee914550 100644 (file)
@@ -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)
index c46882818982aa516f2c0444cb7e3b9d4208753a..c487e1090779c2c6ee3a1464662a47178f354817 100644 (file)
@@ -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)
index 99f876ba857579ee8418b2256fc57e1e48022bd5..ddea8aa251a361bc8412c2fdc42d52c6233f6d5a 100644 (file)
@@ -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);
index f3ebc1d4eaf14b00118071f583ba384332145941..f02831b08500c445b0d0610390e21c08ad6b0fc3 100644 (file)
@@ -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);
index 4cb2351787c33dcb1fe5eef6a2b82d6c441a49e2..aea68a16aab27e4a4c19c3e0036b3c7bd5d75229 100644 (file)
@@ -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;
 }
index 00e8193adcab81d01783f0f35afe16657e5b632e..ed480c053791548cb1cb7c78b126eede357f2471 100644 (file)
@@ -965,7 +965,7 @@ static int fill_commit_in_graph(struct commit *item,
        do {
                if (g->chunk_extra_edges_size / sizeof(uint32_t) <= parent_data_pos) {
                        error(_("commit-graph extra-edges pointer out of bounds"));
-                       free_commit_list(item->parents);
+                       commit_list_free(item->parents);
                        item->parents = NULL;
                        item->object.parsed = 0;
                        return 0;
index e7d9b3208fabc456d8ccfa0442417bb8b782401e..9604bbdcce2f35ffd947ec0e16fed4e5204edbca 100644 (file)
@@ -109,7 +109,7 @@ static int paint_down_to_common(struct repository *r,
                                continue;
                        if (repo_parse_commit(r, p)) {
                                clear_prio_queue(&queue);
-                               free_commit_list(*result);
+                               commit_list_free(*result);
                                *result = NULL;
                                /*
                                 * At this stage, we know that the commit is
@@ -166,7 +166,7 @@ static int merge_bases_many(struct repository *r,
        }
 
        if (paint_down_to_common(r, one, n, twos, 0, 0, &list)) {
-               free_commit_list(list);
+               commit_list_free(list);
                return -1;
        }
 
@@ -195,8 +195,8 @@ int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result)
                        struct commit_list *bases = NULL;
                        if (repo_get_merge_bases(the_repository, i->item,
                                                 j->item, &bases) < 0) {
-                               free_commit_list(bases);
-                               free_commit_list(*result);
+                               commit_list_free(bases);
+                               commit_list_free(*result);
                                *result = NULL;
                                return -1;
                        }
@@ -207,7 +207,7 @@ int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result)
                        for (k = bases; k; k = k->next)
                                end = k;
                }
-               free_commit_list(*result);
+               commit_list_free(*result);
                *result = new_commits;
        }
        return 0;
@@ -249,7 +249,7 @@ static int remove_redundant_no_gen(struct repository *r,
                                         work, min_generation, 0, &common)) {
                        clear_commit_marks(array[i], all_flags);
                        clear_commit_marks_many(filled, work, all_flags);
-                       free_commit_list(common);
+                       commit_list_free(common);
                        free(work);
                        free(redundant);
                        free(filled_index);
@@ -262,7 +262,7 @@ static int remove_redundant_no_gen(struct repository *r,
                                redundant[filled_index[j]] = 1;
                clear_commit_marks(array[i], all_flags);
                clear_commit_marks_many(filled, work, all_flags);
-               free_commit_list(common);
+               commit_list_free(common);
        }
 
        /* Now collect the result */
@@ -374,7 +374,7 @@ static int remove_redundant_with_gen(struct repository *r,
                        if (!parents)
                                pop_commit(&stack);
                }
-               free_commit_list(stack);
+               commit_list_free(stack);
        }
        free(sorted);
 
@@ -451,7 +451,7 @@ static int get_merge_bases_many_0(struct repository *r,
        CALLOC_ARRAY(rslt, cnt);
        for (list = *result, i = 0; list; list = list->next)
                rslt[i++] = list->item;
-       free_commit_list(*result);
+       commit_list_free(*result);
        *result = NULL;
 
        clear_commit_marks(one, all_flags);
@@ -510,7 +510,7 @@ int repo_is_descendant_of(struct repository *r,
                int result;
                commit_list_insert(commit, &from_list);
                result = can_all_from_reach(from_list, with_commit, 0);
-               free_commit_list(from_list);
+               commit_list_free(from_list);
                return result;
        } else {
                while (with_commit) {
@@ -561,7 +561,7 @@ int repo_in_merge_bases_many(struct repository *r, struct commit *commit,
                ret = 1;
        clear_commit_marks(commit, all_flags);
        clear_commit_marks_many(nr_reference, reference, all_flags);
-       free_commit_list(bases);
+       commit_list_free(bases);
        return ret;
 }
 
@@ -578,7 +578,7 @@ int repo_in_merge_bases(struct repository *r,
 
        next = commit_list_append(commit, next);
        res = repo_is_descendant_of(r, reference, list);
-       free_commit_list(list);
+       commit_list_free(list);
 
        return res;
 }
@@ -626,7 +626,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
 void reduce_heads_replace(struct commit_list **heads)
 {
        struct commit_list *result = reduce_heads(*heads);
-       free_commit_list(*heads);
+       commit_list_free(*heads);
        *heads = result;
 }
 
@@ -661,7 +661,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
                                    new_commit, old_commit_list);
        if (ret < 0)
                exit(128);
-       free_commit_list(old_commit_list);
+       commit_list_free(old_commit_list);
        return ret;
 }
 
@@ -1236,7 +1236,7 @@ void tips_reachable_from_bases(struct repository *r,
 done:
        free(commits);
        repo_clear_commit_marks(r, SEEN);
-       free_commit_list(stack);
+       commit_list_free(stack);
 }
 
 /*
index 36f02c96aabb9d4217f732bd8918d3591505a972..ddda9ee19d6538ad7894b4aa526448587aebb24a 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -191,7 +191,7 @@ void unparse_commit(struct repository *r, const struct object_id *oid)
 
        if (!c->object.parsed)
                return;
-       free_commit_list(c->parents);
+       commit_list_free(c->parents);
        c->parents = NULL;
        c->object.parsed = 0;
 }
@@ -436,7 +436,7 @@ void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
        set_commit_tree(c, NULL);
        free_commit_buffer(pool, c);
        c->index = 0;
-       free_commit_list(c->parents);
+       commit_list_free(c->parents);
 
        c->object.parsed = 0;
 }
@@ -480,7 +480,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
         * same error, but that's good, since it lets our caller know
         * the result cannot be trusted.
         */
-       free_commit_list(item->parents);
+       commit_list_free(item->parents);
        item->parents = NULL;
 
        tail += size;
@@ -702,7 +702,7 @@ struct commit_list *commit_list_reverse(struct commit_list *list)
        return next;
 }
 
-void free_commit_list(struct commit_list *list)
+void commit_list_free(struct commit_list *list)
 {
        while (list)
                pop_commit(&list);
@@ -977,7 +977,7 @@ void sort_in_topological_order(struct commit_list **list, enum rev_sort_order so
                prio_queue_reverse(&queue);
 
        /* We no longer need the commit list */
-       free_commit_list(orig);
+       commit_list_free(orig);
 
        pptr = list;
        *list = NULL;
@@ -1107,7 +1107,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
 
 cleanup_return:
        free(revs.commit);
-       free_commit_list(bases);
+       commit_list_free(bases);
        free(full_refname);
        return ret;
 }
index f50d9e5a4abe918ddcd090dae286f9ac9f49f726..1635de418b59e0797d556dce85de93e11a062afa 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -191,7 +191,7 @@ struct commit_list *commit_list_copy(const struct commit_list *list);
 /* Modify list in-place to reverse it, returning new head; list will be tail */
 struct commit_list *commit_list_reverse(struct commit_list *list);
 
-void free_commit_list(struct commit_list *list);
+void commit_list_free(struct commit_list *list);
 
 /*
  * Deprecated compatibility functions for `struct commit_list`, to be removed
@@ -207,6 +207,11 @@ static inline struct commit_list *reverse_commit_list(struct commit_list *l)
        return commit_list_reverse(l);
 }
 
+static inline void free_commit_list(struct commit_list *l)
+{
+       commit_list_free(l);
+}
+
 struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
 
 const char *repo_logmsg_reencode(struct repository *r,
index 6fb9eb6e88379a8897ca65057af3291e90a15be3..03799e190828fa01258020f9b18f8d603dfccb66 100644 (file)
@@ -5,7 +5,7 @@ expression E;
 (
   free(E);
 |
-  free_commit_list(E);
+  commit_list_free(E);
 )
 
 @@
@@ -15,7 +15,7 @@ expression E;
 (
   free(E);
 |
-  free_commit_list(E);
+  commit_list_free(E);
 )
 
 @@
@@ -30,7 +30,7 @@ expression E;
 @@
 - if (E)
 - {
-  free_commit_list(E);
+  commit_list_free(E);
   E = NULL;
 - }
 
@@ -41,5 +41,5 @@ statement S;
 - if (E) {
 + if (E)
   S
-  free_commit_list(E);
+  commit_list_free(E);
 - }
index 5307390ff3db7bd90cc01913cefb76eb5e1a5d9d..4772e5a561717a524051519a92a92995a4adf010 100644 (file)
@@ -615,7 +615,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
 
        oidcpy(mb, &merge_bases->item->object.oid);
 
-       free_commit_list(merge_bases);
+       commit_list_free(merge_bases);
 }
 
 void run_diff_index(struct rev_info *revs, unsigned int option)
index c9085edc40e934713dff459735fe2839563dfd14..877a7daed5c268fb995cbb27556ed29b4c43e22c 100644 (file)
@@ -421,7 +421,7 @@ static void shortlog(const char *name,
 
        clear_commit_marks((struct commit *)branch, flags);
        clear_commit_marks(head, flags);
-       free_commit_list(rev->commits);
+       commit_list_free(rev->commits);
        rev->commits = NULL;
        rev->pending.nr = 0;
 
index 8bd422148dd4926ed059b5f548bf8d3649d55368..eeaf68454e224671e81e255027f4c66838e48f4a 100644 (file)
@@ -1239,7 +1239,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
                         * don't follow any other path in history
                         */
                        add_line_range(rev, parent, cand[i]);
-                       free_commit_list(commit->parents);
+                       commit_list_free(commit->parents);
                        commit_list_append(parent, &commit->parents);
 
                        ret = 0;
index 1729b0c201271b147259482a448cf4bf07615a41..7e048701d0c5b47cb30fbea159b48bb785dd3b96 100644 (file)
@@ -1077,7 +1077,7 @@ static int do_remerge_diff(struct rev_info *opt,
        log_tree_diff_flush(opt);
 
        /* Cleanup */
-       free_commit_list(bases);
+       commit_list_free(bases);
        cleanup_additional_headers(&opt->diffopt);
        strbuf_release(&parent1_desc);
        strbuf_release(&parent2_desc);
index c54d56b34465bf322f99ccc859193f8ab515ebaa..2110844f5331c15a996ef7ed4681ef2a2fb3ad71 100644 (file)
@@ -120,7 +120,7 @@ int merge_ort_generic(struct merge_options *opt,
        repo_hold_locked_index(opt->repo, &lock, LOCK_DIE_ON_ERROR);
        clean = merge_ort_recursive(opt, head_commit, next_commit, ca,
                                    result);
-       free_commit_list(ca);
+       commit_list_free(ca);
        if (clean < 0) {
                rollback_lock_file(&lock);
                return clean;
index 2ddaaffc263d465d83b7ebfaa343cd5863587f8b..0c755361cdb9ee7aec7829c54a728e34b2101898 100644 (file)
@@ -5382,7 +5382,7 @@ static void merge_ort_internal(struct merge_options *opt,
        opt->ancestor = NULL;  /* avoid accidental re-use of opt->ancestor */
 
 out:
-       free_commit_list(merge_bases);
+       commit_list_free(merge_bases);
 }
 
 void merge_incore_nonrecursive(struct merge_options *opt,
index 586939939f24516e5ca5226323118904e46c63e4..49d0dadd32e4276ad6a07d4eb01dc6cd6430b4f1 100644 (file)
@@ -668,11 +668,11 @@ int notes_merge(struct notes_merge_options *o,
                commit_list_insert(local, &parents);
                create_notes_commit(o->repo, local_tree, parents, o->commit_msg.buf,
                                    o->commit_msg.len, result_oid);
-               free_commit_list(parents);
+               commit_list_free(parents);
        }
 
 found_result:
-       free_commit_list(bases);
+       commit_list_free(bases);
        strbuf_release(&(o->commit_msg));
        trace_printf("notes_merge(): result = %i, result_oid = %.7s\n",
               result, oid_to_hex(result_oid));
index 6a50c6d56466d5ec43cc5dd169e024b77aff9e78..5c1c75d5b8099a59981a4d667b091348faf45d3f 100644 (file)
@@ -40,7 +40,7 @@ void create_notes_commit(struct repository *r,
                        NULL))
                die("Failed to commit notes tree to database");
 
-       free_commit_list(parents_to_free);
+       commit_list_free(parents_to_free);
 }
 
 void commit_notes(struct repository *r, struct notes_tree *t, const char *msg)
index 8b862c124e05a9270afa7b83e6f7871f0a8a15cc..e697566423a075828f78d5f296c05303ceea4762 100644 (file)
@@ -1281,7 +1281,7 @@ static int peel_onion(struct repository *r, const char *name, int len,
                commit_list_insert((struct commit *)o, &list);
                ret = get_oid_oneline(r, prefix, oid, list);
 
-               free_commit_list(list);
+               commit_list_free(list);
                free(prefix);
                return ret;
        }
@@ -1623,7 +1623,7 @@ int repo_get_oid_mb(struct repository *r,
        if (!two)
                return -1;
        if (repo_get_merge_bases(r, one, two, &mbs) < 0) {
-               free_commit_list(mbs);
+               commit_list_free(mbs);
                return -1;
        }
        if (!mbs || mbs->next)
@@ -1632,7 +1632,7 @@ int repo_get_oid_mb(struct repository *r,
                st = 0;
                oidcpy(oid, &mbs->item->object.oid);
        }
-       free_commit_list(mbs);
+       commit_list_free(mbs);
        return st;
 }
 
@@ -2052,7 +2052,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
                        refs_head_ref(get_main_ref_store(repo), handle_one_ref, &cb);
                        ret = get_oid_oneline(repo, name + 2, oid, list);
 
-                       free_commit_list(list);
+                       commit_list_free(list);
                        return ret;
                }
                if (namelen < 3 ||
index bf73ce5710abcc029832061fd2c5463ddafd3145..2e3f1c1530bad534e592e73c196983c70ecd7d4a 100644 (file)
@@ -306,7 +306,7 @@ struct bb_commit {
 
 static void clear_bb_commit(struct bb_commit *commit)
 {
-       free_commit_list(commit->reverse_edges);
+       commit_list_free(commit->reverse_edges);
        bitmap_free(commit->commit_mask);
        bitmap_free(commit->bitmap);
 }
@@ -414,7 +414,7 @@ static void bitmap_builder_init(struct bitmap_builder *bb,
                                p_ent->maximal = 1;
                        else {
                                p_ent->maximal = 0;
-                               free_commit_list(p_ent->reverse_edges);
+                               commit_list_free(p_ent->reverse_edges);
                                p_ent->reverse_edges = NULL;
                        }
 
@@ -445,7 +445,7 @@ next:
                           "num_maximal_commits", num_maximal);
 
        release_revisions(&revs);
-       free_commit_list(reusable);
+       commit_list_free(reusable);
 }
 
 static void bitmap_builder_clear(struct bitmap_builder *bb)
index c318f9ca0ec8dd6f4d877ba2f89390e3272ec52e..3917c4ccd9f73ab80f4e37209ba788e767ba2d5a 100644 (file)
@@ -3782,9 +3782,9 @@ void ref_filter_clear(struct ref_filter *filter)
 {
        strvec_clear(&filter->exclude);
        oid_array_clear(&filter->points_at);
-       free_commit_list(filter->with_commit);
-       free_commit_list(filter->no_commit);
-       free_commit_list(filter->reachable_from);
-       free_commit_list(filter->unreachable_from);
+       commit_list_free(filter->with_commit);
+       commit_list_free(filter->no_commit);
+       commit_list_free(filter->reachable_from);
+       commit_list_free(filter->unreachable_from);
        ref_filter_init(filter);
 }
index ac87e20c4f97fffbc933ab0d193cc72541cbfad9..1460ae9d0dd5f7be0df02027aedb1f3cec3674e6 100644 (file)
--- a/reflog.c
+++ b/reflog.c
@@ -493,7 +493,7 @@ void reflog_expiry_cleanup(void *cb_data)
        case UE_HEAD:
                for (elem = cb->tips; elem; elem = elem->next)
                        clear_commit_marks(elem->item, REACHABLE);
-               free_commit_list(cb->tips);
+               commit_list_free(cb->tips);
                break;
        case UE_NORMAL:
                clear_commit_marks(cb->tip_commit, REACHABLE);
@@ -501,7 +501,7 @@ void reflog_expiry_cleanup(void *cb_data)
        }
        for (elem = cb->mark_list; elem; elem = elem->next)
                clear_commit_marks(elem->item, REACHABLE);
-       free_commit_list(cb->mark_list);
+       commit_list_free(cb->mark_list);
 }
 
 int count_reflog_ent(const char *refname UNUSED,
index b756ff6f1594d99749e65c9e73d8564c164cc146..1c8a9f1a888dd2710d911c27d73b8940bbbca79a 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1497,7 +1497,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds
                clear_commit_marks_many(src_commits.nr, src_commits.items,
                                        reachable_flag);
                commit_stack_clear(&src_commits);
-               free_commit_list(found_commits);
+               commit_list_free(found_commits);
        }
 
        string_list_clear(&src_tag, 0);
index 9f5baceb85f2b33721a8cb81f10b76b350d64867..6d207c2f23ba62e7309746813ae3f4dbc62cd2fd 100644 (file)
@@ -1048,7 +1048,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
                                continue;
                        }
 
-                       free_commit_list(parent->next);
+                       commit_list_free(parent->next);
                        parent->next = NULL;
                        while (commit->parents != parent)
                                pop_commit(&commit->parents);
@@ -1083,7 +1083,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
                                        die("cannot simplify commit %s (invalid %s)",
                                            oid_to_hex(&commit->object.oid),
                                            oid_to_hex(&p->object.oid));
-                               free_commit_list(p->parents);
+                               commit_list_free(p->parents);
                                p->parents = NULL;
                        }
                /* fallthrough */
@@ -1405,7 +1405,7 @@ static void limit_to_ancestry(struct commit_list *bottoms, struct commit_list *l
                p->item->object.flags &= ~(TMP_MARK | ANCESTRY_PATH);
        for (p = bottoms; p; p = p->next)
                p->item->object.flags &= ~(TMP_MARK | ANCESTRY_PATH);
-       free_commit_list(rlist);
+       commit_list_free(rlist);
 }
 
 /*
@@ -1508,7 +1508,7 @@ static int limit_list(struct rev_info *revs)
                }
        }
 
-       free_commit_list(original_list);
+       commit_list_free(original_list);
        revs->commits = newlist;
        return 0;
 }
@@ -2011,7 +2011,7 @@ static void prepare_show_merge(struct rev_info *revs)
                exit(128);
        add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);
        add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);
-       free_commit_list(bases);
+       commit_list_free(bases);
        head->object.flags |= SYMMETRIC_LEFT;
 
        if (!istate->cache_nr)
@@ -2105,13 +2105,13 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
                        return dotdot_missing(arg, dotdot, revs, symmetric);
 
                if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0) {
-                       free_commit_list(exclude);
+                       commit_list_free(exclude);
                        return -1;
                }
                add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,
                                     flags_exclude);
                add_pending_commit_list(revs, exclude, flags_exclude);
-               free_commit_list(exclude);
+               commit_list_free(exclude);
 
                b_flags = flags;
                a_flags = flags | SYMMETRIC_LEFT;
@@ -3221,13 +3221,13 @@ static void release_revisions_bloom_keyvecs(struct rev_info *revs)
 
 static void free_void_commit_list(void *list)
 {
-       free_commit_list(list);
+       commit_list_free(list);
 }
 
 void release_revisions(struct rev_info *revs)
 {
-       free_commit_list(revs->commits);
-       free_commit_list(revs->ancestry_path_bottoms);
+       commit_list_free(revs->commits);
+       commit_list_free(revs->ancestry_path_bottoms);
        release_display_notes(&revs->notes_opt);
        object_array_clear(&revs->pending);
        object_array_clear(&revs->boundary_commits);
@@ -3335,7 +3335,7 @@ static int mark_redundant_parents(struct commit *commit)
        if (i != cnt || cnt+marked != orig_cnt)
                die("mark_redundant_parents %d %d %d %d", orig_cnt, cnt, i, marked);
 
-       free_commit_list(h);
+       commit_list_free(h);
 
        return marked;
 }
@@ -4232,7 +4232,7 @@ static void save_parents(struct rev_info *revs, struct commit *commit)
 static void free_saved_parent(struct commit_list **parents)
 {
        if (*parents != EMPTY_PARENT_LIST)
-               free_commit_list(*parents);
+               commit_list_free(*parents);
 }
 
 static void free_saved_parents(struct rev_info *revs)
@@ -4293,7 +4293,7 @@ static void track_linear(struct rev_info *revs, struct commit *commit)
                if (revs->linear)
                        commit->object.flags |= TRACK_LINEAR;
        }
-       free_commit_list(revs->previous_parents);
+       commit_list_free(revs->previous_parents);
        revs->previous_parents = commit_list_copy(commit->parents);
 }
 
@@ -4382,7 +4382,7 @@ static void create_boundary_commit_list(struct rev_info *revs)
         * boundary commits anyway.  (This is what the code has always
         * done.)
         */
-       free_commit_list(revs->commits);
+       commit_list_free(revs->commits);
        revs->commits = NULL;
 
        /*
@@ -4504,7 +4504,7 @@ struct commit *get_revision(struct rev_info *revs)
                reversed = NULL;
                while ((c = get_revision_internal(revs)))
                        commit_list_insert(c, &reversed);
-               free_commit_list(revs->commits);
+               commit_list_free(revs->commits);
                revs->commits = reversed;
                revs->reverse = 0;
                revs->reverse_output_stage = 1;
@@ -4522,7 +4522,7 @@ struct commit *get_revision(struct rev_info *revs)
                graph_update(revs->graph, c);
        if (!c) {
                free_saved_parents(revs);
-               free_commit_list(revs->previous_parents);
+               commit_list_free(revs->previous_parents);
                revs->previous_parents = NULL;
        }
        return c;
index e09f8eed5514258a6c7bbbbc91f41796340e8f5b..f5a6496937a8931af80897877af15d3ed38d961f 100644 (file)
@@ -1698,7 +1698,7 @@ static int try_to_commit(struct repository *r,
 
 out:
        free_commit_extra_headers(extra);
-       free_commit_list(parents);
+       commit_list_free(parents);
        strbuf_release(&err);
        strbuf_release(&commit_msg);
        free(amend_author);
@@ -2476,8 +2476,8 @@ static int do_pick_commit(struct repository *r,
                res |= try_merge_command(r, opts->strategy,
                                         opts->xopts.nr, opts->xopts.v,
                                        common, oid_to_hex(&head), remotes);
-               free_commit_list(common);
-               free_commit_list(remotes);
+               commit_list_free(common);
+               commit_list_free(remotes);
        }
 
        /*
@@ -4381,8 +4381,8 @@ static int do_merge(struct repository *r,
 leave_merge:
        strbuf_release(&ref_name);
        rollback_lock_file(&lock);
-       free_commit_list(to_merge);
-       free_commit_list(bases);
+       commit_list_free(to_merge);
+       commit_list_free(bases);
        return ret;
 }
 
@@ -6039,11 +6039,11 @@ static int make_script_with_merges(struct pretty_print_context *pp,
                        oidset_insert(&shown, oid);
                }
 
-               free_commit_list(list);
+               commit_list_free(list);
        }
 
-       free_commit_list(commits);
-       free_commit_list(tips);
+       commit_list_free(commits);
+       commit_list_free(tips);
 
        strbuf_release(&label_from_message);
        strbuf_release(&oneline);
index c870efcefcac4aa8a13a24bdf978b4228730cc98..0409b1354cb5f8af371d75f50a8c71da77a4c99b 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -40,7 +40,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)
        oidcpy(&graft->oid, oid);
        graft->nr_parent = -1;
        if (commit && commit->object.parsed) {
-               free_commit_list(commit->parents);
+               commit_list_free(commit->parents);
                commit->parents = NULL;
        }
        return register_commit_graft(r, graft, 0);
@@ -267,7 +267,7 @@ struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv,
                                break;
                        }
        }
-       free_commit_list(not_shallow_list);
+       commit_list_free(not_shallow_list);
 
        /*
         * Now we can clean up NOT_SHALLOW on border commits. Having
index 40a5c6fb9d154574ee61ed15d3f2e02642e42b03..85e9586e669257994d45baa2dfb73d378deccf0f 100644 (file)
@@ -639,7 +639,7 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
        print_submodule_diff_summary(sub, &rev, o);
 
 out:
-       free_commit_list(merge_bases);
+       commit_list_free(merge_bases);
        release_revisions(&rev);
        clear_commit_marks(left, ~0);
        clear_commit_marks(right, ~0);
@@ -729,7 +729,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
 
 done:
        strbuf_release(&sb);
-       free_commit_list(merge_bases);
+       commit_list_free(merge_bases);
        if (left)
                clear_commit_marks(left, ~0);
        if (right)
index feabeb29c25d898786159cfee153ddc559aa85b6..3131b54a871c1bd61bdd99fbd84a3d3178fe8bc0 100644 (file)
@@ -120,12 +120,12 @@ int cmd__reach(int ac, const char **av)
                        exit(128);
                printf("%s(A,X):\n", av[1]);
                print_sorted_commit_ids(list);
-               free_commit_list(list);
+               commit_list_free(list);
        } else if (!strcmp(av[1], "reduce_heads")) {
                struct commit_list *list = reduce_heads(X);
                printf("%s(X):\n", av[1]);
                print_sorted_commit_ids(list);
-               free_commit_list(list);
+               commit_list_free(list);
        } else if (!strcmp(av[1], "can_all_from_reach")) {
                printf("%s(X,Y):%d\n", av[1], can_all_from_reach(X, Y, 1));
        } else if (!strcmp(av[1], "can_all_from_reach_with_flag")) {
@@ -172,13 +172,13 @@ int cmd__reach(int ac, const char **av)
                        die(_("too many commits marked reachable"));
 
                print_sorted_commit_ids(list);
-               free_commit_list(list);
+               commit_list_free(list);
        }
 
        object_array_clear(&X_obj);
        strbuf_release(&buf);
-       free_commit_list(X);
-       free_commit_list(Y);
+       commit_list_free(X);
+       commit_list_free(Y);
        commit_stack_clear(&X_stack);
        commit_stack_clear(&Y_stack);
        return 0;