Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
http-walker: convert struct object_request to use struct object_id
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 12 Mar 2018 02:27:31 +0000
(
02:27
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 14 Mar 2018 16:23:48 +0000
(09:23 -0700)
Convert struct object_request to use struct object_id by updating the
definition and applying the following semantic patch, plus the standard
object_id transforms:
@@
struct object_request E1;
@@
- E1.sha1
+ E1.oid.hash
@@
struct object_request *E1;
@@
- E1->sha1
+ E1->oid.hash
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-walker.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
aab9583
)
diff --git
a/http-walker.c
b/http-walker.c
index 07c2b1af826d3e24e2568e5bdef17806f355048f..f506f394ac3b2bb6e7cf253f5af8641b0c14664b 100644
(file)
--- a/
http-walker.c
+++ b/
http-walker.c
@@
-22,7
+22,7
@@
enum object_request_state {
struct object_request {
struct walker *walker;
struct object_request {
struct walker *walker;
-
unsigned char sha1[20]
;
+
struct object_id oid
;
struct alt_base *repo;
enum object_request_state state;
struct http_object_request *req;
struct alt_base *repo;
enum object_request_state state;
struct http_object_request *req;
@@
-56,7
+56,7
@@
static void start_object_request(struct walker *walker,
struct active_request_slot *slot;
struct http_object_request *req;
struct active_request_slot *slot;
struct http_object_request *req;
- req = new_http_object_request(obj_req->repo->base, obj_req->
sha1
);
+ req = new_http_object_request(obj_req->repo->base, obj_req->
oid.hash
);
if (req == NULL) {
obj_req->state = ABORTED;
return;
if (req == NULL) {
obj_req->state = ABORTED;
return;
@@
-82,7
+82,7
@@
static void finish_object_request(struct object_request *obj_req)
return;
if (obj_req->req->rename == 0)
return;
if (obj_req->req->rename == 0)
- walker_say(obj_req->walker, "got %s\n",
sha1_to_hex(obj_req->sha1
));
+ walker_say(obj_req->walker, "got %s\n",
oid_to_hex(&obj_req->oid
));
}
static void process_object_response(void *callback_data)
}
static void process_object_response(void *callback_data)
@@
-129,7
+129,7
@@
static int fill_active_slot(struct walker *walker)
list_for_each_safe(pos, tmp, head) {
obj_req = list_entry(pos, struct object_request, node);
if (obj_req->state == WAITING) {
list_for_each_safe(pos, tmp, head) {
obj_req = list_entry(pos, struct object_request, node);
if (obj_req->state == WAITING) {
- if (has_sha1_file(obj_req->
sha1
))
+ if (has_sha1_file(obj_req->
oid.hash
))
obj_req->state = COMPLETE;
else {
start_object_request(walker, obj_req);
obj_req->state = COMPLETE;
else {
start_object_request(walker, obj_req);
@@
-148,7
+148,7
@@
static void prefetch(struct walker *walker, unsigned char *sha1)
newreq = xmalloc(sizeof(*newreq));
newreq->walker = walker;
newreq = xmalloc(sizeof(*newreq));
newreq->walker = walker;
- hashcpy(newreq->
sha1
, sha1);
+ hashcpy(newreq->
oid.hash
, sha1);
newreq->repo = data->alt;
newreq->state = WAITING;
newreq->req = NULL;
newreq->repo = data->alt;
newreq->state = WAITING;
newreq->req = NULL;
@@
-481,13
+481,13
@@
static int fetch_object(struct walker *walker, unsigned char *sha1)
list_for_each(pos, head) {
obj_req = list_entry(pos, struct object_request, node);
list_for_each(pos, head) {
obj_req = list_entry(pos, struct object_request, node);
- if (!hashcmp(obj_req->
sha1
, sha1))
+ if (!hashcmp(obj_req->
oid.hash
, sha1))
break;
}
if (obj_req == NULL)
return error("Couldn't find request for %s in the queue", hex);
break;
}
if (obj_req == NULL)
return error("Couldn't find request for %s in the queue", hex);
- if (has_sha1_file(obj_req->
sha1
)) {
+ if (has_sha1_file(obj_req->
oid.hash
)) {
if (obj_req->req != NULL)
abort_http_object_request(obj_req->req);
abort_object_request(obj_req);
if (obj_req->req != NULL)
abort_http_object_request(obj_req->req);
abort_object_request(obj_req);
@@
-541,7
+541,7
@@
static int fetch_object(struct walker *walker, unsigned char *sha1)
} else if (req->zret != Z_STREAM_END) {
walker->corrupt_object_found++;
ret = error("File %s (%s) corrupt", hex, req->url);
} else if (req->zret != Z_STREAM_END) {
walker->corrupt_object_found++;
ret = error("File %s (%s) corrupt", hex, req->url);
- } else if (hashcmp(obj_req->
sha1
, req->real_sha1)) {
+ } else if (hashcmp(obj_req->
oid.hash
, req->real_sha1)) {
ret = error("File %s has bad hash", hex);
} else if (req->rename < 0) {
struct strbuf buf = STRBUF_INIT;
ret = error("File %s has bad hash", hex);
} else if (req->rename < 0) {
struct strbuf buf = STRBUF_INIT;