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

@ -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"
@ -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)
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,
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)) ||
!(commit_a = lookup_commit_reference(the_repository, a)) ||
!(commit_b = lookup_commit_reference(the_repository, b))) {
output(o, 1, _("Failed to merge submodule %s (commits not present)"), path);
return 0;
}
@ -3426,7 +3427,7 @@ int merge_recursive(struct merge_options *o,
/* if there is no common ancestor, use an empty tree */
struct tree *tree;
tree = lookup_tree(the_hash_algo->empty_tree);
tree = lookup_tree(the_repository, the_repository->hash_algo->empty_tree);
merged_common_ancestors = make_virtual_commit(tree, "ancestor");
}
@ -3488,7 +3489,9 @@ 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(the_repository, parse_object(the_repository, oid),
name,
strlen(name));
if (!object)
return NULL;
if (object->type == OBJ_TREE)