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>
Patrick Steinhardt committed
Jan 15, 2026 at 10:35 UTC
9f18d089c51fba2776fe1fece877a359c47417f7
40 files changed
+136
-131
bisect.c
+6
-6
@@ -257,7 +257,7 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
257
p = p->next;
258
}
259
if (p) {
260
- free_commit_list(p->next);
260
+ commit_list_free(p->next);
261
p->next = NULL;
262
}
263
strbuf_release(&buf);
@@ -438,7 +438,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
438
if (best) {
439
if (!(bisect_flags & FIND_BISECTION_ALL)) {
440
list->item = best->item;
441
- free_commit_list(list->next);
441
+ commit_list_free(list->next);
442
best = list;
443
best->next = NULL;
444
}
@@ -559,8 +559,8 @@ struct commit_list *filter_skipped(struct commit_list *list,
559
} else {
560
if (!show_all) {
561
if (!skipped_first || !*skipped_first) {
562
- free_commit_list(next);
563
- free_commit_list(filtered);
562
+ commit_list_free(next);
563
+ commit_list_free(filtered);
564
return list;
565
}
566
} 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
879
}
880
}
881
882
- free_commit_list(result);
882
+ commit_list_free(result);
883
return res;
884
}
885
@@ -1142,7 +1142,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
1142
1143
res = bisect_checkout(bisect_rev, no_checkout);
1144
cleanup:
1145
- free_commit_list(tried);
1145
+ commit_list_free(tried);
1146
release_revisions(&revs);
1147
strvec_clear(&rev_argv);
1148
return res;
blame.c
+1
-1
@@ -2368,7 +2368,7 @@ static struct commit_list *first_scapegoat(struct rev_info *revs, struct commit
2368
if (revs->first_parent_only &&
2369
commit->parents &&
2370
commit->parents->next) {
2371
- free_commit_list(commit->parents->next);
2371
+ commit_list_free(commit->parents->next);
2372
commit->parents->next = NULL;
2373
}
2374
return commit->parents;
builtin/am.c
+1
-1
@@ -1726,7 +1726,7 @@ static void do_commit(const struct am_state *state)
1726
1727
run_hooks(the_repository, "post-applypatch");
1728
1729
- free_commit_list(parents);
1729
+ commit_list_free(parents);
1730
strbuf_release(&sb);
1731
}
1732
builtin/commit-tree.c
+1
-1
@@ -154,7 +154,7 @@ int cmd_commit_tree(int argc,
154
ret = 0;
155
156
out:
157
- free_commit_list(parents);
157
+ commit_list_free(parents);
158
strbuf_release(&buffer);
159
return ret;
160
}
builtin/commit.c
+1
-1
@@ -1978,7 +1978,7 @@ int cmd_commit(int argc,
1978
1979
cleanup:
1980
free_commit_extra_headers(extra);
1981
- free_commit_list(parents);
1981
+ commit_list_free(parents);
1982
strbuf_release(&author_ident);
1983
strbuf_release(&err);
1984
strbuf_release(&sb);
builtin/describe.c
+1
-1
@@ -558,7 +558,7 @@ static void process_object(struct object *obj, const char *path, void *data)
558
describe_commit(pcd->current_commit, pcd->dst);
559
strbuf_addf(pcd->dst, ":%s", path);
560
}
561
- free_commit_list(pcd->revs->commits);
561
+ commit_list_free(pcd->revs->commits);
562
pcd->revs->commits = NULL;
563
}
564
}
builtin/diff-tree.c
+1
-1
@@ -33,7 +33,7 @@ static int stdin_diff_commit(struct commit *commit, const char *p)
33
struct commit *parent = lookup_commit(the_repository, &oid);
34
if (!pptr) {
35
/* Free the real parent list */
36
- free_commit_list(commit->parents);
36
+ commit_list_free(commit->parents);
37
commit->parents = NULL;
38
pptr = &(commit->parents);
39
}
builtin/gc.c
+1
-1
@@ -1166,7 +1166,7 @@ static int dfs_on_ref(const struct reference *ref, void *cb_data)
1166
}
1167
}
1168
1169
- free_commit_list(stack);
1169
+ commit_list_free(stack);
1170
return result;
1171
}
1172
builtin/log.c
+6
-6
@@ -424,7 +424,7 @@ static int cmd_log_walk_no_free(struct rev_info *rev)
424
*/
425
free_commit_buffer(the_repository->parsed_objects,
426
commit);
427
- free_commit_list(commit->parents);
427
+ commit_list_free(commit->parents);
428
commit->parents = NULL;
429
}
430
if (saved_nrl < rev->diffopt.needed_rename_limit)
@@ -1697,12 +1697,12 @@ static struct commit *get_base_commit(const struct format_config *cfg,
1697
if (die_on_failure) {
1698
die(_("could not find exact merge base"));
1699
} else {
1700
- free_commit_list(base_list);
1700
+ commit_list_free(base_list);
1701
return NULL;
1702
}
1703
}
1704
base = base_list->item;
1705
- free_commit_list(base_list);
1705
+ commit_list_free(base_list);
1706
} else {
1707
if (die_on_failure)
1708
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,
1732
if (die_on_failure) {
1733
die(_("failed to find exact merge base"));
1734
} else {
1735
- free_commit_list(merge_base);
1735
+ commit_list_free(merge_base);
1736
free(rev);
1737
return NULL;
1738
}
1739
}
1740
1741
rev[i] = merge_base->item;
1742
- free_commit_list(merge_base);
1742
+ commit_list_free(merge_base);
1743
}
1744
1745
if (rev_nr % 2)
@@ -2610,7 +2610,7 @@ int cmd_cherry(int argc,
2610
print_commit(sign, commit, verbose, abbrev, revs.diffopt.file);
2611
}
2612
2613
- free_commit_list(list);
2613
+ commit_list_free(list);
2614
free_patch_ids(&ids);
2615
return 0;
2616
}
builtin/merge-base.c
+7
-7
@@ -15,7 +15,7 @@ static int show_merge_base(struct commit **rev, size_t rev_nr, int show_all)
15
16
if (repo_get_merge_bases_many_dirty(the_repository, rev[0],
17
rev_nr - 1, rev + 1, &result) < 0) {
18
- free_commit_list(result);
18
+ commit_list_free(result);
19
return -1;
20
}
21
@@ -28,7 +28,7 @@ static int show_merge_base(struct commit **rev, size_t rev_nr, int show_all)
28
break;
29
}
30
31
- free_commit_list(result);
31
+ commit_list_free(result);
32
return 0;
33
}
34
@@ -71,7 +71,7 @@ static int handle_independent(int count, const char **args)
71
for (rev = revs; rev; rev = rev->next)
72
printf("%s\n", oid_to_hex(&rev->item->object.oid));
73
74
- free_commit_list(revs);
74
+ commit_list_free(revs);
75
return 0;
76
}
77
@@ -85,11 +85,11 @@ static int handle_octopus(int count, const char **args, int show_all)
85
commit_list_insert(get_commit_reference(args[i]), &revs);
86
87
if (get_octopus_merge_bases(revs, &result) < 0) {
88
- free_commit_list(revs);
89
- free_commit_list(result);
88
+ commit_list_free(revs);
89
+ commit_list_free(result);
90
return 128;
91
}
92
- free_commit_list(revs);
92
+ commit_list_free(revs);
93
reduce_heads_replace(&result);
94
95
if (!result)
@@ -101,7 +101,7 @@ static int handle_octopus(int count, const char **args, int show_all)
101
break;
102
}
103
104
- free_commit_list(result);
104
+ commit_list_free(result);
105
return 0;
106
}
107
builtin/merge-tree.c
+1
-1
@@ -485,7 +485,7 @@ static int real_merge(struct merge_tree_options *o,
485
die(_("refusing to merge unrelated histories"));
486
merge_bases = commit_list_reverse(merge_bases);
487
merge_incore_recursive(&opt, merge_bases, parent1, parent2, &result);
488
- free_commit_list(merge_bases);
488
+ commit_list_free(merge_bases);
489
}
490
491
if (result.clean < 0)
builtin/merge.c
+8
-8
@@ -831,7 +831,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
831
LOCK_DIE_ON_ERROR);
832
clean = merge_ort_recursive(&o, head, remoteheads->item,
833
reversed, &result);
834
- free_commit_list(reversed);
834
+ commit_list_free(reversed);
835
strbuf_release(&o.obuf);
836
837
if (clean < 0) {
@@ -1006,7 +1006,7 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
1006
finish(head, remoteheads, &result_commit, "In-index merge");
1007
1008
remove_merge_branch_state(the_repository);
1009
- free_commit_list(parents);
1009
+ commit_list_free(parents);
1010
return 0;
1011
}
1012
@@ -1022,7 +1022,7 @@ static int finish_automerge(struct commit *head,
1022
struct object_id result_commit;
1023
1024
write_tree_trivial(result_tree);
1025
- free_commit_list(common);
1025
+ commit_list_free(common);
1026
parents = remoteheads;
1027
if (!head_subsumed || fast_forward == FF_NO)
1028
commit_list_insert(head, &parents);
@@ -1035,7 +1035,7 @@ static int finish_automerge(struct commit *head,
1035
1036
strbuf_release(&buf);
1037
remove_merge_branch_state(the_repository);
1038
- free_commit_list(parents);
1038
+ commit_list_free(parents);
1039
return 0;
1040
}
1041
@@ -1197,7 +1197,7 @@ static struct commit_list *reduce_parents(struct commit *head_commit,
1197
1198
/* Find what parents to record by checking independent ones. */
1199
parents = reduce_heads(remoteheads);
1200
- free_commit_list(remoteheads);
1200
+ commit_list_free(remoteheads);
1201
1202
remoteheads = NULL;
1203
remotes = &remoteheads;
@@ -1748,7 +1748,7 @@ int cmd_merge(int argc,
1748
exit(128);
1749
1750
common_item = common_one->item;
1751
- free_commit_list(common_one);
1751
+ commit_list_free(common_one);
1752
if (!oideq(&common_item->object.oid, &j->item->object.oid)) {
1753
up_to_date = 0;
1754
break;
@@ -1880,8 +1880,8 @@ int cmd_merge(int argc,
1880
1881
done:
1882
if (!automerge_was_ok) {
1883
- free_commit_list(common);
1884
- free_commit_list(remoteheads);
1883
+ commit_list_free(common);
1884
+ commit_list_free(remoteheads);
1885
}
1886
strbuf_release(&buf);
1887
free(branch_to_free);
builtin/pull.c
+4
-4
@@ -704,14 +704,14 @@ static int get_octopus_merge_base(struct object_id *merge_base,
704
705
if (get_octopus_merge_bases(revs, &result) < 0)
706
exit(128);
707
- free_commit_list(revs);
707
+ commit_list_free(revs);
708
reduce_heads_replace(&result);
709
710
if (!result)
711
return 1;
712
713
oidcpy(merge_base, &result->item->object.oid);
714
- free_commit_list(result);
714
+ commit_list_free(result);
715
return 0;
716
}
717
@@ -803,7 +803,7 @@ static int get_can_ff(struct object_id *orig_head,
803
commit_list_insert(head, &list);
804
merge_head = lookup_commit_reference(the_repository, orig_merge_head);
805
ret = repo_is_descendant_of(the_repository, merge_head, list);
806
- free_commit_list(list);
806
+ commit_list_free(list);
807
if (ret < 0)
808
exit(128);
809
return ret;
@@ -828,7 +828,7 @@ static int already_up_to_date(struct object_id *orig_head,
828
theirs = lookup_commit_reference(the_repository, &merge_heads->oid[i]);
829
commit_list_insert(theirs, &list);
830
ok = repo_is_descendant_of(the_repository, ours, list);
831
- free_commit_list(list);
831
+ commit_list_free(list);
832
if (ok < 0)
833
exit(128);
834
if (!ok)
builtin/rebase.c
+2
-2
@@ -912,7 +912,7 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,
912
res = 1;
913
914
done:
915
- free_commit_list(merge_bases);
915
+ commit_list_free(merge_bases);
916
return res && is_linear_history(onto, head);
917
}
918
@@ -929,7 +929,7 @@ static void fill_branch_base(struct rebase_options *options,
929
else
930
oidcpy(branch_base, &merge_bases->item->object.oid);
931
932
- free_commit_list(merge_bases);
932
+ commit_list_free(merge_bases);
933
}
934
935
static int parse_opt_am(const struct option *opt, const char *arg, int unset)
builtin/rev-list.c
+1
-1
@@ -216,7 +216,7 @@ static inline void finish_object__ma(struct object *obj, const char *name)
216
217
static void finish_commit(struct commit *commit)
218
{
219
- free_commit_list(commit->parents);
219
+ commit_list_free(commit->parents);
220
commit->parents = NULL;
221
free_commit_buffer(the_repository->parsed_objects,
222
commit);
builtin/show-branch.c
+1
-1
@@ -1008,7 +1008,7 @@ int cmd_show_branch(int ac,
1008
out:
1009
for (size_t i = 0; i < ARRAY_SIZE(reflog_msg); i++)
1010
free(reflog_msg[i]);
1011
- free_commit_list(seen);
1011
+ commit_list_free(seen);
1012
clear_prio_queue(&queue);
1013
free(args_copy);
1014
free(head);
builtin/stash.c
+5
-5
@@ -1495,7 +1495,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
1495
goto done;
1496
}
1497
1498
- free_commit_list(parents);
1498
+ commit_list_free(parents);
1499
parents = NULL;
1500
1501
if (include_untracked) {
@@ -1564,7 +1564,7 @@ done:
1564
strbuf_release(&commit_tree_label);
1565
strbuf_release(&msg);
1566
strbuf_release(&untracked_files);
1567
- free_commit_list(parents);
1567
+ commit_list_free(parents);
1568
free(branch_name_buf);
1569
return ret;
1570
}
@@ -2184,7 +2184,7 @@ static int do_import_stash(struct repository *r, const char *rev)
2184
out:
2185
if (this && buffer)
2186
repo_unuse_commit_buffer(r, this, buffer);
2187
- free_commit_list(items);
2187
+ commit_list_free(items);
2188
free(msg);
2189
2190
return res;
@@ -2318,7 +2318,7 @@ static int do_export_stash(struct repository *r,
2318
next = commit_list_append(prev, next);
2319
next = commit_list_append(stash, next);
2320
res = write_commit_with_parents(r, &out, &stash->object.oid, parents);
2321
- free_commit_list(parents);
2321
+ commit_list_free(parents);
2322
if (res)
2323
goto out;
2324
prev = lookup_commit_reference(r, &out);
@@ -2330,7 +2330,7 @@ static int do_export_stash(struct repository *r,
2330
puts(oid_to_hex(&prev->object.oid));
2331
out:
2332
strbuf_release(&revision);
2333
- free_commit_list(items);
2333
+ commit_list_free(items);
2334
2335
return res;
2336
}
commit-graph.c
+1
-1
@@ -965,7 +965,7 @@ static int fill_commit_in_graph(struct commit *item,
965
do {
966
if (g->chunk_extra_edges_size / sizeof(uint32_t) <= parent_data_pos) {
967
error(_("commit-graph extra-edges pointer out of bounds"));
968
- free_commit_list(item->parents);
968
+ commit_list_free(item->parents);
969
item->parents = NULL;
970
item->object.parsed = 0;
971
return 0;
commit-reach.c
+15
-15
@@ -109,7 +109,7 @@ static int paint_down_to_common(struct repository *r,
109
continue;
110
if (repo_parse_commit(r, p)) {
111
clear_prio_queue(&queue);
112
- free_commit_list(*result);
112
+ commit_list_free(*result);
113
*result = NULL;
114
/*
115
* At this stage, we know that the commit is
@@ -166,7 +166,7 @@ static int merge_bases_many(struct repository *r,
166
}
167
168
if (paint_down_to_common(r, one, n, twos, 0, 0, &list)) {
169
- free_commit_list(list);
169
+ commit_list_free(list);
170
return -1;
171
}
172
@@ -195,8 +195,8 @@ int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result)
195
struct commit_list *bases = NULL;
196
if (repo_get_merge_bases(the_repository, i->item,
197
j->item, &bases) < 0) {
198
- free_commit_list(bases);
199
- free_commit_list(*result);
198
+ commit_list_free(bases);
199
+ commit_list_free(*result);
200
*result = NULL;
201
return -1;
202
}
@@ -207,7 +207,7 @@ int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result)
207
for (k = bases; k; k = k->next)
208
end = k;
209
}
210
- free_commit_list(*result);
210
+ commit_list_free(*result);
211
*result = new_commits;
212
}
213
return 0;
@@ -249,7 +249,7 @@ static int remove_redundant_no_gen(struct repository *r,
249
work, min_generation, 0, &common)) {
250
clear_commit_marks(array[i], all_flags);
251
clear_commit_marks_many(filled, work, all_flags);
252
- free_commit_list(common);
252
+ commit_list_free(common);
253
free(work);
254
free(redundant);
255
free(filled_index);
@@ -262,7 +262,7 @@ static int remove_redundant_no_gen(struct repository *r,
262
redundant[filled_index[j]] = 1;
263
clear_commit_marks(array[i], all_flags);
264
clear_commit_marks_many(filled, work, all_flags);
265
- free_commit_list(common);
265
+ commit_list_free(common);
266
}
267
268
/* Now collect the result */
@@ -374,7 +374,7 @@ static int remove_redundant_with_gen(struct repository *r,
374
if (!parents)
375
pop_commit(&stack);
376
}
377
- free_commit_list(stack);
377
+ commit_list_free(stack);
378
}
379
free(sorted);
380
@@ -451,7 +451,7 @@ static int get_merge_bases_many_0(struct repository *r,
451
CALLOC_ARRAY(rslt, cnt);
452
for (list = *result, i = 0; list; list = list->next)
453
rslt[i++] = list->item;
454
- free_commit_list(*result);
454
+ commit_list_free(*result);
455
*result = NULL;
456
457
clear_commit_marks(one, all_flags);
@@ -510,7 +510,7 @@ int repo_is_descendant_of(struct repository *r,
510
int result;
511
commit_list_insert(commit, &from_list);
512
result = can_all_from_reach(from_list, with_commit, 0);
513
- free_commit_list(from_list);
513
+ commit_list_free(from_list);
514
return result;
515
} else {
516
while (with_commit) {
@@ -561,7 +561,7 @@ int repo_in_merge_bases_many(struct repository *r, struct commit *commit,
561
ret = 1;
562
clear_commit_marks(commit, all_flags);
563
clear_commit_marks_many(nr_reference, reference, all_flags);
564
- free_commit_list(bases);
564
+ commit_list_free(bases);
565
return ret;
566
}
567
@@ -578,7 +578,7 @@ int repo_in_merge_bases(struct repository *r,
578
579
next = commit_list_append(commit, next);
580
res = repo_is_descendant_of(r, reference, list);
581
- free_commit_list(list);
581
+ commit_list_free(list);
582
583
return res;
584
}
@@ -626,7 +626,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
626
void reduce_heads_replace(struct commit_list **heads)
627
{
628
struct commit_list *result = reduce_heads(*heads);
629
- free_commit_list(*heads);
629
+ commit_list_free(*heads);
630
*heads = result;
631
}
632
@@ -661,7 +661,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
661
new_commit, old_commit_list);
662
if (ret < 0)
663
exit(128);
664
- free_commit_list(old_commit_list);
664
+ commit_list_free(old_commit_list);
665
return ret;
666
}
667
@@ -1236,7 +1236,7 @@ void tips_reachable_from_bases(struct repository *r,
1236
done:
1237
free(commits);
1238
repo_clear_commit_marks(r, SEEN);
1239
- free_commit_list(stack);
1239
+ commit_list_free(stack);
1240
}
1241
1242
/*
commit.c
+6
-6
@@ -191,7 +191,7 @@ void unparse_commit(struct repository *r, const struct object_id *oid)
191
192
if (!c->object.parsed)
193
return;
194
- free_commit_list(c->parents);
194
+ commit_list_free(c->parents);
195
c->parents = NULL;
196
c->object.parsed = 0;
197
}
@@ -436,7 +436,7 @@ void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
436
set_commit_tree(c, NULL);
437
free_commit_buffer(pool, c);
438
c->index = 0;
439
- free_commit_list(c->parents);
439
+ commit_list_free(c->parents);
440
441
c->object.parsed = 0;
442
}
@@ -480,7 +480,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
480
* same error, but that's good, since it lets our caller know
481
* the result cannot be trusted.
482
*/
483
- free_commit_list(item->parents);
483
+ commit_list_free(item->parents);
484
item->parents = NULL;
485
486
tail += size;
@@ -702,7 +702,7 @@ struct commit_list *commit_list_reverse(struct commit_list *list)
702
return next;
703
}
704
705
-void free_commit_list(struct commit_list *list)
705
+void commit_list_free(struct commit_list *list)
706
{
707
while (list)
708
pop_commit(&list);
@@ -977,7 +977,7 @@ void sort_in_topological_order(struct commit_list **list, enum rev_sort_order so
977
prio_queue_reverse(&queue);
978
979
/* We no longer need the commit list */
980
- free_commit_list(orig);
980
+ commit_list_free(orig);
981
982
pptr = list;
983
*list = NULL;
@@ -1107,7 +1107,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
1107
1108
cleanup_return:
1109
free(revs.commit);
1110
- free_commit_list(bases);
1110
+ commit_list_free(bases);
1111
free(full_refname);
1112
return ret;
1113
}
commit.h
+6
-1
@@ -191,7 +191,7 @@ struct commit_list *commit_list_copy(const struct commit_list *list);
191
/* Modify list in-place to reverse it, returning new head; list will be tail */
192
struct commit_list *commit_list_reverse(struct commit_list *list);
193
194
-void free_commit_list(struct commit_list *list);
194
+void commit_list_free(struct commit_list *list);
195
196
/*
197
* 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)
207
return commit_list_reverse(l);
208
}
209
210
+static inline void free_commit_list(struct commit_list *l)
211
+{
212
+ commit_list_free(l);
213
+}
214
+
215
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
216
217
const char *repo_logmsg_reencode(struct repository *r,
contrib/coccinelle/free.cocci
+4
-4
@@ -5,7 +5,7 @@ expression E;
5
(
6
free(E);
7
|
8
- free_commit_list(E);
8
+ commit_list_free(E);
9
)
10
11
@@
@@ -15,7 +15,7 @@ expression E;
15
(
16
free(E);
17
|
18
- free_commit_list(E);
18
+ commit_list_free(E);
19
)
20
21
@@
@@ -30,7 +30,7 @@ expression E;
30
@@
31
- if (E)
32
- {
33
- free_commit_list(E);
33
+ commit_list_free(E);
34
E = NULL;
35
- }
36
@@ -41,5 +41,5 @@ statement S;
41
- if (E) {
42
+ if (E)
43
S
44
- free_commit_list(E);
44
+ commit_list_free(E);
45
- }
diff-lib.c
+1
-1
@@ -615,7 +615,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
615
616
oidcpy(mb, &merge_bases->item->object.oid);
617
618
- free_commit_list(merge_bases);
618
+ commit_list_free(merge_bases);
619
}
620
621
void run_diff_index(struct rev_info *revs, unsigned int option)
fmt-merge-msg.c
+1
-1
@@ -421,7 +421,7 @@ static void shortlog(const char *name,
421
422
clear_commit_marks((struct commit *)branch, flags);
423
clear_commit_marks(head, flags);
424
- free_commit_list(rev->commits);
424
+ commit_list_free(rev->commits);
425
rev->commits = NULL;
426
rev->pending.nr = 0;
427
line-log.c
+1
-1
@@ -1239,7 +1239,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
1239
* don't follow any other path in history
1240
*/
1241
add_line_range(rev, parent, cand[i]);
1242
- free_commit_list(commit->parents);
1242
+ commit_list_free(commit->parents);
1243
commit_list_append(parent, &commit->parents);
1244
1245
ret = 0;
log-tree.c
+1
-1
@@ -1077,7 +1077,7 @@ static int do_remerge_diff(struct rev_info *opt,
1077
log_tree_diff_flush(opt);
1078
1079
/* Cleanup */
1080
- free_commit_list(bases);
1080
+ commit_list_free(bases);
1081
cleanup_additional_headers(&opt->diffopt);
1082
strbuf_release(&parent1_desc);
1083
strbuf_release(&parent2_desc);
merge-ort-wrappers.c
+1
-1
@@ -120,7 +120,7 @@ int merge_ort_generic(struct merge_options *opt,
120
repo_hold_locked_index(opt->repo, &lock, LOCK_DIE_ON_ERROR);
121
clean = merge_ort_recursive(opt, head_commit, next_commit, ca,
122
result);
123
- free_commit_list(ca);
123
+ commit_list_free(ca);
124
if (clean < 0) {
125
rollback_lock_file(&lock);
126
return clean;
merge-ort.c
+1
-1
@@ -5382,7 +5382,7 @@ static void merge_ort_internal(struct merge_options *opt,
5382
opt->ancestor = NULL; /* avoid accidental re-use of opt->ancestor */
5383
5384
out:
5385
- free_commit_list(merge_bases);
5385
+ commit_list_free(merge_bases);
5386
}
5387
5388
void merge_incore_nonrecursive(struct merge_options *opt,
notes-merge.c
+2
-2
@@ -668,11 +668,11 @@ int notes_merge(struct notes_merge_options *o,
668
commit_list_insert(local, &parents);
669
create_notes_commit(o->repo, local_tree, parents, o->commit_msg.buf,
670
o->commit_msg.len, result_oid);
671
- free_commit_list(parents);
671
+ commit_list_free(parents);
672
}
673
674
found_result:
675
- free_commit_list(bases);
675
+ commit_list_free(bases);
676
strbuf_release(&(o->commit_msg));
677
trace_printf("notes_merge(): result = %i, result_oid = %.7s\n",
678
result, oid_to_hex(result_oid));
notes-utils.c
+1
-1
@@ -40,7 +40,7 @@ void create_notes_commit(struct repository *r,
40
NULL))
41
die("Failed to commit notes tree to database");
42
43
- free_commit_list(parents_to_free);
43
+ commit_list_free(parents_to_free);
44
}
45
46
void commit_notes(struct repository *r, struct notes_tree *t, const char *msg)
object-name.c
+4
-4
@@ -1281,7 +1281,7 @@ static int peel_onion(struct repository *r, const char *name, int len,
1281
commit_list_insert((struct commit *)o, &list);
1282
ret = get_oid_oneline(r, prefix, oid, list);
1283
1284
- free_commit_list(list);
1284
+ commit_list_free(list);
1285
free(prefix);
1286
return ret;
1287
}
@@ -1623,7 +1623,7 @@ int repo_get_oid_mb(struct repository *r,
1623
if (!two)
1624
return -1;
1625
if (repo_get_merge_bases(r, one, two, &mbs) < 0) {
1626
- free_commit_list(mbs);
1626
+ commit_list_free(mbs);
1627
return -1;
1628
}
1629
if (!mbs || mbs->next)
@@ -1632,7 +1632,7 @@ int repo_get_oid_mb(struct repository *r,
1632
st = 0;
1633
oidcpy(oid, &mbs->item->object.oid);
1634
}
1635
- free_commit_list(mbs);
1635
+ commit_list_free(mbs);
1636
return st;
1637
}
1638
@@ -2052,7 +2052,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
2052
refs_head_ref(get_main_ref_store(repo), handle_one_ref, &cb);
2053
ret = get_oid_oneline(repo, name + 2, oid, list);
2054
2055
- free_commit_list(list);
2055
+ commit_list_free(list);
2056
return ret;
2057
}
2058
if (namelen < 3 ||
pack-bitmap-write.c
+3
-3
@@ -306,7 +306,7 @@ struct bb_commit {
306
307
static void clear_bb_commit(struct bb_commit *commit)
308
{
309
- free_commit_list(commit->reverse_edges);
309
+ commit_list_free(commit->reverse_edges);
310
bitmap_free(commit->commit_mask);
311
bitmap_free(commit->bitmap);
312
}
@@ -414,7 +414,7 @@ static void bitmap_builder_init(struct bitmap_builder *bb,
414
p_ent->maximal = 1;
415
else {
416
p_ent->maximal = 0;
417
- free_commit_list(p_ent->reverse_edges);
417
+ commit_list_free(p_ent->reverse_edges);
418
p_ent->reverse_edges = NULL;
419
}
420
@@ -445,7 +445,7 @@ next:
445
"num_maximal_commits", num_maximal);
446
447
release_revisions(&revs);
448
- free_commit_list(reusable);
448
+ commit_list_free(reusable);
449
}
450
451
static void bitmap_builder_clear(struct bitmap_builder *bb)
ref-filter.c
+4
-4
@@ -3782,9 +3782,9 @@ void ref_filter_clear(struct ref_filter *filter)
3782
{
3783
strvec_clear(&filter->exclude);
3784
oid_array_clear(&filter->points_at);
3785
- free_commit_list(filter->with_commit);
3786
- free_commit_list(filter->no_commit);
3787
- free_commit_list(filter->reachable_from);
3788
- free_commit_list(filter->unreachable_from);
3785
+ commit_list_free(filter->with_commit);
3786
+ commit_list_free(filter->no_commit);
3787
+ commit_list_free(filter->reachable_from);
3788
+ commit_list_free(filter->unreachable_from);
3789
ref_filter_init(filter);
3790
}
reflog.c
+2
-2
@@ -493,7 +493,7 @@ void reflog_expiry_cleanup(void *cb_data)
493
case UE_HEAD:
494
for (elem = cb->tips; elem; elem = elem->next)
495
clear_commit_marks(elem->item, REACHABLE);
496
- free_commit_list(cb->tips);
496
+ commit_list_free(cb->tips);
497
break;
498
case UE_NORMAL:
499
clear_commit_marks(cb->tip_commit, REACHABLE);
@@ -501,7 +501,7 @@ void reflog_expiry_cleanup(void *cb_data)
501
}
502
for (elem = cb->mark_list; elem; elem = elem->next)
503
clear_commit_marks(elem->item, REACHABLE);
504
- free_commit_list(cb->mark_list);
504
+ commit_list_free(cb->mark_list);
505
}
506
507
int count_reflog_ent(const char *refname UNUSED,
remote.c
+1
-1
@@ -1497,7 +1497,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds
1497
clear_commit_marks_many(src_commits.nr, src_commits.items,
1498
reachable_flag);
1499
commit_stack_clear(&src_commits);
1500
- free_commit_list(found_commits);
1500
+ commit_list_free(found_commits);
1501
}
1502
1503
string_list_clear(&src_tag, 0);
revision.c
+16
-16
@@ -1048,7 +1048,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
1048
continue;
1049
}
1050
1051
- free_commit_list(parent->next);
1051
+ commit_list_free(parent->next);
1052
parent->next = NULL;
1053
while (commit->parents != parent)
1054
pop_commit(&commit->parents);
@@ -1083,7 +1083,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
1083
die("cannot simplify commit %s (invalid %s)",
1084
oid_to_hex(&commit->object.oid),
1085
oid_to_hex(&p->object.oid));
1086
- free_commit_list(p->parents);
1086
+ commit_list_free(p->parents);
1087
p->parents = NULL;
1088
}
1089
/* fallthrough */
@@ -1405,7 +1405,7 @@ static void limit_to_ancestry(struct commit_list *bottoms, struct commit_list *l
1405
p->item->object.flags &= ~(TMP_MARK | ANCESTRY_PATH);
1406
for (p = bottoms; p; p = p->next)
1407
p->item->object.flags &= ~(TMP_MARK | ANCESTRY_PATH);
1408
- free_commit_list(rlist);
1408
+ commit_list_free(rlist);
1409
}
1410
1411
/*
@@ -1508,7 +1508,7 @@ static int limit_list(struct rev_info *revs)
1508
}
1509
}
1510
1511
- free_commit_list(original_list);
1511
+ commit_list_free(original_list);
1512
revs->commits = newlist;
1513
return 0;
1514
}
@@ -2011,7 +2011,7 @@ static void prepare_show_merge(struct rev_info *revs)
2011
exit(128);
2012
add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);
2013
add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);
2014
- free_commit_list(bases);
2014
+ commit_list_free(bases);
2015
head->object.flags |= SYMMETRIC_LEFT;
2016
2017
if (!istate->cache_nr)
@@ -2105,13 +2105,13 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
2105
return dotdot_missing(arg, dotdot, revs, symmetric);
2106
2107
if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0) {
2108
- free_commit_list(exclude);
2108
+ commit_list_free(exclude);
2109
return -1;
2110
}
2111
add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,
2112
flags_exclude);
2113
add_pending_commit_list(revs, exclude, flags_exclude);
2114
- free_commit_list(exclude);
2114
+ commit_list_free(exclude);
2115
2116
b_flags = flags;
2117
a_flags = flags | SYMMETRIC_LEFT;
@@ -3221,13 +3221,13 @@ static void release_revisions_bloom_keyvecs(struct rev_info *revs)
3221
3222
static void free_void_commit_list(void *list)
3223
{
3224
- free_commit_list(list);
3224
+ commit_list_free(list);
3225
}
3226
3227
void release_revisions(struct rev_info *revs)
3228
{
3229
- free_commit_list(revs->commits);
3230
- free_commit_list(revs->ancestry_path_bottoms);
3229
+ commit_list_free(revs->commits);
3230
+ commit_list_free(revs->ancestry_path_bottoms);
3231
release_display_notes(&revs->notes_opt);
3232
object_array_clear(&revs->pending);
3233
object_array_clear(&revs->boundary_commits);
@@ -3335,7 +3335,7 @@ static int mark_redundant_parents(struct commit *commit)
3335
if (i != cnt || cnt+marked != orig_cnt)
3336
die("mark_redundant_parents %d %d %d %d", orig_cnt, cnt, i, marked);
3337
3338
- free_commit_list(h);
3338
+ commit_list_free(h);
3339
3340
return marked;
3341
}
@@ -4232,7 +4232,7 @@ static void save_parents(struct rev_info *revs, struct commit *commit)
4232
static void free_saved_parent(struct commit_list **parents)
4233
{
4234
if (*parents != EMPTY_PARENT_LIST)
4235
- free_commit_list(*parents);
4235
+ commit_list_free(*parents);
4236
}
4237
4238
static void free_saved_parents(struct rev_info *revs)
@@ -4293,7 +4293,7 @@ static void track_linear(struct rev_info *revs, struct commit *commit)
4293
if (revs->linear)
4294
commit->object.flags |= TRACK_LINEAR;
4295
}
4296
- free_commit_list(revs->previous_parents);
4296
+ commit_list_free(revs->previous_parents);
4297
revs->previous_parents = commit_list_copy(commit->parents);
4298
}
4299
@@ -4382,7 +4382,7 @@ static void create_boundary_commit_list(struct rev_info *revs)
4382
* boundary commits anyway. (This is what the code has always
4383
* done.)
4384
*/
4385
- free_commit_list(revs->commits);
4385
+ commit_list_free(revs->commits);
4386
revs->commits = NULL;
4387
4388
/*
@@ -4504,7 +4504,7 @@ struct commit *get_revision(struct rev_info *revs)
4504
reversed = NULL;
4505
while ((c = get_revision_internal(revs)))
4506
commit_list_insert(c, &reversed);
4507
- free_commit_list(revs->commits);
4507
+ commit_list_free(revs->commits);
4508
revs->commits = reversed;
4509
revs->reverse = 0;
4510
revs->reverse_output_stage = 1;
@@ -4522,7 +4522,7 @@ struct commit *get_revision(struct rev_info *revs)
4522
graph_update(revs->graph, c);
4523
if (!c) {
4524
free_saved_parents(revs);
4525
- free_commit_list(revs->previous_parents);
4525
+ commit_list_free(revs->previous_parents);
4526
revs->previous_parents = NULL;
4527
}
4528
return c;
sequencer.c
+8
-8
@@ -1698,7 +1698,7 @@ static int try_to_commit(struct repository *r,
1698
1699
out:
1700
free_commit_extra_headers(extra);
1701
- free_commit_list(parents);
1701
+ commit_list_free(parents);
1702
strbuf_release(&err);
1703
strbuf_release(&commit_msg);
1704
free(amend_author);
@@ -2476,8 +2476,8 @@ static int do_pick_commit(struct repository *r,
2476
res |= try_merge_command(r, opts->strategy,
2477
opts->xopts.nr, opts->xopts.v,
2478
common, oid_to_hex(&head), remotes);
2479
- free_commit_list(common);
2480
- free_commit_list(remotes);
2479
+ commit_list_free(common);
2480
+ commit_list_free(remotes);
2481
}
2482
2483
/*
@@ -4381,8 +4381,8 @@ static int do_merge(struct repository *r,
4381
leave_merge:
4382
strbuf_release(&ref_name);
4383
rollback_lock_file(&lock);
4384
- free_commit_list(to_merge);
4385
- free_commit_list(bases);
4384
+ commit_list_free(to_merge);
4385
+ commit_list_free(bases);
4386
return ret;
4387
}
4388
@@ -6039,11 +6039,11 @@ static int make_script_with_merges(struct pretty_print_context *pp,
6039
oidset_insert(&shown, oid);
6040
}
6041
6042
- free_commit_list(list);
6042
+ commit_list_free(list);
6043
}
6044
6045
- free_commit_list(commits);
6046
- free_commit_list(tips);
6045
+ commit_list_free(commits);
6046
+ commit_list_free(tips);
6047
6048
strbuf_release(&label_from_message);
6049
strbuf_release(&oneline);
shallow.c
+2
-2
@@ -40,7 +40,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)
40
oidcpy(&graft->oid, oid);
41
graft->nr_parent = -1;
42
if (commit && commit->object.parsed) {
43
- free_commit_list(commit->parents);
43
+ commit_list_free(commit->parents);
44
commit->parents = NULL;
45
}
46
return register_commit_graft(r, graft, 0);
@@ -267,7 +267,7 @@ struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv,
267
break;
268
}
269
}
270
- free_commit_list(not_shallow_list);
270
+ commit_list_free(not_shallow_list);
271
272
/*
273
* Now we can clean up NOT_SHALLOW on border commits. Having
submodule.c
+2
-2
@@ -639,7 +639,7 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
639
print_submodule_diff_summary(sub, &rev, o);
640
641
out:
642
- free_commit_list(merge_bases);
642
+ commit_list_free(merge_bases);
643
release_revisions(&rev);
644
clear_commit_marks(left, ~0);
645
clear_commit_marks(right, ~0);
@@ -729,7 +729,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
729
730
done:
731
strbuf_release(&sb);
732
- free_commit_list(merge_bases);
732
+ commit_list_free(merge_bases);
733
if (left)
734
clear_commit_marks(left, ~0);
735
if (right)
t/helper/test-reach.c
+5
-5
@@ -120,12 +120,12 @@ int cmd__reach(int ac, const char **av)
120
exit(128);
121
printf("%s(A,X):\n", av[1]);
122
print_sorted_commit_ids(list);
123
- free_commit_list(list);
123
+ commit_list_free(list);
124
} else if (!strcmp(av[1], "reduce_heads")) {
125
struct commit_list *list = reduce_heads(X);
126
printf("%s(X):\n", av[1]);
127
print_sorted_commit_ids(list);
128
- free_commit_list(list);
128
+ commit_list_free(list);
129
} else if (!strcmp(av[1], "can_all_from_reach")) {
130
printf("%s(X,Y):%d\n", av[1], can_all_from_reach(X, Y, 1));
131
} else if (!strcmp(av[1], "can_all_from_reach_with_flag")) {
@@ -172,13 +172,13 @@ int cmd__reach(int ac, const char **av)
172
die(_("too many commits marked reachable"));
173
174
print_sorted_commit_ids(list);
175
- free_commit_list(list);
175
+ commit_list_free(list);
176
}
177
178
object_array_clear(&X_obj);
179
strbuf_release(&buf);
180
- free_commit_list(X);
181
- free_commit_list(Y);
180
+ commit_list_free(X);
181
+ commit_list_free(Y);
182
commit_stack_clear(&X_stack);
183
commit_stack_clear(&Y_stack);
184
return 0;