summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-03-23 14:09:31 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-23 14:09:31 -0700
commit83510335c6f6c26089aaba8e40ef063ee68fa840 (patch)
tree676cc0089f1b8310bcf86d8d994d64d32dffa273
parentMerge branch 'ac/test-lazy-fetch' (diff)
parentsequencer: use reverse_commit_list() helper (diff)
downloadtgif-83510335c6f6c26089aaba8e40ef063ee68fa840.tar.xz
Merge branch 'js/in-place-reverse-in-sequencer'
Code clean-up. * js/in-place-reverse-in-sequencer: sequencer: use reverse_commit_list() helper
-rw-r--r--sequencer.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sequencer.c b/sequencer.c
index 84eed9e96b..a1bb39383d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3749,7 +3749,7 @@ static int do_merge(struct repository *r,
int run_commit_flags = 0;
struct strbuf ref_name = STRBUF_INIT;
struct commit *head_commit, *merge_commit, *i;
- struct commit_list *bases, *j, *reversed = NULL;
+ struct commit_list *bases, *j;
struct commit_list *to_merge = NULL, **tail = &to_merge;
const char *strategy = !opts->xopts_nr &&
(!opts->strategy ||
@@ -3984,9 +3984,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);
- for (j = bases; j; j = j->next)
- commit_list_insert(j->item, &reversed);
- free_commit_list(bases);
+ bases = reverse_commit_list(bases);
repo_read_index(r);
init_merge_options(&o, r);
@@ -4002,10 +4000,10 @@ static int do_merge(struct repository *r,
* update the index and working copy immediately.
*/
ret = merge_ort_recursive(&o,
- head_commit, merge_commit, reversed,
+ head_commit, merge_commit, bases,
&i);
} else {
- ret = merge_recursive(&o, head_commit, merge_commit, reversed,
+ ret = merge_recursive(&o, head_commit, merge_commit, bases,
&i);
}
if (ret <= 0)