Download raw body.
fix ref parsing for sha256
This is another place where we shouldn't hardcode the
SH1_DIGEST_LENGTH_STRING. ok?
diff /home/op/w/got
commit - 020f73dba5df9e319726af7526dbb3b478d52b76
path + /home/op/w/got
blob - 070b80df0cce4e90b81489df1c9f71ce5c1c3cc7
file + lib/reference.c
--- lib/reference.c
+++ lib/reference.c
@@ -298,8 +298,10 @@ parse_packed_ref_line(struct got_reference **ref, cons
{
struct got_object_id id;
const char *name;
+ size_t idlen;
*ref = NULL;
+ idlen = got_hash_digest_string_length(algo);
if (line[0] == '#' || line[0] == '^')
return NULL;
@@ -308,11 +310,11 @@ parse_packed_ref_line(struct got_reference **ref, cons
return got_error(GOT_ERR_BAD_REF_DATA);
if (abs_refname) {
- if (strcmp(line + SHA1_DIGEST_STRING_LENGTH, abs_refname) != 0)
+ if (strcmp(line + idlen, abs_refname) != 0)
return NULL;
name = abs_refname;
} else
- name = line + SHA1_DIGEST_STRING_LENGTH;
+ name = line + idlen;
return alloc_ref(ref, name, &id, GOT_REF_IS_PACKED, mtime);
}
fix ref parsing for sha256