mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
revision: use repository from rev_info when parsing commits
This is needed when repo_init_revisions() is called with a repository that is not the_repository to ensure appropriate repository is used in repo_parse_commit_internal(). If the wrong repository is used, a fatal error is the commit-graph machinery occurs: fatal: invalid commit position. commit-graph is likely corrupt Since revision.c was the only user of the parse_commit_gently compatibility define, remove it from commit.h. Signed-off-by: Michael Forney <mforney@mforney.org> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
af6b65d45e
commit
ea3f7e598c
1
commit.h
1
commit.h
|
@ -97,7 +97,6 @@ static inline int parse_commit_no_graph(struct commit *commit)
|
||||||
|
|
||||||
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
#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_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)
|
#define parse_commit(item) repo_parse_commit(the_repository, item)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
18
revision.c
18
revision.c
|
@ -435,7 +435,7 @@ static struct commit *handle_commit(struct rev_info *revs,
|
||||||
if (object->type == OBJ_COMMIT) {
|
if (object->type == OBJ_COMMIT) {
|
||||||
struct commit *commit = (struct commit *)object;
|
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);
|
die("unable to parse commit %s", name);
|
||||||
if (flags & UNINTERESTING) {
|
if (flags & UNINTERESTING) {
|
||||||
mark_parents_uninteresting(commit);
|
mark_parents_uninteresting(commit);
|
||||||
|
@ -851,7 +851,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
ts->treesame[0] = 1;
|
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)",
|
die("cannot simplify commit %s (because of %s)",
|
||||||
oid_to_hex(&commit->object.oid),
|
oid_to_hex(&commit->object.oid),
|
||||||
oid_to_hex(&p->object.oid));
|
oid_to_hex(&p->object.oid));
|
||||||
|
@ -884,7 +884,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
* IOW, we pretend this parent is a
|
* IOW, we pretend this parent is a
|
||||||
* "root" commit.
|
* "root" commit.
|
||||||
*/
|
*/
|
||||||
if (parse_commit(p) < 0)
|
if (repo_parse_commit(revs->repo, p) < 0)
|
||||||
die("cannot simplify commit %s (invalid %s)",
|
die("cannot simplify commit %s (invalid %s)",
|
||||||
oid_to_hex(&commit->object.oid),
|
oid_to_hex(&commit->object.oid),
|
||||||
oid_to_hex(&p->object.oid));
|
oid_to_hex(&p->object.oid));
|
||||||
|
@ -948,7 +948,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
|
||||||
parent = parent->next;
|
parent = parent->next;
|
||||||
if (p)
|
if (p)
|
||||||
p->object.flags |= UNINTERESTING;
|
p->object.flags |= UNINTERESTING;
|
||||||
if (parse_commit_gently(p, 1) < 0)
|
if (repo_parse_commit_gently(revs->repo, p, 1) < 0)
|
||||||
continue;
|
continue;
|
||||||
if (p->parents)
|
if (p->parents)
|
||||||
mark_parents_uninteresting(p);
|
mark_parents_uninteresting(p);
|
||||||
|
@ -979,7 +979,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
|
||||||
struct commit *p = parent->item;
|
struct commit *p = parent->item;
|
||||||
int gently = revs->ignore_missing_links ||
|
int gently = revs->ignore_missing_links ||
|
||||||
revs->exclude_promisor_objects;
|
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 &&
|
if (revs->exclude_promisor_objects &&
|
||||||
is_promisor_object(&p->object.oid)) {
|
is_promisor_object(&p->object.oid)) {
|
||||||
if (revs->first_parent_only)
|
if (revs->first_parent_only)
|
||||||
|
@ -3130,7 +3130,7 @@ static void explore_walk_step(struct rev_info *revs)
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (parse_commit_gently(c, 1) < 0)
|
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (revs->sort_order == REV_SORT_BY_AUTHOR_DATE)
|
if (revs->sort_order == REV_SORT_BY_AUTHOR_DATE)
|
||||||
|
@ -3168,7 +3168,7 @@ static void indegree_walk_step(struct rev_info *revs)
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (parse_commit_gently(c, 1) < 0)
|
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
explore_to_depth(revs, c->generation);
|
explore_to_depth(revs, c->generation);
|
||||||
|
@ -3249,7 +3249,7 @@ static void init_topo_walk(struct rev_info *revs)
|
||||||
for (list = revs->commits; list; list = list->next) {
|
for (list = revs->commits; list; list = list->next) {
|
||||||
struct commit *c = list->item;
|
struct commit *c = list->item;
|
||||||
|
|
||||||
if (parse_commit_gently(c, 1))
|
if (repo_parse_commit_gently(revs->repo, c, 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
test_flag_and_insert(&info->explore_queue, c, TOPO_WALK_EXPLORED);
|
test_flag_and_insert(&info->explore_queue, c, TOPO_WALK_EXPLORED);
|
||||||
|
@ -3311,7 +3311,7 @@ static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
|
||||||
if (parent->object.flags & UNINTERESTING)
|
if (parent->object.flags & UNINTERESTING)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (parse_commit_gently(parent, 1) < 0)
|
if (repo_parse_commit_gently(revs->repo, parent, 1) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (parent->generation < info->min_generation) {
|
if (parent->generation < info->min_generation) {
|
||||||
|
|
Loading…
Reference in a new issue