diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2019-02-19 00:05:14 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-01 11:57:38 +0900 |
commit | eed0e60f02bea5cc87830c203de86207c43cc57c (patch) | |
tree | 3297cab348065c6801b971424b8ae48e674aa862 /http.c | |
parent | ae041a0f9a8f5bd236441a9384a0119cd5a8f791 (diff) | |
download | git-eed0e60f02bea5cc87830c203de86207c43cc57c.tar.gz |
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>
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -2337,8 +2337,8 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb, freq->stream.next_out = expn; freq->stream.avail_out = sizeof(expn); freq->zret = git_inflate(&freq->stream, Z_SYNC_FLUSH); - git_SHA1_Update(&freq->c, expn, - sizeof(expn) - freq->stream.avail_out); + the_hash_algo->update_fn(&freq->c, expn, + sizeof(expn) - freq->stream.avail_out); } while (freq->stream.avail_in && freq->zret == Z_OK); return size; } @@ -2396,7 +2396,7 @@ struct http_object_request *new_http_object_request(const char *base_url, git_inflate_init(&freq->stream); - git_SHA1_Init(&freq->c); + the_hash_algo->init_fn(&freq->c); freq->url = get_remote_object_url(base_url, hex, 0); @@ -2431,7 +2431,7 @@ struct http_object_request *new_http_object_request(const char *base_url, if (prev_read == -1) { memset(&freq->stream, 0, sizeof(freq->stream)); git_inflate_init(&freq->stream); - git_SHA1_Init(&freq->c); + the_hash_algo->init_fn(&freq->c); if (prev_posn>0) { prev_posn = 0; lseek(freq->localfile, 0, SEEK_SET); @@ -2502,7 +2502,7 @@ int finish_http_object_request(struct http_object_request *freq) } git_inflate_end(&freq->stream); - git_SHA1_Final(freq->real_oid.hash, &freq->c); + the_hash_algo->final_fn(freq->real_oid.hash, &freq->c); if (freq->zret != Z_STREAM_END) { unlink_or_warn(freq->tmpfile.buf); return -1; |