Skip to content

Commit 4831c23

Browse files
committed
Merge branch 'mf/submodule-summary-with-correct-repository'
"git diff/show" on a change that involves a submodule used to read the information on commits in the submodule from a wrong repository and gave a wrong information when the commit-graph is involved. * mf/submodule-summary-with-correct-repository: submodule: use submodule repository when preparing summary revision: use repository from rev_info when parsing commits
2 parents 9d4e7ec + 85a1ec2 commit 4831c23

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

commit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ static inline int parse_commit_no_graph(struct commit *commit)
9595

9696
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
9797
#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)
98-
#define parse_commit_gently(item, quiet) repo_parse_commit_gently(the_repository, item, quiet)
9998
#define parse_commit(item) repo_parse_commit(the_repository, item)
10099
#endif
101100

revision.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static struct commit *handle_commit(struct rev_info *revs,
440440
if (object->type == OBJ_COMMIT) {
441441
struct commit *commit = (struct commit *)object;
442442

443-
if (parse_commit(commit) < 0)
443+
if (repo_parse_commit(revs->repo, commit) < 0)
444444
die("unable to parse commit %s", name);
445445
if (flags & UNINTERESTING) {
446446
mark_parents_uninteresting(commit);
@@ -1013,7 +1013,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
10131013
ts->treesame[0] = 1;
10141014
}
10151015
}
1016-
if (parse_commit(p) < 0)
1016+
if (repo_parse_commit(revs->repo, p) < 0)
10171017
die("cannot simplify commit %s (because of %s)",
10181018
oid_to_hex(&commit->object.oid),
10191019
oid_to_hex(&p->object.oid));
@@ -1058,7 +1058,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
10581058
* IOW, we pretend this parent is a
10591059
* "root" commit.
10601060
*/
1061-
if (parse_commit(p) < 0)
1061+
if (repo_parse_commit(revs->repo, p) < 0)
10621062
die("cannot simplify commit %s (invalid %s)",
10631063
oid_to_hex(&commit->object.oid),
10641064
oid_to_hex(&p->object.oid));
@@ -1126,7 +1126,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
11261126
parent = parent->next;
11271127
if (p)
11281128
p->object.flags |= UNINTERESTING;
1129-
if (parse_commit_gently(p, 1) < 0)
1129+
if (repo_parse_commit_gently(revs->repo, p, 1) < 0)
11301130
continue;
11311131
if (p->parents)
11321132
mark_parents_uninteresting(p);
@@ -1157,7 +1157,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
11571157
struct commit *p = parent->item;
11581158
int gently = revs->ignore_missing_links ||
11591159
revs->exclude_promisor_objects;
1160-
if (parse_commit_gently(p, gently) < 0) {
1160+
if (repo_parse_commit_gently(revs->repo, p, gently) < 0) {
11611161
if (revs->exclude_promisor_objects &&
11621162
is_promisor_object(&p->object.oid)) {
11631163
if (revs->first_parent_only)
@@ -3337,7 +3337,7 @@ static void explore_walk_step(struct rev_info *revs)
33373337
if (!c)
33383338
return;
33393339

3340-
if (parse_commit_gently(c, 1) < 0)
3340+
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
33413341
return;
33423342

33433343
if (revs->sort_order == REV_SORT_BY_AUTHOR_DATE)
@@ -3375,7 +3375,7 @@ static void indegree_walk_step(struct rev_info *revs)
33753375
if (!c)
33763376
return;
33773377

3378-
if (parse_commit_gently(c, 1) < 0)
3378+
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
33793379
return;
33803380

33813381
explore_to_depth(revs, commit_graph_generation(c));
@@ -3457,7 +3457,7 @@ static void init_topo_walk(struct rev_info *revs)
34573457
struct commit *c = list->item;
34583458
uint32_t generation;
34593459

3460-
if (parse_commit_gently(c, 1))
3460+
if (repo_parse_commit_gently(revs->repo, c, 1))
34613461
continue;
34623462

34633463
test_flag_and_insert(&info->explore_queue, c, TOPO_WALK_EXPLORED);
@@ -3521,7 +3521,7 @@ static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
35213521
if (parent->object.flags & UNINTERESTING)
35223522
continue;
35233523

3524-
if (parse_commit_gently(parent, 1) < 0)
3524+
if (repo_parse_commit_gently(revs->repo, parent, 1) < 0)
35253525
continue;
35263526

35273527
generation = commit_graph_generation(parent);

submodule.c

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

441-
static int prepare_submodule_diff_summary(struct rev_info *rev, const char *path,
442-
struct commit *left, struct commit *right,
443-
struct commit_list *merge_bases)
441+
static int prepare_submodule_diff_summary(struct repository *r, struct rev_info *rev,
442+
const char *path,
443+
struct commit *left, struct commit *right,
444+
struct commit_list *merge_bases)
444445
{
445446
struct commit_list *list;
446447

447-
repo_init_revisions(the_repository, rev, NULL);
448+
repo_init_revisions(r, rev, NULL);
448449
setup_revisions(0, NULL, rev, NULL);
449450
rev->left_right = 1;
450451
rev->first_parent_only = 1;
@@ -632,7 +633,7 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
632633
goto out;
633634

634635
/* Treat revision walker failure the same as missing commits */
635-
if (prepare_submodule_diff_summary(&rev, path, left, right, merge_bases)) {
636+
if (prepare_submodule_diff_summary(sub, &rev, path, left, right, merge_bases)) {
636637
diff_emit_submodule_error(o, "(revision walker failed)\n");
637638
goto out;
638639
}

0 commit comments

Comments
 (0)