Merge branch 'sb/object-store-lookup'

lookup_commit_reference() and friends have been updated to find
in-core object for a specific in-core repository instance.

* sb/object-store-lookup: (32 commits)
  commit.c: allow lookup_commit_reference to handle arbitrary repositories
  commit.c: allow lookup_commit_reference_gently to handle arbitrary repositories
  tag.c: allow deref_tag to handle arbitrary repositories
  object.c: allow parse_object to handle arbitrary repositories
  object.c: allow parse_object_buffer to handle arbitrary repositories
  commit.c: allow get_cached_commit_buffer to handle arbitrary repositories
  commit.c: allow set_commit_buffer to handle arbitrary repositories
  commit.c: migrate the commit buffer to the parsed object store
  commit-slabs: remove realloc counter outside of slab struct
  commit.c: allow parse_commit_buffer to handle arbitrary repositories
  tag: allow parse_tag_buffer to handle arbitrary repositories
  tag: allow lookup_tag to handle arbitrary repositories
  commit: allow lookup_commit to handle arbitrary repositories
  tree: allow lookup_tree to handle arbitrary repositories
  blob: allow lookup_blob to handle arbitrary repositories
  object: allow lookup_object to handle arbitrary repositories
  object: allow object_as_type to handle arbitrary repositories
  tag: add repository argument to deref_tag
  tag: add repository argument to parse_tag_buffer
  tag: add repository argument to lookup_tag
  ...
This commit is contained in:
Junio C Hamano
2018-08-02 15:30:42 -07:00
82 changed files with 487 additions and 361 deletions

View File

@ -433,7 +433,7 @@ static int read_oneliner(struct strbuf *buf,
static struct tree *empty_tree(void)
{
return lookup_tree(the_hash_algo->empty_tree);
return lookup_tree(the_repository, the_repository->hash_algo->empty_tree);
}
static int error_dirty_index(struct replay_opts *opts)
@ -594,7 +594,7 @@ static int is_index_unchanged(void)
if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
return error(_("could not resolve HEAD commit"));
head_commit = lookup_commit(&head_oid);
head_commit = lookup_commit(the_repository, &head_oid);
/*
* If head_commit is NULL, check_commit, called from
@ -1101,7 +1101,7 @@ void print_commit_summary(const char *prefix, const struct object_id *oid,
struct strbuf author_ident = STRBUF_INIT;
struct strbuf committer_ident = STRBUF_INIT;
commit = lookup_commit(oid);
commit = lookup_commit(the_repository, oid);
if (!commit)
die(_("couldn't look up newly created commit"));
if (parse_commit(commit))
@ -1176,7 +1176,7 @@ static int parse_head(struct commit **head)
if (get_oid("HEAD", &oid)) {
current_head = NULL;
} else {
current_head = lookup_commit_reference(&oid);
current_head = lookup_commit_reference(the_repository, &oid);
if (!current_head)
return error(_("could not parse HEAD"));
if (oidcmp(&oid, &current_head->object.oid)) {
@ -1511,7 +1511,7 @@ static int update_squash_messages(enum todo_command command,
if (get_oid("HEAD", &head))
return error(_("need a HEAD to fixup"));
if (!(head_commit = lookup_commit_reference(&head)))
if (!(head_commit = lookup_commit_reference(the_repository, &head)))
return error(_("could not read HEAD"));
if (!(head_message = get_commit_buffer(head_commit, NULL)))
return error(_("could not read HEAD's commit message"));
@ -2007,7 +2007,7 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
if (status < 0)
return -1;
item->commit = lookup_commit_reference(&commit_oid);
item->commit = lookup_commit_reference(the_repository, &commit_oid);
return !item->commit;
}
@ -3634,7 +3634,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
continue;
if (!get_oid(name, &oid)) {
if (!lookup_commit_reference_gently(&oid, 1)) {
if (!lookup_commit_reference_gently(the_repository, &oid, 1)) {
enum object_type type = oid_object_info(the_repository,
&oid,
NULL);