1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 06:16:15 +02:00

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

@ -5,6 +5,7 @@
#include "log-tree.h"
#include "builtin.h"
#include "submodule.h"
#include "repository.h"
static struct rev_info log_tree_opt;
@ -68,7 +69,7 @@ static int diff_tree_stdin(char *line)
line[len-1] = 0;
if (parse_oid_hex(line, &oid, &p))
return -1;
obj = parse_object(&oid);
obj = parse_object(the_repository, &oid);
if (!obj)
return -1;
if (obj->type == OBJ_COMMIT)

View File

@ -400,7 +400,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
const char *name = entry->name;
int flags = (obj->flags & UNINTERESTING);
if (!obj->parsed)
obj = parse_object(&obj->oid);
obj = parse_object(the_repository, &obj->oid);
obj = deref_tag(obj, NULL, 0);
if (!obj)
die(_("invalid object '%s' given."), name);

View File

@ -801,7 +801,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
/* handle nested tags */
while (tag && tag->object.type == OBJ_TAG) {
parse_object(&tag->object.oid);
parse_object(the_repository, &tag->object.oid);
string_list_append(&extra_refs, full_name)->util = tag;
tag = (struct tag *)tag->tagged;
}

View File

@ -11,6 +11,7 @@
#include "branch.h"
#include "fmt-merge-msg.h"
#include "gpg-interface.h"
#include "repository.h"
static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
@ -343,7 +344,8 @@ static void shortlog(const char *name,
const struct object_id *oid = &origin_data->oid;
int limit = opts->shortlog_len;
branch = deref_tag(parse_object(oid), oid_to_hex(oid), GIT_SHA1_HEXSZ);
branch = deref_tag(parse_object(the_repository, oid), oid_to_hex(oid),
GIT_SHA1_HEXSZ);
if (!branch || branch->type != OBJ_COMMIT)
return;
@ -563,7 +565,7 @@ static void find_merge_parents(struct merge_parents *result,
* "name" here and we do not want to contaminate its
* util field yet.
*/
obj = parse_object(&oid);
obj = parse_object(the_repository, &oid);
parent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);
if (!parent)
continue;

View File

@ -452,7 +452,7 @@ static int fsck_handle_ref(const char *refname, const struct object_id *oid,
{
struct object *obj;
obj = parse_object(oid);
obj = parse_object(the_repository, oid);
if (!obj) {
if (is_promisor_object(oid)) {
/*
@ -614,7 +614,7 @@ static int fsck_cache_tree(struct cache_tree *it)
fprintf(stderr, "Checking cache tree\n");
if (0 <= it->entry_count) {
struct object *obj = parse_object(&it->oid);
struct object *obj = parse_object(the_repository, &it->oid);
if (!obj) {
error("%s: invalid sha1 pointer in cache-tree",
oid_to_hex(&it->oid));

View File

@ -30,6 +30,7 @@
#include "gpg-interface.h"
#include "progress.h"
#include "commit-slab.h"
#include "repository.h"
#define MAIL_DEFAULT_WRAP 72
@ -619,7 +620,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
rev.shown_one = 1;
if (ret)
break;
o = parse_object(&t->tagged->oid);
o = parse_object(the_repository, &t->tagged->oid);
if (!o)
ret = error(_("Could not read object %s"),
oid_to_hex(&t->tagged->oid));

View File

@ -1,5 +1,6 @@
#include "builtin.h"
#include "cache.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
#include "tag.h"
@ -203,7 +204,7 @@ static int tipcmp(const void *a_, const void *b_)
static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
{
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
struct name_ref_data *data = cb_data;
int can_abbreviate_output = data->tags_only && data->name_only;
int deref = 0;
@ -261,7 +262,7 @@ static int name_ref(const char *path, const struct object_id *oid, int flags, vo
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o = parse_object(&t->tagged->oid);
o = parse_object(the_repository, &t->tagged->oid);
deref = 1;
taggerdate = t->date;
}
@ -451,7 +452,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
}
commit = NULL;
object = parse_object(&oid);
object = parse_object(the_repository, &oid);
if (object) {
struct object *peeled = deref_tag(object, *argv, 0);
if (peeled && peeled->type == OBJ_COMMIT)

View File

@ -1108,8 +1108,8 @@ static const char *update(struct command *cmd, struct shallow_info *si)
struct object *old_object, *new_object;
struct commit *old_commit, *new_commit;
old_object = parse_object(old_oid);
new_object = parse_object(new_oid);
old_object = parse_object(the_repository, old_oid);
new_object = parse_object(the_repository, new_oid);
if (!old_object || !new_object ||
old_object->type != OBJ_COMMIT ||
@ -1132,7 +1132,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
if (is_null_oid(new_oid)) {
struct strbuf err = STRBUF_INIT;
if (!parse_object(old_oid)) {
if (!parse_object(the_repository, old_oid)) {
old_oid = NULL;
if (ref_exists(name)) {
rp_warning("Allowing deletion of corrupt ref.");

View File

@ -2,6 +2,7 @@
#include "config.h"
#include "lockfile.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
#include "refs.h"
#include "dir.h"
@ -129,7 +130,7 @@ static int commit_is_complete(struct commit *commit)
struct commit_list *parent;
c = (struct commit *)object_array_pop(&study);
if (!c->object.parsed && !parse_object(&c->object.oid))
if (!c->object.parsed && !parse_object(the_repository, &c->object.oid))
c->object.flags |= INCOMPLETE;
if (c->object.flags & INCOMPLETE) {

View File

@ -239,7 +239,7 @@ static int finish_object(struct object *obj, const char *name, void *cb_data)
return 1;
}
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
parse_object(&obj->oid);
parse_object(the_repository, &obj->oid);
return 0;
}

View File

@ -2,6 +2,7 @@
#include "lockfile.h"
#include "bundle.h"
#include "object-store.h"
#include "repository.h"
#include "object.h"
#include "commit.h"
#include "diff.h"
@ -142,7 +143,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
init_revisions(&revs, NULL);
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;
struct object *o = parse_object(&e->oid);
struct object *o = parse_object(the_repository, &e->oid);
if (o) {
o->flags |= PREREQ_MARK;
add_pending_object(&revs, o, e->name);
@ -167,7 +168,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;
struct object *o = parse_object(&e->oid);
struct object *o = parse_object(the_repository, &e->oid);
assert(o); /* otherwise we'd have returned early */
if (o->flags & SHOWN)
continue;

View File

@ -27,7 +27,8 @@ const char *commit_type = "commit";
struct commit *lookup_commit_reference_gently(const struct object_id *oid,
int quiet)
{
struct object *obj = deref_tag(parse_object(oid), NULL, 0);
struct object *obj = deref_tag(parse_object(the_repository, oid),
NULL, 0);
if (!obj)
return NULL;
@ -1692,7 +1693,7 @@ struct commit *get_merge_parent(const char *name)
struct object_id oid;
if (get_oid(name, &oid))
return NULL;
obj = parse_object(&oid);
obj = parse_object(the_repository, &oid);
commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
if (commit && !merge_remote_util(commit))
set_merge_remote_desc(commit, name, obj);

View File

@ -84,7 +84,7 @@ static void cache_one_alternate(const char *refname,
void *vcache)
{
struct alternate_object_cache *cache = vcache;
struct object *obj = parse_object(oid);
struct object *obj = parse_object(the_repository, oid);
if (!obj || (obj->flags & ALTERNATE))
return;
@ -126,7 +126,8 @@ static void rev_list_push(struct commit *commit, int mark)
static int rev_list_insert_ref(const char *refname, const struct object_id *oid)
{
struct object *o = deref_tag(parse_object(oid), refname, 0);
struct object *o = deref_tag(parse_object(the_repository, oid),
refname, 0);
if (o && o->type == OBJ_COMMIT)
rev_list_push((struct commit *)o, SEEN);
@ -143,7 +144,8 @@ static int rev_list_insert_ref_oid(const char *refname, const struct object_id *
static int clear_marks(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
{
struct object *o = deref_tag(parse_object(oid), refname, 0);
struct object *o = deref_tag(parse_object(the_repository, oid),
refname, 0);
if (o && o->type == OBJ_COMMIT)
clear_commit_marks((struct commit *)o,
@ -437,7 +439,7 @@ static int find_common(struct fetch_pack_args *args,
if (!lookup_object(oid.hash))
die(_("object not found: %s"), line);
/* make sure that it is parsed as shallow */
if (!parse_object(&oid))
if (!parse_object(the_repository, &oid))
die(_("error in object: %s"), line);
if (unregister_shallow(&oid))
die(_("no shallow found: %s"), line);
@ -570,14 +572,14 @@ static struct commit_list *complete;
static int mark_complete(const struct object_id *oid)
{
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
while (o && o->type == OBJ_TAG) {
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o->flags |= COMPLETE;
o = parse_object(&t->tagged->oid);
o = parse_object(the_repository, &t->tagged->oid);
}
if (o && o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
@ -768,7 +770,7 @@ static int everything_local(struct fetch_pack_args *args,
if (!has_object_file_with_flags(&ref->old_oid, flags))
continue;
o = parse_object(&ref->old_oid);
o = parse_object(the_repository, &ref->old_oid);
if (!o)
continue;
@ -1318,7 +1320,7 @@ static void receive_shallow_info(struct fetch_pack_args *args,
if (!lookup_object(oid.hash))
die(_("object not found: %s"), reader->line);
/* make sure that it is parsed as shallow */
if (!parse_object(&oid))
if (!parse_object(the_repository, &oid))
die(_("error in object: %s"), reader->line);
if (unregister_shallow(&oid))
die(_("no shallow found: %s"), reader->line);

3
fsck.c
View File

@ -1,5 +1,6 @@
#include "cache.h"
#include "object-store.h"
#include "repository.h"
#include "object.h"
#include "blob.h"
#include "tree.h"
@ -511,7 +512,7 @@ int fsck_walk(struct object *obj, void *data, struct fsck_options *options)
return -1;
if (obj->type == OBJ_NONE)
parse_object(&obj->oid);
parse_object(the_repository, &obj->oid);
switch (obj->type) {
case OBJ_BLOB:

View File

@ -436,7 +436,7 @@ static int show_text_ref(const char *name, const struct object_id *oid,
{
const char *name_nons = strip_namespace(name);
struct strbuf *buf = cb_data;
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
if (!o)
return 0;

View File

@ -1,4 +1,5 @@
#include "cache.h"
#include "repository.h"
#include "commit.h"
#include "tag.h"
#include "blob.h"
@ -14,6 +15,7 @@
#include "packfile.h"
#include "object-store.h"
#ifdef EXPAT_NEEDS_XMLPARSE_H
#include <xmlparse.h>
#else
@ -722,7 +724,7 @@ static void one_remote_object(const struct object_id *oid)
obj = lookup_object(oid->hash);
if (!obj)
obj = parse_object(oid);
obj = parse_object(the_repository, oid);
/* Ignore remote objects that don't exist locally */
if (!obj)
@ -1459,7 +1461,7 @@ static void add_remote_info_ref(struct remote_ls_ctx *ls)
return;
}
o = parse_object(&ref->old_oid);
o = parse_object(the_repository, &ref->old_oid);
if (!o) {
fprintf(stderr,
"Unable to parse object %s for remote ref %s\n",

View File

@ -2,6 +2,7 @@
#include "config.h"
#include "diff.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
#include "tag.h"
#include "graph.h"
@ -98,13 +99,13 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
warning("invalid replace ref %s", refname);
return 0;
}
obj = parse_object(&original_oid);
obj = parse_object(the_repository, &original_oid);
if (obj)
add_name_decoration(DECORATION_GRAFTED, "replaced", obj);
return 0;
}
obj = parse_object(oid);
obj = parse_object(the_repository, oid);
if (!obj)
return 0;
@ -125,7 +126,7 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
if (!obj)
break;
if (!obj->parsed)
parse_object(&obj->oid);
parse_object(the_repository, &obj->oid);
add_name_decoration(DECORATION_REF_TAG, refname, obj);
}
return 0;

View File

@ -9,6 +9,7 @@
#include "lockfile.h"
#include "cache-tree.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
#include "blob.h"
#include "builtin.h"
@ -3466,7 +3467,8 @@ static struct commit *get_ref(const struct object_id *oid, const char *name)
{
struct object *object;
object = deref_tag(parse_object(oid), name, strlen(name));
object = deref_tag(parse_object(the_repository, oid), name,
strlen(name));
if (!object)
return NULL;
if (object->type == OBJ_TREE)

View File

@ -239,14 +239,14 @@ struct object *parse_object_buffer(const struct object_id *oid, enum object_type
struct object *parse_object_or_die(const struct object_id *oid,
const char *name)
{
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
if (o)
return o;
die(_("unable to parse object: %s"), name ? name : oid_to_hex(oid));
}
struct object *parse_object(const struct object_id *oid)
struct object *parse_object_the_repository(const struct object_id *oid)
{
unsigned long size;
enum object_type type;

View File

@ -120,7 +120,8 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet);
*
* Returns NULL if the object is missing or corrupt.
*/
struct object *parse_object(const struct object_id *oid);
#define parse_object(r, oid) parse_object_##r(oid)
struct object *parse_object_the_repository(const struct object_id *oid);
/*
* Like parse_object, but will die() instead of returning NULL. If the

View File

@ -1934,7 +1934,7 @@ static int add_promisor_object(const struct object_id *oid,
void *set_)
{
struct oidset *set = set_;
struct object *obj = parse_object(oid);
struct object *obj = parse_object(the_repository, oid);
if (!obj)
return 1;

View File

@ -1146,7 +1146,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
/* these depend on the commit */
if (!commit->object.parsed)
parse_object(&commit->object.oid);
parse_object(the_repository, &commit->object.oid);
switch (placeholder[0]) {
case 'H': /* commit hash */

View File

@ -4,6 +4,7 @@
#include "refs.h"
#include "wildmatch.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
#include "remote.h"
#include "color.h"
@ -1914,7 +1915,7 @@ static const struct object_id *match_points_at(struct oid_array *points_at,
if (oid_array_lookup(points_at, oid) >= 0)
return oid;
obj = parse_object(oid);
obj = parse_object(the_repository, oid);
if (!obj)
die(_("malformed object at '%s'"), refname);
if (obj->type == OBJ_TAG)

View File

@ -305,7 +305,8 @@ static struct commit *next_reflog_commit(struct commit_reflog *log)
{
for (; log->recno >= 0; log->recno--) {
struct reflog_info *entry = &log->reflogs->items[log->recno];
struct object *obj = parse_object(&entry->noid);
struct object *obj = parse_object(the_repository,
&entry->noid);
if (obj && obj->type == OBJ_COMMIT)
return (struct commit *)obj;

View File

@ -1660,7 +1660,7 @@ static int write_ref_to_lockfile(struct ref_lock *lock,
struct object *o;
int fd;
o = parse_object(oid);
o = parse_object(the_repository, oid);
if (!o) {
strbuf_addf(err,
"trying to write ref '%s' with nonexistent object %s",

View File

@ -1801,12 +1801,12 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
* Both new_commit and old_commit must be commit-ish and new_commit is descendant of
* old_commit. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_oid), NULL, 0);
o = deref_tag(parse_object(the_repository, old_oid), NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;
old_commit = (struct commit *) o;
o = deref_tag(parse_object(new_oid), NULL, 0);
o = deref_tag(parse_object(the_repository, new_oid), NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;
new_commit = (struct commit *) o;

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;
}

View File

@ -56,7 +56,7 @@ static int add_info_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
FILE *fp = cb_data;
struct object *o = parse_object(oid);
struct object *o = parse_object(the_repository, oid);
if (!o)
return -1;

View File

@ -239,7 +239,7 @@ static int disambiguate_committish_only(const struct object_id *oid, void *cb_da
return 0;
/* We need to do this the hard way... */
obj = deref_tag(parse_object(oid), NULL, 0);
obj = deref_tag(parse_object(the_repository, oid), NULL, 0);
if (obj && obj->type == OBJ_COMMIT)
return 1;
return 0;
@ -263,7 +263,7 @@ static int disambiguate_treeish_only(const struct object_id *oid, void *cb_data_
return 0;
/* We need to do this the hard way... */
obj = deref_tag(parse_object(oid), NULL, 0);
obj = deref_tag(parse_object(the_repository, oid), NULL, 0);
if (obj && (obj->type == OBJ_TREE || obj->type == OBJ_COMMIT))
return 1;
return 0;
@ -891,7 +891,7 @@ struct object *peel_to_type(const char *name, int namelen,
if (name && !namelen)
namelen = strlen(name);
while (1) {
if (!o || (!o->parsed && !parse_object(&o->oid)))
if (!o || (!o->parsed && !parse_object(the_repository, &o->oid)))
return NULL;
if (expected_type == OBJ_ANY || o->type == expected_type)
return o;
@ -964,12 +964,12 @@ static int peel_onion(const char *name, int len, struct object_id *oid,
if (get_oid_1(name, sp - name - 2, &outer, lookup_flags))
return -1;
o = parse_object(&outer);
o = parse_object(the_repository, &outer);
if (!o)
return -1;
if (!expected_type) {
o = deref_tag(o, name, sp - name - 2);
if (!o || (!o->parsed && !parse_object(&o->oid)))
if (!o || (!o->parsed && !parse_object(the_repository, &o->oid)))
return -1;
oidcpy(oid, &o->oid);
return 0;
@ -1096,7 +1096,7 @@ static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
struct commit_list **list = cb_data;
struct object *object = parse_object(oid);
struct object *object = parse_object(the_repository, oid);
if (!object)
return 0;
if (object->type == OBJ_TAG) {
@ -1142,7 +1142,7 @@ static int get_oid_oneline(const char *prefix, struct object_id *oid,
int matches;
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
if (!parse_object(&commit->object.oid))
if (!parse_object(the_repository, &commit->object.oid))
continue;
buf = get_commit_buffer(commit, NULL);
p = strstr(buf, "\n\n");

5
tag.c
View File

@ -68,7 +68,8 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
{
while (o && o->type == OBJ_TAG)
if (((struct tag *)o)->tagged)
o = parse_object(&((struct tag *)o)->tagged->oid);
o = parse_object(the_repository,
&((struct tag *)o)->tagged->oid);
else
o = NULL;
if (!o && warn) {
@ -82,7 +83,7 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
struct object *deref_tag_noverify(struct object *o)
{
while (o && o->type == OBJ_TAG) {
o = parse_object(&o->oid);
o = parse_object(the_repository, &o->oid);
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged)
o = ((struct tag *)o)->tagged;
else

5
tree.c
View File

@ -8,6 +8,7 @@
#include "tag.h"
#include "alloc.h"
#include "tree-walk.h"
#include "repository.h"
const char *tree_type = "tree";
@ -244,7 +245,7 @@ void free_tree_buffer(struct tree *tree)
struct tree *parse_tree_indirect(const struct object_id *oid)
{
struct object *obj = parse_object(oid);
struct object *obj = parse_object(the_repository, oid);
do {
if (!obj)
return NULL;
@ -257,6 +258,6 @@ struct tree *parse_tree_indirect(const struct object_id *oid)
else
return NULL;
if (!obj->parsed)
parse_object(&obj->oid);
parse_object(the_repository, &obj->oid);
} while (1);
}

View File

@ -3,6 +3,7 @@
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
#include "repository.h"
#include "object-store.h"
#include "tag.h"
#include "object.h"
@ -311,7 +312,7 @@ static int got_oid(const char *hex, struct object_id *oid)
if (!has_object_file(oid))
return -1;
o = parse_object(oid);
o = parse_object(the_repository, oid);
if (!o)
die("oops (%s)", oid_to_hex(oid));
if (o->type == OBJ_COMMIT) {
@ -349,7 +350,7 @@ static int reachable(struct commit *want)
break;
}
if (!commit->object.parsed)
parse_object(&commit->object.oid);
parse_object(the_repository, &commit->object.oid);
if (commit->object.flags & REACHABLE)
continue;
commit->object.flags |= REACHABLE;
@ -800,7 +801,7 @@ static int process_shallow(const char *line, struct object_array *shallows)
struct object *object;
if (get_oid_hex(arg, &oid))
die("invalid shallow line: %s", line);
object = parse_object(&oid);
object = parse_object(the_repository, &oid);
if (!object)
return 1;
if (object->type != OBJ_COMMIT)
@ -926,7 +927,7 @@ static void receive_needs(void)
if (allow_filter && parse_feature_request(features, "filter"))
filter_capability_requested = 1;
o = parse_object(&oid_buf);
o = parse_object(the_repository, &oid_buf);
if (!o) {
packet_write_fmt(1,
"ERR upload-pack: not our ref %s",
@ -1167,7 +1168,7 @@ static int parse_want(const char *line)
die("git upload-pack: protocol error, "
"expected to get oid, not '%s'", line);
o = parse_object(&oid);
o = parse_object(the_repository, &oid);
if (!o) {
packet_write_fmt(1,
"ERR upload-pack: not our ref %s",
@ -1279,7 +1280,7 @@ static int process_haves(struct oid_array *haves, struct oid_array *common)
oid_array_append(common, oid);
o = parse_object(oid);
o = parse_object(the_repository, oid);
if (!o)
die("oops (%s)", oid_to_hex(oid));
if (o->type == OBJ_COMMIT) {

View File

@ -1,5 +1,6 @@
#include "cache.h"
#include "walker.h"
#include "repository.h"
#include "object-store.h"
#include "commit.h"
#include "tree.h"
@ -178,7 +179,7 @@ static int loop(struct walker *walker)
}
}
if (!obj->type)
parse_object(&obj->oid);
parse_object(the_repository, &obj->oid);
if (process_object(walker, obj))
return -1;
}