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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Dec 17, 2011 at 11:27 UTC
78e98eaf5ee49bc6d62ef9bdf87066528bfba248
1 file changed
+3
-11
submodule.c
+3
-11
@@ -371,23 +371,15 @@ static void collect_submodules_from_diff(struct diff_queue_struct *q,
371
}
372
373
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)
375
{
376
- struct sha1_array parents = SHA1_ARRAY_INIT;
376
struct rev_info rev;
377
379
- while (parent) {
380
- sha1_array_append(&parents, parent->item->object.sha1);
381
- parent = parent->next;
382
- }
383
-
378
init_revisions(&rev, NULL);
379
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
380
rev.diffopt.format_callback = collect_submodules_from_diff;
381
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);
383
}
384
385
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
402
die("revision walk setup failed");
403
404
while ((commit = get_revision(&rev)) && !needs_pushing)
413
- commit_need_pushing(commit, commit->parents, &needs_pushing);
405
+ commit_need_pushing(commit, &needs_pushing);
406
407
free(sha1_copy);
408
strbuf_release(&remotes_arg);