Skip to content

Commit 78e98ea

Browse files
René Scharfegitster
authored andcommitted
submodule: use diff_tree_combined_merge() instead of diff_tree_combined()
Use diff_tree_combined_merge() instead of open-coding it. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8288929 commit 78e98ea

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

submodule.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,23 +371,15 @@ static void collect_submodules_from_diff(struct diff_queue_struct *q,
371371
}
372372

373373

374-
static void commit_need_pushing(struct commit *commit, struct commit_list *parent, int *needs_pushing)
374+
static void commit_need_pushing(struct commit *commit, int *needs_pushing)
375375
{
376-
struct sha1_array parents = SHA1_ARRAY_INIT;
377376
struct rev_info rev;
378377

379-
while (parent) {
380-
sha1_array_append(&parents, parent->item->object.sha1);
381-
parent = parent->next;
382-
}
383-
384378
init_revisions(&rev, NULL);
385379
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
386380
rev.diffopt.format_callback = collect_submodules_from_diff;
387381
rev.diffopt.format_callback_data = needs_pushing;
388-
diff_tree_combined(commit->object.sha1, &parents, 1, &rev);
389-
390-
sha1_array_clear(&parents);
382+
diff_tree_combined_merge(commit, 1, &rev);
391383
}
392384

393385
int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remotes_name)
@@ -410,7 +402,7 @@ int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remote
410402
die("revision walk setup failed");
411403

412404
while ((commit = get_revision(&rev)) && !needs_pushing)
413-
commit_need_pushing(commit, commit->parents, &needs_pushing);
405+
commit_need_pushing(commit, &needs_pushing);
414406

415407
free(sha1_copy);
416408
strbuf_release(&remotes_arg);

0 commit comments

Comments
 (0)