зеркало из https://github.com/microsoft/git.git
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
This commit is contained in:
Коммит
4831c23f75
1
commit.h
1
commit.h
|
@ -95,7 +95,6 @@ static inline int parse_commit_no_graph(struct commit *commit)
|
|||
|
||||
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
||||
#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)
|
||||
#define parse_commit_gently(item, quiet) repo_parse_commit_gently(the_repository, item, quiet)
|
||||
#define parse_commit(item) repo_parse_commit(the_repository, item)
|
||||
#endif
|
||||
|
||||
|
|
18
revision.c
18
revision.c
|
@ -440,7 +440,7 @@ static struct commit *handle_commit(struct rev_info *revs,
|
|||
if (object->type == OBJ_COMMIT) {
|
||||
struct commit *commit = (struct commit *)object;
|
||||
|
||||
if (parse_commit(commit) < 0)
|
||||
if (repo_parse_commit(revs->repo, commit) < 0)
|
||||
die("unable to parse commit %s", name);
|
||||
if (flags & UNINTERESTING) {
|
||||
mark_parents_uninteresting(commit);
|
||||
|
@ -1013,7 +1013,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
|||
ts->treesame[0] = 1;
|
||||
}
|
||||
}
|
||||
if (parse_commit(p) < 0)
|
||||
if (repo_parse_commit(revs->repo, p) < 0)
|
||||
die("cannot simplify commit %s (because of %s)",
|
||||
oid_to_hex(&commit->object.oid),
|
||||
oid_to_hex(&p->object.oid));
|
||||
|
@ -1058,7 +1058,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
|||
* IOW, we pretend this parent is a
|
||||
* "root" commit.
|
||||
*/
|
||||
if (parse_commit(p) < 0)
|
||||
if (repo_parse_commit(revs->repo, p) < 0)
|
||||
die("cannot simplify commit %s (invalid %s)",
|
||||
oid_to_hex(&commit->object.oid),
|
||||
oid_to_hex(&p->object.oid));
|
||||
|
@ -1126,7 +1126,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
|
|||
parent = parent->next;
|
||||
if (p)
|
||||
p->object.flags |= UNINTERESTING;
|
||||
if (parse_commit_gently(p, 1) < 0)
|
||||
if (repo_parse_commit_gently(revs->repo, p, 1) < 0)
|
||||
continue;
|
||||
if (p->parents)
|
||||
mark_parents_uninteresting(p);
|
||||
|
@ -1157,7 +1157,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
|
|||
struct commit *p = parent->item;
|
||||
int gently = revs->ignore_missing_links ||
|
||||
revs->exclude_promisor_objects;
|
||||
if (parse_commit_gently(p, gently) < 0) {
|
||||
if (repo_parse_commit_gently(revs->repo, p, gently) < 0) {
|
||||
if (revs->exclude_promisor_objects &&
|
||||
is_promisor_object(&p->object.oid)) {
|
||||
if (revs->first_parent_only)
|
||||
|
@ -3337,7 +3337,7 @@ static void explore_walk_step(struct rev_info *revs)
|
|||
if (!c)
|
||||
return;
|
||||
|
||||
if (parse_commit_gently(c, 1) < 0)
|
||||
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
|
||||
return;
|
||||
|
||||
if (revs->sort_order == REV_SORT_BY_AUTHOR_DATE)
|
||||
|
@ -3375,7 +3375,7 @@ static void indegree_walk_step(struct rev_info *revs)
|
|||
if (!c)
|
||||
return;
|
||||
|
||||
if (parse_commit_gently(c, 1) < 0)
|
||||
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
|
||||
return;
|
||||
|
||||
explore_to_depth(revs, commit_graph_generation(c));
|
||||
|
@ -3457,7 +3457,7 @@ static void init_topo_walk(struct rev_info *revs)
|
|||
struct commit *c = list->item;
|
||||
uint32_t generation;
|
||||
|
||||
if (parse_commit_gently(c, 1))
|
||||
if (repo_parse_commit_gently(revs->repo, c, 1))
|
||||
continue;
|
||||
|
||||
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)
|
|||
if (parent->object.flags & UNINTERESTING)
|
||||
continue;
|
||||
|
||||
if (parse_commit_gently(parent, 1) < 0)
|
||||
if (repo_parse_commit_gently(revs->repo, parent, 1) < 0)
|
||||
continue;
|
||||
|
||||
generation = commit_graph_generation(parent);
|
||||
|
|
11
submodule.c
11
submodule.c
|
@ -438,13 +438,14 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
|
|||
*/
|
||||
}
|
||||
|
||||
static int prepare_submodule_diff_summary(struct rev_info *rev, const char *path,
|
||||
struct commit *left, struct commit *right,
|
||||
struct commit_list *merge_bases)
|
||||
static int prepare_submodule_diff_summary(struct repository *r, struct rev_info *rev,
|
||||
const char *path,
|
||||
struct commit *left, struct commit *right,
|
||||
struct commit_list *merge_bases)
|
||||
{
|
||||
struct commit_list *list;
|
||||
|
||||
repo_init_revisions(the_repository, rev, NULL);
|
||||
repo_init_revisions(r, rev, NULL);
|
||||
setup_revisions(0, NULL, rev, NULL);
|
||||
rev->left_right = 1;
|
||||
rev->first_parent_only = 1;
|
||||
|
@ -632,7 +633,7 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
|
|||
goto out;
|
||||
|
||||
/* Treat revision walker failure the same as missing commits */
|
||||
if (prepare_submodule_diff_summary(&rev, path, left, right, merge_bases)) {
|
||||
if (prepare_submodule_diff_summary(sub, &rev, path, left, right, merge_bases)) {
|
||||
diff_emit_submodule_error(o, "(revision walker failed)\n");
|
||||
goto out;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче