object: add repository argument to parse_object

Add a repository argument to allow the callers of parse_object
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller
2018-06-28 18:21:51 -07:00
committed by Junio C Hamano
parent b16b60f71b
commit 109cd76dd3
33 changed files with 95 additions and 72 deletions

View File

@ -197,7 +197,7 @@ void add_head_to_pending(struct rev_info *revs)
struct object *obj;
if (get_oid("HEAD", &oid))
return;
obj = parse_object(&oid);
obj = parse_object(the_repository, &oid);
if (!obj)
return;
add_pending_object(revs, obj, "HEAD");
@ -209,7 +209,7 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
{
struct object *object;
object = parse_object(oid);
object = parse_object(the_repository, oid);
if (!object) {
if (revs->ignore_missing)
return object;
@ -246,7 +246,7 @@ static struct commit *handle_commit(struct rev_info *revs,
add_pending_object(revs, object, tag->tag);
if (!tag->tagged)
die("bad tag");
object = parse_object(&tag->tagged->oid);
object = parse_object(the_repository, &tag->tagged->oid);
if (!object) {
if (revs->ignore_missing_links || (flags & UNINTERESTING))
return NULL;
@ -1249,7 +1249,7 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
if (!is_null_oid(oid)) {
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
if (o) {
o->flags |= cb->all_flags;
/* ??? CMDLINEFLAGS ??? */
@ -1577,8 +1577,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
*dotdot = '\0';
}
a_obj = parse_object(&a_oid);
b_obj = parse_object(&b_oid);
a_obj = parse_object(the_repository, &a_oid);
b_obj = parse_object(the_repository, &b_oid);
if (!a_obj || !b_obj)
return dotdot_missing(arg, dotdot, revs, symmetric);
@ -2883,7 +2883,7 @@ static int mark_uninteresting(const struct object_id *oid,
uint32_t pos,
void *unused)
{
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
o->flags |= UNINTERESTING | SEEN;
return 0;
}