147
return 0;
148
}
149
150
-static void prefetch(struct walker *walker, unsigned char *sha1)
150
+static void prefetch(struct walker *walker, const struct object_id *oid)
151
{
152
struct object_request *newreq;
153
struct walker_data *data = walker->data;
154
155
newreq = xmalloc(sizeof(*newreq));
156
newreq->walker = walker;
157
- oidread(&newreq->oid, sha1, the_repository->hash_algo);
157
+ oidcpy(&newreq->oid, oid);
158
newreq->repo = data->alt;
159
newreq->state = WAITING;
160
newreq->req = NULL;
422
return ret;
423
}
424
425
-static int http_fetch_pack(struct walker *walker, struct alt_base *repo, unsigned char *sha1)
425
+static int http_fetch_pack(struct walker *walker, struct alt_base *repo,
426
+ const struct object_id *oid)
427
{
428
struct packed_git *target;
429
int ret;
432
433
if (fetch_indices(walker, repo))
434
return -1;
434
- target = find_sha1_pack(sha1, repo->packs);
435
+ target = find_sha1_pack(oid->hash, repo->packs);
436
if (!target)
437
return -1;
438
close_pack_index(target);
441
fprintf(stderr, "Getting pack %s\n",
442
hash_to_hex(target->hash));
443
fprintf(stderr, " which contains %s\n",
443
- hash_to_hex(sha1));
444
+ oid_to_hex(oid));
445
}
446
447
preq = new_http_pack_request(target->hash, repo->base);
478
release_object_request(obj_req);
479
}
480
480
-static int fetch_object(struct walker *walker, unsigned char *hash)
481
+static int fetch_object(struct walker *walker, const struct object_id *oid)
482
{
482
- char *hex = hash_to_hex(hash);
483
+ char *hex = oid_to_hex(oid);
484
int ret = 0;
485
struct object_request *obj_req = NULL;
486
struct http_object_request *req;
488
489
list_for_each(pos, head) {
490
obj_req = list_entry(pos, struct object_request, node);
490
- if (hasheq(obj_req->oid.hash, hash, the_repository->hash_algo))
491
+ if (oideq(&obj_req->oid, oid))
492
break;
493
}
494
if (!obj_req)
549
return ret;
550
}
551
551
-static int fetch(struct walker *walker, unsigned char *hash)
552
+static int fetch(struct walker *walker, const struct object_id *oid)
553
{
554
struct walker_data *data = walker->data;
555
struct alt_base *altbase = data->alt;
556
556
- if (!fetch_object(walker, hash))
557
+ if (!fetch_object(walker, oid))
558
return 0;
559
while (altbase) {
559
- if (!http_fetch_pack(walker, altbase, hash))
560
+ if (!http_fetch_pack(walker, altbase, oid))
561
return 0;
562
fetch_alternates(walker, data->alt->base);
563
altbase = altbase->next;
564
}
564
- return error("Unable to find %s under %s", hash_to_hex(hash),
565
+ return error("Unable to find %s under %s", oid_to_hex(oid),
566
data->alt->base);
567
}
568