submodule: use submodule repository when preparing summary
In show_submodule_header(), we gather the left and right commits of the submodule repository, as well as the merge bases. However, prepare_submodule_summary() initializes the rev_info with the_repository, so we end up parsing the commit in the wrong repository. This results in a fatal error in parse_commit_in_graph(), since the passed item does not belong to the repository's commit graph. Signed-off-by: Michael Forney <mforney@mforney.org> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Forney committed
Jun 23, 2020 at 13:56 UTC
85a1ec2c32f4f41dd4526651df4b3666a41334fe
1 file changed
+4
-4
submodule.c
+4
-4
@@ -438,13 +438,13 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
438
*/
439
}
440
441
-static int prepare_submodule_summary(struct rev_info *rev, const char *path,
442
- struct commit *left, struct commit *right,
441
+static int prepare_submodule_summary(struct repository *r, struct rev_info *rev,
442
+ const char *path, struct commit *left, struct commit *right,
443
struct commit_list *merge_bases)
444
{
445
struct commit_list *list;
446
447
- repo_init_revisions(the_repository, rev, NULL);
447
+ repo_init_revisions(r, rev, NULL);
448
setup_revisions(0, NULL, rev, NULL);
449
rev->left_right = 1;
450
rev->first_parent_only = 1;
@@ -632,7 +632,7 @@ void show_submodule_summary(struct diff_options *o, const char *path,
632
goto out;
633
634
/* Treat revision walker failure the same as missing commits */
635
- if (prepare_submodule_summary(&rev, path, left, right, merge_bases)) {
635
+ if (prepare_submodule_summary(sub, &rev, path, left, right, merge_bases)) {
636
diff_emit_submodule_error(o, "(revision walker failed)\n");
637
goto out;
638
}