Skip to content

Commit 85a1ec2

Browse files
michaelforneygitster
authored andcommitted
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 <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ea3f7e5 commit 85a1ec2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

submodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,13 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
438438
*/
439439
}
440440

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,
443443
struct commit_list *merge_bases)
444444
{
445445
struct commit_list *list;
446446

447-
repo_init_revisions(the_repository, rev, NULL);
447+
repo_init_revisions(r, rev, NULL);
448448
setup_revisions(0, NULL, rev, NULL);
449449
rev->left_right = 1;
450450
rev->first_parent_only = 1;
@@ -632,7 +632,7 @@ void show_submodule_summary(struct diff_options *o, const char *path,
632632
goto out;
633633

634634
/* 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)) {
636636
diff_emit_submodule_error(o, "(revision walker failed)\n");
637637
goto out;
638638
}

0 commit comments

Comments
 (0)