Re: [PATCH 1/3] merge-ort: copy a few small helper functions from merge-recursive.c
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Dec 16, 2020, 13:30 UTC
- Message-ID
- <4a4d9d29-ccba-8d39-a7cd-34b1ba785e22@gmail.com>
- In-Reply-To
- <0b455bd6fe7dff72c1849eb8466b97b96b2b90a9.1608054807.git.gitgitgadget@gmail.com>
On 12/15/2020 12:53 PM, Elijah Newren via GitGitGadget wrote:
Show 7 quoted lines
> From: Elijah Newren <newren@gmail.com> > > In a subsequent commit, we will implement the traditional recursiveness > that gave merge-recursive its name, namely merging non-unique > merge-bases to come up with a single virtual merge base. Copy a few > helper functions from merge-recursive.c that we will use in the > implementation.
I'm sure these are copies, but...
Show 8 quoted lines
> +static 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;
> + }The naming of 'next' seems backwards to me, since it is really the "previous" node. Using something like 'previous' makes it clear that you are reversing when you say
current->next = previous;
Thanks, -Stolee