summaryrefslogtreecommitdiff
path: root/builtin/fmt-merge-msg.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-12-11 11:14:12 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-12-11 11:14:13 -0800
commit0af22d6fffe5169f641fb9815468ae97e47cd73f (patch)
treee61f2ffb0f66e0d8c5892c0795b6f8a521e4f2c9 /builtin/fmt-merge-msg.c
parentMerge branch 'as/subtree-with-spaces' into maint (diff)
parentuse pop_commit() for consuming the first entry of a struct commit_list (diff)
downloadtgif-0af22d6fffe5169f641fb9815468ae97e47cd73f.tar.xz
Merge branch 'rs/pop-commit' into maint
Code simplification. * rs/pop-commit: use pop_commit() for consuming the first entry of a struct commit_list
Diffstat (limited to 'builtin/fmt-merge-msg.c')
-rw-r--r--builtin/fmt-merge-msg.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 4ba7f282a5..846004b833 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -537,7 +537,7 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
static void find_merge_parents(struct merge_parents *result,
struct strbuf *in, unsigned char *head)
{
- struct commit_list *parents, *next;
+ struct commit_list *parents;
struct commit *head_commit;
int pos = 0, i, j;
@@ -576,13 +576,10 @@ static void find_merge_parents(struct merge_parents *result,
parents = reduce_heads(parents);
while (parents) {
+ struct commit *cmit = pop_commit(&parents);
for (i = 0; i < result->nr; i++)
- if (!hashcmp(result->item[i].commit,
- parents->item->object.sha1))
+ if (!hashcmp(result->item[i].commit, cmit->object.sha1))
result->item[i].used = 1;
- next = parents->next;
- free(parents);
- parents = next;
}
for (i = j = 0; i < result->nr; i++) {