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:
parent
b16b60f71b
commit
109cd76dd3
@ -5,6 +5,7 @@
|
|||||||
#include "log-tree.h"
|
#include "log-tree.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "submodule.h"
|
#include "submodule.h"
|
||||||
|
#include "repository.h"
|
||||||
|
|
||||||
static struct rev_info log_tree_opt;
|
static struct rev_info log_tree_opt;
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ static int diff_tree_stdin(char *line)
|
|||||||
line[len-1] = 0;
|
line[len-1] = 0;
|
||||||
if (parse_oid_hex(line, &oid, &p))
|
if (parse_oid_hex(line, &oid, &p))
|
||||||
return -1;
|
return -1;
|
||||||
obj = parse_object(&oid);
|
obj = parse_object(the_repository, &oid);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return -1;
|
return -1;
|
||||||
if (obj->type == OBJ_COMMIT)
|
if (obj->type == OBJ_COMMIT)
|
||||||
|
@ -400,7 +400,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||||||
const char *name = entry->name;
|
const char *name = entry->name;
|
||||||
int flags = (obj->flags & UNINTERESTING);
|
int flags = (obj->flags & UNINTERESTING);
|
||||||
if (!obj->parsed)
|
if (!obj->parsed)
|
||||||
obj = parse_object(&obj->oid);
|
obj = parse_object(the_repository, &obj->oid);
|
||||||
obj = deref_tag(obj, NULL, 0);
|
obj = deref_tag(obj, NULL, 0);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
die(_("invalid object '%s' given."), name);
|
die(_("invalid object '%s' given."), name);
|
||||||
|
@ -801,7 +801,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
|
|||||||
|
|
||||||
/* handle nested tags */
|
/* handle nested tags */
|
||||||
while (tag && tag->object.type == OBJ_TAG) {
|
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;
|
string_list_append(&extra_refs, full_name)->util = tag;
|
||||||
tag = (struct tag *)tag->tagged;
|
tag = (struct tag *)tag->tagged;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "branch.h"
|
#include "branch.h"
|
||||||
#include "fmt-merge-msg.h"
|
#include "fmt-merge-msg.h"
|
||||||
#include "gpg-interface.h"
|
#include "gpg-interface.h"
|
||||||
|
#include "repository.h"
|
||||||
|
|
||||||
static const char * const fmt_merge_msg_usage[] = {
|
static const char * const fmt_merge_msg_usage[] = {
|
||||||
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
|
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;
|
const struct object_id *oid = &origin_data->oid;
|
||||||
int limit = opts->shortlog_len;
|
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)
|
if (!branch || branch->type != OBJ_COMMIT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -563,7 +565,7 @@ static void find_merge_parents(struct merge_parents *result,
|
|||||||
* "name" here and we do not want to contaminate its
|
* "name" here and we do not want to contaminate its
|
||||||
* util field yet.
|
* util field yet.
|
||||||
*/
|
*/
|
||||||
obj = parse_object(&oid);
|
obj = parse_object(the_repository, &oid);
|
||||||
parent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);
|
parent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);
|
||||||
if (!parent)
|
if (!parent)
|
||||||
continue;
|
continue;
|
||||||
|
@ -452,7 +452,7 @@ static int fsck_handle_ref(const char *refname, const struct object_id *oid,
|
|||||||
{
|
{
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
|
|
||||||
obj = parse_object(oid);
|
obj = parse_object(the_repository, oid);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
if (is_promisor_object(oid)) {
|
if (is_promisor_object(oid)) {
|
||||||
/*
|
/*
|
||||||
@ -614,7 +614,7 @@ static int fsck_cache_tree(struct cache_tree *it)
|
|||||||
fprintf(stderr, "Checking cache tree\n");
|
fprintf(stderr, "Checking cache tree\n");
|
||||||
|
|
||||||
if (0 <= it->entry_count) {
|
if (0 <= it->entry_count) {
|
||||||
struct object *obj = parse_object(&it->oid);
|
struct object *obj = parse_object(the_repository, &it->oid);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
error("%s: invalid sha1 pointer in cache-tree",
|
error("%s: invalid sha1 pointer in cache-tree",
|
||||||
oid_to_hex(&it->oid));
|
oid_to_hex(&it->oid));
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "gpg-interface.h"
|
#include "gpg-interface.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "commit-slab.h"
|
#include "commit-slab.h"
|
||||||
|
#include "repository.h"
|
||||||
|
|
||||||
#define MAIL_DEFAULT_WRAP 72
|
#define MAIL_DEFAULT_WRAP 72
|
||||||
|
|
||||||
@ -619,7 +620,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
|||||||
rev.shown_one = 1;
|
rev.shown_one = 1;
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
o = parse_object(&t->tagged->oid);
|
o = parse_object(the_repository, &t->tagged->oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
ret = error(_("Could not read object %s"),
|
ret = error(_("Could not read object %s"),
|
||||||
oid_to_hex(&t->tagged->oid));
|
oid_to_hex(&t->tagged->oid));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tag.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)
|
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;
|
struct name_ref_data *data = cb_data;
|
||||||
int can_abbreviate_output = data->tags_only && data->name_only;
|
int can_abbreviate_output = data->tags_only && data->name_only;
|
||||||
int deref = 0;
|
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;
|
struct tag *t = (struct tag *) o;
|
||||||
if (!t->tagged)
|
if (!t->tagged)
|
||||||
break; /* broken repository */
|
break; /* broken repository */
|
||||||
o = parse_object(&t->tagged->oid);
|
o = parse_object(the_repository, &t->tagged->oid);
|
||||||
deref = 1;
|
deref = 1;
|
||||||
taggerdate = t->date;
|
taggerdate = t->date;
|
||||||
}
|
}
|
||||||
@ -451,7 +452,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
commit = NULL;
|
commit = NULL;
|
||||||
object = parse_object(&oid);
|
object = parse_object(the_repository, &oid);
|
||||||
if (object) {
|
if (object) {
|
||||||
struct object *peeled = deref_tag(object, *argv, 0);
|
struct object *peeled = deref_tag(object, *argv, 0);
|
||||||
if (peeled && peeled->type == OBJ_COMMIT)
|
if (peeled && peeled->type == OBJ_COMMIT)
|
||||||
|
@ -1108,8 +1108,8 @@ static const char *update(struct command *cmd, struct shallow_info *si)
|
|||||||
struct object *old_object, *new_object;
|
struct object *old_object, *new_object;
|
||||||
struct commit *old_commit, *new_commit;
|
struct commit *old_commit, *new_commit;
|
||||||
|
|
||||||
old_object = parse_object(old_oid);
|
old_object = parse_object(the_repository, old_oid);
|
||||||
new_object = parse_object(new_oid);
|
new_object = parse_object(the_repository, new_oid);
|
||||||
|
|
||||||
if (!old_object || !new_object ||
|
if (!old_object || !new_object ||
|
||||||
old_object->type != OBJ_COMMIT ||
|
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)) {
|
if (is_null_oid(new_oid)) {
|
||||||
struct strbuf err = STRBUF_INIT;
|
struct strbuf err = STRBUF_INIT;
|
||||||
if (!parse_object(old_oid)) {
|
if (!parse_object(the_repository, old_oid)) {
|
||||||
old_oid = NULL;
|
old_oid = NULL;
|
||||||
if (ref_exists(name)) {
|
if (ref_exists(name)) {
|
||||||
rp_warning("Allowing deletion of corrupt ref.");
|
rp_warning("Allowing deletion of corrupt ref.");
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
@ -129,7 +130,7 @@ static int commit_is_complete(struct commit *commit)
|
|||||||
struct commit_list *parent;
|
struct commit_list *parent;
|
||||||
|
|
||||||
c = (struct commit *)object_array_pop(&study);
|
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;
|
c->object.flags |= INCOMPLETE;
|
||||||
|
|
||||||
if (c->object.flags & INCOMPLETE) {
|
if (c->object.flags & INCOMPLETE) {
|
||||||
|
@ -239,7 +239,7 @@ static int finish_object(struct object *obj, const char *name, void *cb_data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
|
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
|
||||||
parse_object(&obj->oid);
|
parse_object(the_repository, &obj->oid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
bundle.c
5
bundle.c
@ -2,6 +2,7 @@
|
|||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "bundle.h"
|
#include "bundle.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
@ -142,7 +143,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
|
|||||||
init_revisions(&revs, NULL);
|
init_revisions(&revs, NULL);
|
||||||
for (i = 0; i < p->nr; i++) {
|
for (i = 0; i < p->nr; i++) {
|
||||||
struct ref_list_entry *e = p->list + 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) {
|
if (o) {
|
||||||
o->flags |= PREREQ_MARK;
|
o->flags |= PREREQ_MARK;
|
||||||
add_pending_object(&revs, o, e->name);
|
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++) {
|
for (i = 0; i < p->nr; i++) {
|
||||||
struct ref_list_entry *e = p->list + 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 */
|
assert(o); /* otherwise we'd have returned early */
|
||||||
if (o->flags & SHOWN)
|
if (o->flags & SHOWN)
|
||||||
continue;
|
continue;
|
||||||
|
5
commit.c
5
commit.c
@ -27,7 +27,8 @@ const char *commit_type = "commit";
|
|||||||
struct commit *lookup_commit_reference_gently(const struct object_id *oid,
|
struct commit *lookup_commit_reference_gently(const struct object_id *oid,
|
||||||
int quiet)
|
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)
|
if (!obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1692,7 +1693,7 @@ struct commit *get_merge_parent(const char *name)
|
|||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
if (get_oid(name, &oid))
|
if (get_oid(name, &oid))
|
||||||
return NULL;
|
return NULL;
|
||||||
obj = parse_object(&oid);
|
obj = parse_object(the_repository, &oid);
|
||||||
commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
|
commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
|
||||||
if (commit && !merge_remote_util(commit))
|
if (commit && !merge_remote_util(commit))
|
||||||
set_merge_remote_desc(commit, name, obj);
|
set_merge_remote_desc(commit, name, obj);
|
||||||
|
18
fetch-pack.c
18
fetch-pack.c
@ -84,7 +84,7 @@ static void cache_one_alternate(const char *refname,
|
|||||||
void *vcache)
|
void *vcache)
|
||||||
{
|
{
|
||||||
struct alternate_object_cache *cache = 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))
|
if (!obj || (obj->flags & ALTERNATE))
|
||||||
return;
|
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)
|
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)
|
if (o && o->type == OBJ_COMMIT)
|
||||||
rev_list_push((struct commit *)o, SEEN);
|
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,
|
static int clear_marks(const char *refname, const struct object_id *oid,
|
||||||
int flag, void *cb_data)
|
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)
|
if (o && o->type == OBJ_COMMIT)
|
||||||
clear_commit_marks((struct commit *)o,
|
clear_commit_marks((struct commit *)o,
|
||||||
@ -437,7 +439,7 @@ static int find_common(struct fetch_pack_args *args,
|
|||||||
if (!lookup_object(oid.hash))
|
if (!lookup_object(oid.hash))
|
||||||
die(_("object not found: %s"), line);
|
die(_("object not found: %s"), line);
|
||||||
/* make sure that it is parsed as shallow */
|
/* make sure that it is parsed as shallow */
|
||||||
if (!parse_object(&oid))
|
if (!parse_object(the_repository, &oid))
|
||||||
die(_("error in object: %s"), line);
|
die(_("error in object: %s"), line);
|
||||||
if (unregister_shallow(&oid))
|
if (unregister_shallow(&oid))
|
||||||
die(_("no shallow found: %s"), line);
|
die(_("no shallow found: %s"), line);
|
||||||
@ -570,14 +572,14 @@ static struct commit_list *complete;
|
|||||||
|
|
||||||
static int mark_complete(const struct object_id *oid)
|
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) {
|
while (o && o->type == OBJ_TAG) {
|
||||||
struct tag *t = (struct tag *) o;
|
struct tag *t = (struct tag *) o;
|
||||||
if (!t->tagged)
|
if (!t->tagged)
|
||||||
break; /* broken repository */
|
break; /* broken repository */
|
||||||
o->flags |= COMPLETE;
|
o->flags |= COMPLETE;
|
||||||
o = parse_object(&t->tagged->oid);
|
o = parse_object(the_repository, &t->tagged->oid);
|
||||||
}
|
}
|
||||||
if (o && o->type == OBJ_COMMIT) {
|
if (o && o->type == OBJ_COMMIT) {
|
||||||
struct commit *commit = (struct commit *)o;
|
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))
|
if (!has_object_file_with_flags(&ref->old_oid, flags))
|
||||||
continue;
|
continue;
|
||||||
o = parse_object(&ref->old_oid);
|
o = parse_object(the_repository, &ref->old_oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1318,7 +1320,7 @@ static void receive_shallow_info(struct fetch_pack_args *args,
|
|||||||
if (!lookup_object(oid.hash))
|
if (!lookup_object(oid.hash))
|
||||||
die(_("object not found: %s"), reader->line);
|
die(_("object not found: %s"), reader->line);
|
||||||
/* make sure that it is parsed as shallow */
|
/* 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);
|
die(_("error in object: %s"), reader->line);
|
||||||
if (unregister_shallow(&oid))
|
if (unregister_shallow(&oid))
|
||||||
die(_("no shallow found: %s"), reader->line);
|
die(_("no shallow found: %s"), reader->line);
|
||||||
|
3
fsck.c
3
fsck.c
@ -1,5 +1,6 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
@ -511,7 +512,7 @@ int fsck_walk(struct object *obj, void *data, struct fsck_options *options)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (obj->type == OBJ_NONE)
|
if (obj->type == OBJ_NONE)
|
||||||
parse_object(&obj->oid);
|
parse_object(the_repository, &obj->oid);
|
||||||
|
|
||||||
switch (obj->type) {
|
switch (obj->type) {
|
||||||
case OBJ_BLOB:
|
case OBJ_BLOB:
|
||||||
|
@ -436,7 +436,7 @@ static int show_text_ref(const char *name, const struct object_id *oid,
|
|||||||
{
|
{
|
||||||
const char *name_nons = strip_namespace(name);
|
const char *name_nons = strip_namespace(name);
|
||||||
struct strbuf *buf = cb_data;
|
struct strbuf *buf = cb_data;
|
||||||
struct object *o = parse_object(oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include "packfile.h"
|
#include "packfile.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef EXPAT_NEEDS_XMLPARSE_H
|
#ifdef EXPAT_NEEDS_XMLPARSE_H
|
||||||
#include <xmlparse.h>
|
#include <xmlparse.h>
|
||||||
#else
|
#else
|
||||||
@ -722,7 +724,7 @@ static void one_remote_object(const struct object_id *oid)
|
|||||||
|
|
||||||
obj = lookup_object(oid->hash);
|
obj = lookup_object(oid->hash);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
obj = parse_object(oid);
|
obj = parse_object(the_repository, oid);
|
||||||
|
|
||||||
/* Ignore remote objects that don't exist locally */
|
/* Ignore remote objects that don't exist locally */
|
||||||
if (!obj)
|
if (!obj)
|
||||||
@ -1459,7 +1461,7 @@ static void add_remote_info_ref(struct remote_ls_ctx *ls)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
o = parse_object(&ref->old_oid);
|
o = parse_object(the_repository, &ref->old_oid);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Unable to parse object %s for remote ref %s\n",
|
"Unable to parse object %s for remote ref %s\n",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "graph.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);
|
warning("invalid replace ref %s", refname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
obj = parse_object(&original_oid);
|
obj = parse_object(the_repository, &original_oid);
|
||||||
if (obj)
|
if (obj)
|
||||||
add_name_decoration(DECORATION_GRAFTED, "replaced", obj);
|
add_name_decoration(DECORATION_GRAFTED, "replaced", obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = parse_object(oid);
|
obj = parse_object(the_repository, oid);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
break;
|
break;
|
||||||
if (!obj->parsed)
|
if (!obj->parsed)
|
||||||
parse_object(&obj->oid);
|
parse_object(the_repository, &obj->oid);
|
||||||
add_name_decoration(DECORATION_REF_TAG, refname, obj);
|
add_name_decoration(DECORATION_REF_TAG, refname, obj);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "cache-tree.h"
|
#include "cache-tree.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
@ -3466,7 +3467,8 @@ static struct commit *get_ref(const struct object_id *oid, const char *name)
|
|||||||
{
|
{
|
||||||
struct object *object;
|
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)
|
if (!object)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (object->type == OBJ_TREE)
|
if (object->type == OBJ_TREE)
|
||||||
|
4
object.c
4
object.c
@ -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,
|
struct object *parse_object_or_die(const struct object_id *oid,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct object *o = parse_object(oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
if (o)
|
if (o)
|
||||||
return o;
|
return o;
|
||||||
|
|
||||||
die(_("unable to parse object: %s"), name ? name : oid_to_hex(oid));
|
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;
|
unsigned long size;
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
|
3
object.h
3
object.h
@ -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.
|
* 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
|
* Like parse_object, but will die() instead of returning NULL. If the
|
||||||
|
@ -1934,7 +1934,7 @@ static int add_promisor_object(const struct object_id *oid,
|
|||||||
void *set_)
|
void *set_)
|
||||||
{
|
{
|
||||||
struct oidset *set = set_;
|
struct oidset *set = set_;
|
||||||
struct object *obj = parse_object(oid);
|
struct object *obj = parse_object(the_repository, oid);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
2
pretty.c
2
pretty.c
@ -1146,7 +1146,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
|||||||
|
|
||||||
/* these depend on the commit */
|
/* these depend on the commit */
|
||||||
if (!commit->object.parsed)
|
if (!commit->object.parsed)
|
||||||
parse_object(&commit->object.oid);
|
parse_object(the_repository, &commit->object.oid);
|
||||||
|
|
||||||
switch (placeholder[0]) {
|
switch (placeholder[0]) {
|
||||||
case 'H': /* commit hash */
|
case 'H': /* commit hash */
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "wildmatch.h"
|
#include "wildmatch.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "remote.h"
|
#include "remote.h"
|
||||||
#include "color.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)
|
if (oid_array_lookup(points_at, oid) >= 0)
|
||||||
return oid;
|
return oid;
|
||||||
obj = parse_object(oid);
|
obj = parse_object(the_repository, oid);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
die(_("malformed object at '%s'"), refname);
|
die(_("malformed object at '%s'"), refname);
|
||||||
if (obj->type == OBJ_TAG)
|
if (obj->type == OBJ_TAG)
|
||||||
|
@ -305,7 +305,8 @@ static struct commit *next_reflog_commit(struct commit_reflog *log)
|
|||||||
{
|
{
|
||||||
for (; log->recno >= 0; log->recno--) {
|
for (; log->recno >= 0; log->recno--) {
|
||||||
struct reflog_info *entry = &log->reflogs->items[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)
|
if (obj && obj->type == OBJ_COMMIT)
|
||||||
return (struct commit *)obj;
|
return (struct commit *)obj;
|
||||||
|
@ -1660,7 +1660,7 @@ static int write_ref_to_lockfile(struct ref_lock *lock,
|
|||||||
struct object *o;
|
struct object *o;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
o = parse_object(oid);
|
o = parse_object(the_repository, oid);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
strbuf_addf(err,
|
strbuf_addf(err,
|
||||||
"trying to write ref '%s' with nonexistent object %s",
|
"trying to write ref '%s' with nonexistent object %s",
|
||||||
|
4
remote.c
4
remote.c
@ -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
|
* Both new_commit and old_commit must be commit-ish and new_commit is descendant of
|
||||||
* old_commit. Otherwise we require --force.
|
* 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)
|
if (!o || o->type != OBJ_COMMIT)
|
||||||
return 0;
|
return 0;
|
||||||
old_commit = (struct commit *) o;
|
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)
|
if (!o || o->type != OBJ_COMMIT)
|
||||||
return 0;
|
return 0;
|
||||||
new_commit = (struct commit *) o;
|
new_commit = (struct commit *) o;
|
||||||
|
14
revision.c
14
revision.c
@ -197,7 +197,7 @@ void add_head_to_pending(struct rev_info *revs)
|
|||||||
struct object *obj;
|
struct object *obj;
|
||||||
if (get_oid("HEAD", &oid))
|
if (get_oid("HEAD", &oid))
|
||||||
return;
|
return;
|
||||||
obj = parse_object(&oid);
|
obj = parse_object(the_repository, &oid);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
add_pending_object(revs, obj, "HEAD");
|
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;
|
struct object *object;
|
||||||
|
|
||||||
object = parse_object(oid);
|
object = parse_object(the_repository, oid);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
if (revs->ignore_missing)
|
if (revs->ignore_missing)
|
||||||
return object;
|
return object;
|
||||||
@ -246,7 +246,7 @@ static struct commit *handle_commit(struct rev_info *revs,
|
|||||||
add_pending_object(revs, object, tag->tag);
|
add_pending_object(revs, object, tag->tag);
|
||||||
if (!tag->tagged)
|
if (!tag->tagged)
|
||||||
die("bad tag");
|
die("bad tag");
|
||||||
object = parse_object(&tag->tagged->oid);
|
object = parse_object(the_repository, &tag->tagged->oid);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
if (revs->ignore_missing_links || (flags & UNINTERESTING))
|
if (revs->ignore_missing_links || (flags & UNINTERESTING))
|
||||||
return NULL;
|
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;
|
struct all_refs_cb *cb = cb_data;
|
||||||
if (!is_null_oid(oid)) {
|
if (!is_null_oid(oid)) {
|
||||||
struct object *o = parse_object(oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
if (o) {
|
if (o) {
|
||||||
o->flags |= cb->all_flags;
|
o->flags |= cb->all_flags;
|
||||||
/* ??? CMDLINEFLAGS ??? */
|
/* ??? CMDLINEFLAGS ??? */
|
||||||
@ -1577,8 +1577,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
|
|||||||
*dotdot = '\0';
|
*dotdot = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
a_obj = parse_object(&a_oid);
|
a_obj = parse_object(the_repository, &a_oid);
|
||||||
b_obj = parse_object(&b_oid);
|
b_obj = parse_object(the_repository, &b_oid);
|
||||||
if (!a_obj || !b_obj)
|
if (!a_obj || !b_obj)
|
||||||
return dotdot_missing(arg, dotdot, revs, symmetric);
|
return dotdot_missing(arg, dotdot, revs, symmetric);
|
||||||
|
|
||||||
@ -2883,7 +2883,7 @@ static int mark_uninteresting(const struct object_id *oid,
|
|||||||
uint32_t pos,
|
uint32_t pos,
|
||||||
void *unused)
|
void *unused)
|
||||||
{
|
{
|
||||||
struct object *o = parse_object(oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
o->flags |= UNINTERESTING | SEEN;
|
o->flags |= UNINTERESTING | SEEN;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ static int add_info_ref(const char *path, const struct object_id *oid,
|
|||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
FILE *fp = cb_data;
|
FILE *fp = cb_data;
|
||||||
struct object *o = parse_object(oid);
|
struct object *o = parse_object(the_repository, oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
14
sha1-name.c
14
sha1-name.c
@ -239,7 +239,7 @@ static int disambiguate_committish_only(const struct object_id *oid, void *cb_da
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* We need to do this the hard way... */
|
/* 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)
|
if (obj && obj->type == OBJ_COMMIT)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -263,7 +263,7 @@ static int disambiguate_treeish_only(const struct object_id *oid, void *cb_data_
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* We need to do this the hard way... */
|
/* 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))
|
if (obj && (obj->type == OBJ_TREE || obj->type == OBJ_COMMIT))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -891,7 +891,7 @@ struct object *peel_to_type(const char *name, int namelen,
|
|||||||
if (name && !namelen)
|
if (name && !namelen)
|
||||||
namelen = strlen(name);
|
namelen = strlen(name);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!o || (!o->parsed && !parse_object(&o->oid)))
|
if (!o || (!o->parsed && !parse_object(the_repository, &o->oid)))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (expected_type == OBJ_ANY || o->type == expected_type)
|
if (expected_type == OBJ_ANY || o->type == expected_type)
|
||||||
return o;
|
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))
|
if (get_oid_1(name, sp - name - 2, &outer, lookup_flags))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
o = parse_object(&outer);
|
o = parse_object(the_repository, &outer);
|
||||||
if (!o)
|
if (!o)
|
||||||
return -1;
|
return -1;
|
||||||
if (!expected_type) {
|
if (!expected_type) {
|
||||||
o = deref_tag(o, name, sp - name - 2);
|
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;
|
return -1;
|
||||||
oidcpy(oid, &o->oid);
|
oidcpy(oid, &o->oid);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1096,7 +1096,7 @@ static int handle_one_ref(const char *path, const struct object_id *oid,
|
|||||||
int flag, void *cb_data)
|
int flag, void *cb_data)
|
||||||
{
|
{
|
||||||
struct commit_list **list = cb_data;
|
struct commit_list **list = cb_data;
|
||||||
struct object *object = parse_object(oid);
|
struct object *object = parse_object(the_repository, oid);
|
||||||
if (!object)
|
if (!object)
|
||||||
return 0;
|
return 0;
|
||||||
if (object->type == OBJ_TAG) {
|
if (object->type == OBJ_TAG) {
|
||||||
@ -1142,7 +1142,7 @@ static int get_oid_oneline(const char *prefix, struct object_id *oid,
|
|||||||
int matches;
|
int matches;
|
||||||
|
|
||||||
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
|
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
|
||||||
if (!parse_object(&commit->object.oid))
|
if (!parse_object(the_repository, &commit->object.oid))
|
||||||
continue;
|
continue;
|
||||||
buf = get_commit_buffer(commit, NULL);
|
buf = get_commit_buffer(commit, NULL);
|
||||||
p = strstr(buf, "\n\n");
|
p = strstr(buf, "\n\n");
|
||||||
|
5
tag.c
5
tag.c
@ -68,7 +68,8 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
|||||||
{
|
{
|
||||||
while (o && o->type == OBJ_TAG)
|
while (o && o->type == OBJ_TAG)
|
||||||
if (((struct tag *)o)->tagged)
|
if (((struct tag *)o)->tagged)
|
||||||
o = parse_object(&((struct tag *)o)->tagged->oid);
|
o = parse_object(the_repository,
|
||||||
|
&((struct tag *)o)->tagged->oid);
|
||||||
else
|
else
|
||||||
o = NULL;
|
o = NULL;
|
||||||
if (!o && warn) {
|
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)
|
struct object *deref_tag_noverify(struct object *o)
|
||||||
{
|
{
|
||||||
while (o && o->type == OBJ_TAG) {
|
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)
|
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged)
|
||||||
o = ((struct tag *)o)->tagged;
|
o = ((struct tag *)o)->tagged;
|
||||||
else
|
else
|
||||||
|
5
tree.c
5
tree.c
@ -8,6 +8,7 @@
|
|||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include "tree-walk.h"
|
#include "tree-walk.h"
|
||||||
|
#include "repository.h"
|
||||||
|
|
||||||
const char *tree_type = "tree";
|
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 tree *parse_tree_indirect(const struct object_id *oid)
|
||||||
{
|
{
|
||||||
struct object *obj = parse_object(oid);
|
struct object *obj = parse_object(the_repository, oid);
|
||||||
do {
|
do {
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -257,6 +258,6 @@ struct tree *parse_tree_indirect(const struct object_id *oid)
|
|||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!obj->parsed)
|
if (!obj->parsed)
|
||||||
parse_object(&obj->oid);
|
parse_object(the_repository, &obj->oid);
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "pkt-line.h"
|
#include "pkt-line.h"
|
||||||
#include "sideband.h"
|
#include "sideband.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
@ -311,7 +312,7 @@ static int got_oid(const char *hex, struct object_id *oid)
|
|||||||
if (!has_object_file(oid))
|
if (!has_object_file(oid))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
o = parse_object(oid);
|
o = parse_object(the_repository, oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
die("oops (%s)", oid_to_hex(oid));
|
die("oops (%s)", oid_to_hex(oid));
|
||||||
if (o->type == OBJ_COMMIT) {
|
if (o->type == OBJ_COMMIT) {
|
||||||
@ -349,7 +350,7 @@ static int reachable(struct commit *want)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!commit->object.parsed)
|
if (!commit->object.parsed)
|
||||||
parse_object(&commit->object.oid);
|
parse_object(the_repository, &commit->object.oid);
|
||||||
if (commit->object.flags & REACHABLE)
|
if (commit->object.flags & REACHABLE)
|
||||||
continue;
|
continue;
|
||||||
commit->object.flags |= REACHABLE;
|
commit->object.flags |= REACHABLE;
|
||||||
@ -800,7 +801,7 @@ static int process_shallow(const char *line, struct object_array *shallows)
|
|||||||
struct object *object;
|
struct object *object;
|
||||||
if (get_oid_hex(arg, &oid))
|
if (get_oid_hex(arg, &oid))
|
||||||
die("invalid shallow line: %s", line);
|
die("invalid shallow line: %s", line);
|
||||||
object = parse_object(&oid);
|
object = parse_object(the_repository, &oid);
|
||||||
if (!object)
|
if (!object)
|
||||||
return 1;
|
return 1;
|
||||||
if (object->type != OBJ_COMMIT)
|
if (object->type != OBJ_COMMIT)
|
||||||
@ -926,7 +927,7 @@ static void receive_needs(void)
|
|||||||
if (allow_filter && parse_feature_request(features, "filter"))
|
if (allow_filter && parse_feature_request(features, "filter"))
|
||||||
filter_capability_requested = 1;
|
filter_capability_requested = 1;
|
||||||
|
|
||||||
o = parse_object(&oid_buf);
|
o = parse_object(the_repository, &oid_buf);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
packet_write_fmt(1,
|
packet_write_fmt(1,
|
||||||
"ERR upload-pack: not our ref %s",
|
"ERR upload-pack: not our ref %s",
|
||||||
@ -1167,7 +1168,7 @@ static int parse_want(const char *line)
|
|||||||
die("git upload-pack: protocol error, "
|
die("git upload-pack: protocol error, "
|
||||||
"expected to get oid, not '%s'", line);
|
"expected to get oid, not '%s'", line);
|
||||||
|
|
||||||
o = parse_object(&oid);
|
o = parse_object(the_repository, &oid);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
packet_write_fmt(1,
|
packet_write_fmt(1,
|
||||||
"ERR upload-pack: not our ref %s",
|
"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);
|
oid_array_append(common, oid);
|
||||||
|
|
||||||
o = parse_object(oid);
|
o = parse_object(the_repository, oid);
|
||||||
if (!o)
|
if (!o)
|
||||||
die("oops (%s)", oid_to_hex(oid));
|
die("oops (%s)", oid_to_hex(oid));
|
||||||
if (o->type == OBJ_COMMIT) {
|
if (o->type == OBJ_COMMIT) {
|
||||||
|
3
walker.c
3
walker.c
@ -1,5 +1,6 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "walker.h"
|
#include "walker.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
@ -178,7 +179,7 @@ static int loop(struct walker *walker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!obj->type)
|
if (!obj->type)
|
||||||
parse_object(&obj->oid);
|
parse_object(the_repository, &obj->oid);
|
||||||
if (process_object(walker, obj))
|
if (process_object(walker, obj))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user