http: use idempotent git_hash_discard()
Now that it is OK to call git_hash_discard() even after finalizing the hash, we no longer need the ctx_valid bool added by a2d8ea5a76 (http: discard hash in dumb-http http_object_request, 2026-07-02). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jul 7, 2026 at 23:53 UTC
f1bf9772f85c8522e09d16e662858f8de1636bda
2 files changed
+1
-5
http.c
+1
-4
@@ -2880,7 +2880,6 @@ struct http_object_request *new_http_object_request(const char *base_url,
2880
git_inflate_init(&freq->stream);
2881
2882
git_hash_init(&freq->c, the_hash_algo);
2883
- freq->hash_ctx_valid = 1;
2883
2884
freq->url = get_remote_object_url(base_url, hex, 0);
2885
@@ -2989,7 +2988,6 @@ int finish_http_object_request(struct http_object_request *freq)
2988
}
2989
2990
git_hash_final_oid(&freq->real_oid, &freq->c);
2992
- freq->hash_ctx_valid = 0;
2991
if (freq->zret != Z_STREAM_END) {
2992
unlink_or_warn(freq->tmpfile.buf);
2993
return -1;
@@ -3030,8 +3028,7 @@ void release_http_object_request(struct http_object_request **freq_p)
3028
curl_slist_free_all(freq->headers);
3029
strbuf_release(&freq->tmpfile);
3030
git_inflate_end(&freq->stream);
3033
- if (freq->hash_ctx_valid)
3034
- git_hash_discard(&freq->c);
3031
+ git_hash_discard(&freq->c);
3032
3033
free(freq);
3034
*freq_p = NULL;
http.h
-1
@@ -255,7 +255,6 @@ struct http_object_request {
255
struct object_id oid;
256
struct object_id real_oid;
257
struct git_hash_ctx c;
258
- int hash_ctx_valid;
258
git_zstream stream;
259
int zret;
260
int rename;