Skip to content

Commit eed0e60

Browse files
bk2204gitster
authored andcommitted
http: compute hash of downloaded objects using the_hash_algo
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ae041a0 commit eed0e60

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

http.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,8 +2337,8 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb,
23372337
freq->stream.next_out = expn;
23382338
freq->stream.avail_out = sizeof(expn);
23392339
freq->zret = git_inflate(&freq->stream, Z_SYNC_FLUSH);
2340-
git_SHA1_Update(&freq->c, expn,
2341-
sizeof(expn) - freq->stream.avail_out);
2340+
the_hash_algo->update_fn(&freq->c, expn,
2341+
sizeof(expn) - freq->stream.avail_out);
23422342
} while (freq->stream.avail_in && freq->zret == Z_OK);
23432343
return size;
23442344
}
@@ -2396,7 +2396,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
23962396

23972397
git_inflate_init(&freq->stream);
23982398

2399-
git_SHA1_Init(&freq->c);
2399+
the_hash_algo->init_fn(&freq->c);
24002400

24012401
freq->url = get_remote_object_url(base_url, hex, 0);
24022402

@@ -2431,7 +2431,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
24312431
if (prev_read == -1) {
24322432
memset(&freq->stream, 0, sizeof(freq->stream));
24332433
git_inflate_init(&freq->stream);
2434-
git_SHA1_Init(&freq->c);
2434+
the_hash_algo->init_fn(&freq->c);
24352435
if (prev_posn>0) {
24362436
prev_posn = 0;
24372437
lseek(freq->localfile, 0, SEEK_SET);
@@ -2502,7 +2502,7 @@ int finish_http_object_request(struct http_object_request *freq)
25022502
}
25032503

25042504
git_inflate_end(&freq->stream);
2505-
git_SHA1_Final(freq->real_oid.hash, &freq->c);
2505+
the_hash_algo->final_fn(freq->real_oid.hash, &freq->c);
25062506
if (freq->zret != Z_STREAM_END) {
25072507
unlink_or_warn(freq->tmpfile.buf);
25082508
return -1;

http.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct http_object_request {
225225
long http_code;
226226
struct object_id oid;
227227
struct object_id real_oid;
228-
git_SHA_CTX c;
228+
git_hash_ctx c;
229229
git_zstream stream;
230230
int zret;
231231
int rename;

0 commit comments

Comments
 (0)