]> git.ipfire.org Git - thirdparty/git.git/commitdiff
http: replace hard-coded constant with the_hash_algo
authorbrian m. carlson <sandals@crustytoothpaste.net>
Tue, 19 Feb 2019 00:05:13 +0000 (00:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2019 02:57:38 +0000 (11:57 +0900)
Replace a hard-coded 40 with a reference to the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c

diff --git a/http.c b/http.c
index a09adc518f2f663ee4467196fceced300cd33814..993ddc956a574f1df53896eae65675c2dd87fc87 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2065,7 +2065,7 @@ int http_fetch_ref(const char *base, struct ref *ref)
        url = quote_ref_url(base, ref->name);
        if (http_get_strbuf(url, &buffer, &options) == HTTP_OK) {
                strbuf_rtrim(&buffer);
-               if (buffer.len == 40)
+               if (buffer.len == the_hash_algo->hexsz)
                        ret = get_oid_hex(buffer.buf, &ref->old_oid);
                else if (starts_with(buffer.buf, "ref: ")) {
                        ref->symref = xstrdup(buffer.buf + 5);