diff options
Diffstat (limited to 'shallow.c')
-rw-r--r-- | shallow.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -105,7 +105,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, cur_depth++; if ((depth != INFINITE_DEPTH && cur_depth >= depth) || (is_repository_shallow() && !commit->parents && - (graft = lookup_commit_graft(commit->object.sha1)) != NULL && + (graft = lookup_commit_graft(commit->object.oid.hash)) != NULL && graft->nr_parent < 0)) { commit_list_insert(commit, &result); commit->object.flags |= shallow_flag; @@ -167,7 +167,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data) if (!c || !(c->object.flags & SEEN)) { if (data->flags & VERBOSE) printf("Removing %s from .git/shallow\n", - sha1_to_hex(c->object.sha1)); + oid_to_hex(&c->object.oid)); return 0; } } @@ -315,8 +315,8 @@ void prepare_shallow_info(struct shallow_info *info, struct sha1_array *sa) info->shallow = sa; if (!sa) return; - info->ours = xmalloc(sizeof(*info->ours) * sa->nr); - info->theirs = xmalloc(sizeof(*info->theirs) * sa->nr); + ALLOC_ARRAY(info->ours, sa->nr); + ALLOC_ARRAY(info->theirs, sa->nr); for (i = 0; i < sa->nr; i++) { if (has_sha1_file(sa->sha1[i])) { struct commit_graft *graft; @@ -389,7 +389,7 @@ static void paint_down(struct paint_info *info, const unsigned char *sha1, unsigned int i, nr; struct commit_list *head = NULL; int bitmap_nr = (info->nr_bits + 31) / 32; - int bitmap_size = bitmap_nr * sizeof(uint32_t); + size_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr); uint32_t *tmp = xmalloc(bitmap_size); /* to be freed before return */ uint32_t *bitmap = paint_alloc(info); struct commit *c = lookup_commit_reference_gently(sha1, 1); @@ -426,7 +426,7 @@ static void paint_down(struct paint_info *info, const unsigned char *sha1, if (parse_commit(c)) die("unable to parse commit %s", - sha1_to_hex(c->object.sha1)); + oid_to_hex(&c->object.oid)); for (p = c->parents; p; p = p->next) { uint32_t **p_refs = ref_bitmap_at(&info->ref_bitmap, @@ -487,7 +487,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info, struct paint_info pi; trace_printf_key(&trace_shallow, "shallow: assign_shallow_commits_to_refs\n"); - shallow = xmalloc(sizeof(*shallow) * (info->nr_ours + info->nr_theirs)); + ALLOC_ARRAY(shallow, info->nr_ours + info->nr_theirs); for (i = 0; i < info->nr_ours; i++) shallow[nr_shallow++] = info->ours[i]; for (i = 0; i < info->nr_theirs; i++) |