Merge branch 'ps/commit-list-functions-renamed' into jch

Rename three functions around the commit_list data structure.

* ps/commit-list-functions-renamed:
  commit: rename `free_commit_list()` to conform to coding guidelines
  commit: rename `reverse_commit_list()` to conform to coding guidelines
  commit: rename `copy_commit_list()` to conform to coding guidelines
This commit is contained in:
Junio C Hamano 2026-01-19 16:44:21 -08:00
commit acb41c2c6c
40 changed files with 163 additions and 144 deletions

View File

@ -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;

View File

@ -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;

View 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);
}

View 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;
}

View File

@ -1850,7 +1850,7 @@ int cmd_commit(int argc,
} else if (amend) {
if (!reflog_msg)
reflog_msg = "commit (amend)";
parents = copy_commit_list(current_head->parents);
parents = commit_list_copy(current_head->parents);
} else if (whence == FROM_MERGE) {
struct strbuf m = STRBUF_INIT;
FILE *fp;
@ -1979,7 +1979,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);

View 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;
}
}

View 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);
}

View File

@ -1168,7 +1168,7 @@ static int dfs_on_ref(const struct reference *ref, void *cb_data)
}
}
free_commit_list(stack);
commit_list_free(stack);
return result;
}

View 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;
}

View 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;
}

View File

@ -486,9 +486,9 @@ static int real_merge(struct merge_tree_options *o,
exit(128);
if (!merge_bases && !o->allow_unrelated_histories)
die(_("refusing to merge unrelated histories"));
merge_bases = reverse_commit_list(merge_bases);
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)

View 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);

View 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)

View 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)

View 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);

View 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);

View 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;
@ -2308,7 +2308,7 @@ static int do_export_stash(struct repository *r,
* but where their first parents form a chain to our original empty
* base commit.
*/
items = reverse_commit_list(items);
items = commit_list_reverse(items);
for (cur = items; cur; cur = cur->next) {
struct commit_list *parents = NULL;
struct commit_list **next = &parents;
@ -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;
}

View 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;

View 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);
}
/*

View File

@ -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;
@ -680,7 +680,7 @@ unsigned commit_list_count(const struct commit_list *l)
return c;
}
struct commit_list *copy_commit_list(const struct commit_list *list)
struct commit_list *commit_list_copy(const struct commit_list *list)
{
struct commit_list *head = NULL;
struct commit_list **pp = &head;
@ -691,7 +691,7 @@ struct commit_list *copy_commit_list(const struct commit_list *list)
return head;
}
struct commit_list *reverse_commit_list(struct commit_list *list)
struct commit_list *commit_list_reverse(struct commit_list *list)
{
struct commit_list *next = NULL, *current, *backup;
for (current = list; current; current = backup) {
@ -702,7 +702,7 @@ struct commit_list *reverse_commit_list(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;
}

View File

@ -186,12 +186,31 @@ struct commit_list *commit_list_insert_by_date(struct commit *item,
void commit_list_sort_by_date(struct commit_list **list);
/* Shallow copy of the input list */
struct commit_list *copy_commit_list(const struct commit_list *list);
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 *reverse_commit_list(struct commit_list *list);
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
* once Git 2.53 is released.
*/
static inline struct commit_list *copy_commit_list(struct commit_list *l)
{
return commit_list_copy(l);
}
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 */

View 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);
- }

View 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)

View 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;

View 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;

View 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);

View 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;

View File

@ -5302,7 +5302,7 @@ static void merge_ort_internal(struct merge_options *opt,
struct commit *h2,
struct merge_result *result)
{
struct commit_list *merge_bases = copy_commit_list(_merge_bases);
struct commit_list *merge_bases = commit_list_copy(_merge_bases);
struct commit *next;
struct commit *merged_merge_bases;
const char *ancestor_name;
@ -5315,7 +5315,7 @@ static void merge_ort_internal(struct merge_options *opt,
goto out;
}
/* See merge-ort.h:merge_incore_recursive() declaration NOTE */
merge_bases = reverse_commit_list(merge_bases);
merge_bases = commit_list_reverse(merge_bases);
}
merged_merge_bases = pop_commit(&merge_bases);
@ -5383,7 +5383,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,

View 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));

View 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)

View 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 ||

View 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)

View 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);
}

View File

@ -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,

View File

@ -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);

View 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;
}
@ -4224,7 +4224,7 @@ static void save_parents(struct rev_info *revs, struct commit *commit)
if (*pp)
return;
if (commit->parents)
*pp = copy_commit_list(commit->parents);
*pp = commit_list_copy(commit->parents);
else
*pp = EMPTY_PARENT_LIST;
}
@ -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,8 +4293,8 @@ 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);
revs->previous_parents = copy_commit_list(commit->parents);
commit_list_free(revs->previous_parents);
revs->previous_parents = commit_list_copy(commit->parents);
}
static struct commit *get_revision_1(struct rev_info *revs)
@ -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;

View File

@ -1558,7 +1558,7 @@ static int try_to_commit(struct repository *r,
res = error(_("unable to parse commit author"));
goto out;
}
parents = copy_commit_list(current_head->parents);
parents = commit_list_copy(current_head->parents);
extra = read_commit_extra_headers(current_head, exclude_gpgsig);
} else if (current_head &&
(!(flags & CREATE_ROOT_COMMIT) || (flags & AMEND_MSG))) {
@ -1690,7 +1690,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);
@ -2468,8 +2468,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);
}
/*
@ -4309,7 +4309,7 @@ static int do_merge(struct repository *r,
git_path_merge_head(r), 0);
write_message("no-ff", 5, git_path_merge_mode(r), 0);
bases = reverse_commit_list(bases);
bases = commit_list_reverse(bases);
repo_read_index(r);
init_ui_merge_options(&o, r);
@ -4373,8 +4373,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;
}
@ -6031,11 +6031,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);

View File

@ -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);
@ -284,7 +284,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

View File

@ -641,7 +641,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);
@ -731,7 +731,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)

View 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;