error(_("Couldn't look up commit object for '%s'"), refname);
return -1;
@ -209,7 +210,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
@@ -209,7 +210,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
return error(_("bad mergetag in commit '%s'"), ref);
if (parse_tag_buffer(tag, extra->value, extra->len))
if (parse_tag_buffer(the_repository, tag, extra->value, extra->len))
return error(_("malformed mergetag in commit '%s'"), ref);
/* iterate over new parents */
@ -443,7 +443,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
@@ -443,7 +443,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
if (get_oid(old_ref, &old_oid) < 0)
return error(_("Not a valid object name: '%s'"), old_ref);
@ -142,7 +143,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@@ -142,7 +143,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@ -167,7 +168,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@@ -167,7 +168,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
assert(o); /* otherwise we'd have returned early */
if (o->flags & SHOWN)
continue;
@ -179,7 +180,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
@@ -179,7 +180,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
/* Clean up objects used, as they will be reused. */
int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size, int check_graph)
int parse_commit_buffer(struct repository *r, struct commit *item, const void *buffer, unsigned long size, int check_graph)
{
const char *tail = buffer;
const char *bufptr = buffer;
@ -382,11 +401,11 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -382,11 +401,11 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@ -401,7 +420,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -401,7 +420,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
*/
if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
@ -409,7 +428,8 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@@ -409,7 +428,8 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
@ -447,9 +467,9 @@ int parse_commit_internal(struct commit *item, int quiet_on_missing, int use_com
@@ -447,9 +467,9 @@ int parse_commit_internal(struct commit *item, int quiet_on_missing, int use_com
oid_to_hex(&item->object.oid));
}
ret = parse_commit_buffer(item, buffer, size, 0);
ret = parse_commit_buffer(the_repository, item, buffer, size, 0);
@ -157,7 +158,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
@@ -157,7 +158,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
}
if (!oidcmp(&two->object.oid, &shifted))
return two;
return lookup_tree(&shifted);
return lookup_tree(the_repository, &shifted);
}
static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
@ -415,7 +416,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
@@ -415,7 +416,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
return NULL;
}
result = lookup_tree(&active_cache_tree->oid);
result = lookup_tree(the_repository, &active_cache_tree->oid);
return result;
}
@ -1191,9 +1192,9 @@ static int merge_submodule(struct merge_options *o,
@@ -1191,9 +1192,9 @@ static int merge_submodule(struct merge_options *o,
return 0;
}
if (!(commit_base = lookup_commit_reference(base)) ||
!(commit_a = lookup_commit_reference(a)) ||
!(commit_b = lookup_commit_reference(b))) {
if (!(commit_base = lookup_commit_reference(the_repository, base)) ||
* 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(the_repository, 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(the_repository, parse_object(the_repository, new_oid),
NULL, 0);
if (!o || o->type != OBJ_COMMIT)
return 0;
new_commit = (struct commit *) o;
@ -1865,13 +1868,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
@@ -1865,13 +1868,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
/* Cannot stat if what we used to build on no longer exists */
@ -125,7 +125,7 @@ void release_tag_memory(struct tag *t)
@@ -125,7 +125,7 @@ void release_tag_memory(struct tag *t)
t->date = 0;
}
int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, unsigned long size)
{
struct object_id oid;
char type[20];
@ -153,13 +153,13 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
@@ -153,13 +153,13 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
@ -194,13 +195,13 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match,
@@ -194,13 +195,13 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match,
return 0;
}
struct tree *lookup_tree(const struct object_id *oid)
struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
{
struct object *obj = lookup_object(oid->hash);
struct object *obj = lookup_object(r, oid->hash);
if (!obj)
return create_object(the_repository, oid->hash,
alloc_tree_node(the_repository));
return object_as_type(obj, OBJ_TREE, 0);
return create_object(r, oid->hash,
alloc_tree_node(r));
return object_as_type(r, obj, OBJ_TREE, 0);
}
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
@ -244,7 +245,7 @@ void free_tree_buffer(struct tree *tree)
@@ -244,7 +245,7 @@ void free_tree_buffer(struct tree *tree)
struct tree *parse_tree_indirect(const struct object_id *oid)