Merge branch 'pb/trailers-from-command-line' into next
[gitweb.git] / shallow.c
index ef7ca78993df20082c858a7d2b8c7094fcbd1590..f5591e56dab67d6113deb8196c4a68c8af3f2ee0 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -107,7 +107,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.oid.hash)) != NULL &&
+                    (graft = lookup_commit_graft(&commit->object.oid)) != NULL &&
                     graft->nr_parent < 0)) {
                        commit_list_insert(commit, &result);
                        commit->object.flags |= shallow_flag;
@@ -398,7 +398,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)
        for (i = 0; i < sa->nr; i++) {
                if (has_object_file(sa->oid + i)) {
                        struct commit_graft *graft;
-                       graft = lookup_commit_graft(sa->oid[i].hash);
+                       graft = lookup_commit_graft(&sa->oid[i]);
                        if (graft && graft->nr_parent < 0)
                                continue;
                        info->ours[info->nr_ours++] = i;
@@ -443,7 +443,7 @@ struct paint_info {
 
 static uint32_t *paint_alloc(struct paint_info *info)
 {
-       unsigned nr = (info->nr_bits + 31) / 32;
+       unsigned nr = DIV_ROUND_UP(info->nr_bits, 32);
        unsigned size = nr * sizeof(uint32_t);
        void *p;
        if (!info->pool_count || size > info->end - info->free) {
@@ -471,7 +471,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
 {
        unsigned int i, nr;
        struct commit_list *head = NULL;
-       int bitmap_nr = (info->nr_bits + 31) / 32;
+       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);
        uint32_t *tmp; /* to be freed before return */
@@ -611,7 +611,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
                paint_down(&pi, ref->oid + i, i);
 
        if (used) {
-               int bitmap_size = ((pi.nr_bits + 31) / 32) * sizeof(uint32_t);
+               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]]);
@@ -672,7 +672,7 @@ static void post_assign_shallow(struct shallow_info *info,
        struct commit *c;
        uint32_t **bitmap;
        int dst, i, j;
-       int bitmap_nr = (info->ref->nr + 31) / 32;
+       int bitmap_nr = DIV_ROUND_UP(info->ref->nr, 32);
        struct commit_array ca;
 
        trace_printf_key(&trace_shallow, "shallow: post_assign_shallow\n");