From b0ca120554be8d8f7faf98aa3b991441de76f5cf Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 16 Dec 2020 22:27:59 +0000 Subject: commit: move reverse_commit_list() from merge-recursive Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- commit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'commit.c') diff --git a/commit.c b/commit.c index f53429c0ac..dc08a47b07 100644 --- a/commit.c +++ b/commit.c @@ -563,6 +563,17 @@ struct commit_list *copy_commit_list(struct commit_list *list) return head; } +struct commit_list *reverse_commit_list(struct commit_list *list) +{ + struct commit_list *next = NULL, *current, *backup; + for (current = list; current; current = backup) { + backup = current->next; + current->next = next; + next = current; + } + return next; +} + void free_commit_list(struct commit_list *list) { while (list) -- cgit v1.2.3