diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:42 -0700 |
commit | 3a2a1dc17077a27ad1a89db27cb1b4b374f3b0ff (patch) | |
tree | 7cd70df6ba2e915e629a1138373a5c878cd0db45 /shallow.c | |
parent | Merge branch 'is/parsing-line-range' (diff) | |
parent | commit.c: allow lookup_commit_reference to handle arbitrary repositories (diff) | |
download | tgif-3a2a1dc17077a27ad1a89db27cb1b4b374f3b0ff.tar.xz |
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
...
Diffstat (limited to 'shallow.c')
-rw-r--r-- | shallow.c | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -31,7 +31,7 @@ int register_shallow(struct repository *r, const struct object_id *oid) { struct commit_graft *graft = xmalloc(sizeof(struct commit_graft)); - struct commit *commit = lookup_commit(oid); + struct commit *commit = lookup_commit(the_repository, oid); oidcpy(&graft->oid, oid); graft->nr_parent = -1; @@ -96,7 +96,9 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, if (i < heads->nr) { int **depth_slot; commit = (struct commit *) - deref_tag(heads->objects[i++].item, NULL, 0); + deref_tag(the_repository, + heads->objects[i++].item, + NULL, 0); if (!commit || commit->object.type != OBJ_COMMIT) { commit = NULL; continue; @@ -259,7 +261,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data) if (graft->nr_parent != -1) return 0; if (data->flags & SEEN_ONLY) { - struct commit *c = lookup_commit(&graft->oid); + struct commit *c = lookup_commit(the_repository, &graft->oid); if (!c || !(c->object.flags & SEEN)) { if (data->flags & VERBOSE) printf("Removing %s from .git/shallow\n", @@ -492,7 +494,8 @@ static void paint_down(struct paint_info *info, const struct object_id *oid, struct commit_list *head = NULL; int bitmap_nr = DIV_ROUND_UP(info->nr_bits, 32); size_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr); - struct commit *c = lookup_commit_reference_gently(oid, 1); + struct commit *c = lookup_commit_reference_gently(the_repository, oid, + 1); uint32_t *tmp; /* to be freed before return */ uint32_t *bitmap; @@ -554,7 +557,8 @@ static void paint_down(struct paint_info *info, const struct object_id *oid, static int mark_uninteresting(const char *refname, const struct object_id *oid, int flags, void *cb_data) { - struct commit *commit = lookup_commit_reference_gently(oid, 1); + struct commit *commit = lookup_commit_reference_gently(the_repository, + oid, 1); if (!commit) return 0; commit->object.flags |= UNINTERESTING; @@ -622,7 +626,8 @@ void assign_shallow_commits_to_refs(struct shallow_info *info, /* Mark potential bottoms so we won't go out of bound */ for (i = 0; i < nr_shallow; i++) { - struct commit *c = lookup_commit(&oid[shallow[i]]); + struct commit *c = lookup_commit(the_repository, + &oid[shallow[i]]); c->object.flags |= BOTTOM; } @@ -633,7 +638,8 @@ void assign_shallow_commits_to_refs(struct shallow_info *info, int bitmap_size = DIV_ROUND_UP(pi.nr_bits, 32) * sizeof(uint32_t); memset(used, 0, sizeof(*used) * info->shallow->nr); for (i = 0; i < nr_shallow; i++) { - const struct commit *c = lookup_commit(&oid[shallow[i]]); + const struct commit *c = lookup_commit(the_repository, + &oid[shallow[i]]); uint32_t **map = ref_bitmap_at(&pi.ref_bitmap, c); if (*map) used[shallow[i]] = xmemdupz(*map, bitmap_size); @@ -664,7 +670,8 @@ static int add_ref(const char *refname, const struct object_id *oid, { struct commit_array *ca = cb_data; ALLOC_GROW(ca->commits, ca->nr + 1, ca->alloc); - ca->commits[ca->nr] = lookup_commit_reference_gently(oid, 1); + ca->commits[ca->nr] = lookup_commit_reference_gently(the_repository, + oid, 1); if (ca->commits[ca->nr]) ca->nr++; return 0; @@ -702,7 +709,7 @@ static void post_assign_shallow(struct shallow_info *info, for (i = dst = 0; i < info->nr_theirs; i++) { if (i != dst) info->theirs[dst] = info->theirs[i]; - c = lookup_commit(&oid[info->theirs[i]]); + c = lookup_commit(the_repository, &oid[info->theirs[i]]); bitmap = ref_bitmap_at(ref_bitmap, c); if (!*bitmap) continue; @@ -723,7 +730,7 @@ static void post_assign_shallow(struct shallow_info *info, for (i = dst = 0; i < info->nr_ours; i++) { if (i != dst) info->ours[dst] = info->ours[i]; - c = lookup_commit(&oid[info->ours[i]]); + c = lookup_commit(the_repository, &oid[info->ours[i]]); bitmap = ref_bitmap_at(ref_bitmap, c); if (!*bitmap) continue; @@ -745,7 +752,8 @@ static void post_assign_shallow(struct shallow_info *info, int delayed_reachability_test(struct shallow_info *si, int c) { if (si->need_reachability_test[c]) { - struct commit *commit = lookup_commit(&si->shallow->oid[c]); + struct commit *commit = lookup_commit(the_repository, + &si->shallow->oid[c]); if (!si->commits) { struct commit_array ca; |