commit 5cf598c49a15d941d4a6f3b46fb5d81143ea998e from: Omar Polo date: Sat Feb 04 14:00:31 2023 UTC parse_ref_line: parse sha256 hashes commit - 9c0abf71962d4574550913e6785e7e7fdf9948b6 commit + 5cf598c49a15d941d4a6f3b46fb5d81143ea998e blob - b2335b7991e5216b74c9a6a5d47ff2c83463b3da blob + 18b2c86e5670cb8b98edf08dc4c01129e820d7d5 --- lib/reference.c +++ lib/reference.c @@ -157,12 +157,18 @@ parse_ref_line(struct got_reference **ref, const char { struct got_object_id id; + memset(&id, 0, sizeof(id)); + if (strncmp(line, "ref: ", 5) == 0) { line += 5; return parse_symref(ref, name, line); } - if (!got_parse_sha1_digest(id.hash, line)) + if (got_parse_sha256_digest(id.hash, line)) + id.algo = GOT_HASH_SHA256; + else if (got_parse_sha1_digest(id.hash, line)) + id.algo = GOT_HASH_SHA1; + else return got_error(GOT_ERR_BAD_REF_DATA); return alloc_ref(ref, name, &id, 0, mtime);