Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2019-02-19 03:05:14 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-01 05:57:38 +0300
commiteed0e60f02bea5cc87830c203de86207c43cc57c (patch)
tree3297cab348065c6801b971424b8ae48e674aa862
parentae041a0f9a8f5bd236441a9384a0119cd5a8f791 (diff)
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>
-rw-r--r--http.c10
-rw-r--r--http.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/http.c b/http.c
index 993ddc956a..458d07fabb 100644
--- a/http.c
+++ b/http.c
@@ -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;
diff --git a/http.h b/http.h
index 4eb4e808e5..10d3cfdb80 100644
--- a/http.h
+++ b/http.h
@@ -225,7 +225,7 @@ struct http_object_request {
long http_code;
struct object_id oid;
struct object_id real_oid;
- git_SHA_CTX c;
+ git_hash_ctx c;
git_zstream stream;
int zret;
int rename;