summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-10-30 13:07:03 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-10-30 13:07:03 -0700
commit0692a6c22c37e07ef07a3d2c5d39deaaa3c26ffe (patch)
tree4a25ada2e2aa20ecf3caf6e1af76e2ebf999cb85 /builtin/merge.c
parentMerge branch 'mk/blame-error-message' (diff)
parentuse pop_commit() for consuming the first entry of a struct commit_list (diff)
downloadtgif-0692a6c22c37e07ef07a3d2c5d39deaaa3c26ffe.tar.xz
Merge branch 'rs/pop-commit'
Code simplification. * rs/pop-commit: use pop_commit() for consuming the first entry of a struct commit_list
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 977ffff287..bbf3110f88 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1019,7 +1019,7 @@ static struct commit_list *reduce_parents(struct commit *head_commit,
int *head_subsumed,
struct commit_list *remoteheads)
{
- struct commit_list *parents, *next, **remotes = &remoteheads;
+ struct commit_list *parents, **remotes;
/*
* Is the current HEAD reachable from another commit being
@@ -1033,16 +1033,14 @@ static struct commit_list *reduce_parents(struct commit *head_commit,
/* Find what parents to record by checking independent ones. */
parents = reduce_heads(remoteheads);
- for (remoteheads = NULL, remotes = &remoteheads;
- parents;
- parents = next) {
- struct commit *commit = parents->item;
- next = parents->next;
+ remoteheads = NULL;
+ remotes = &remoteheads;
+ while (parents) {
+ struct commit *commit = pop_commit(&parents);
if (commit == head_commit)
*head_subsumed = 0;
else
remotes = &commit_list_insert(commit, remotes)->next;
- free(parents);
}
return remoteheads;
}