do not hardcode GOT_HASH_SHA1; use the current repo object format

fix tog run_test

got-build-regress: run the regress in sha256 mode too

skip sha256 tests if not told otherwise in tog too

enable some tests in sha256 mode

bump hash size and add an algo field to got_object_id

rename "sha1" field to "hash" done with X ,x/\.sha1/c/.hash X ,x/->sha1/c/->hash in sam after loading all the C files; except for one manual tweak in hash.c

handle repository format version 1 and objectformat extensions

swap trim_obj_id behaviour trim_obj_ids is a bit weird in that you have to specify how many characters to drop *from the end* instead of how many to keep from the beginning. This comes in the way of enabling some parts of the regress for sha256 since object IDs are longer, and a `trim_obj_id 38` will not yield 2 characters, but 26! Instead, use the numeric argument to mean the number of characters to keep from the beginning. Then `trim_obj_id 2` will always return the first two characters, regardless of the length of the hash. ok stsp@

sha256 packs support Change how we read the packidx trailer so that we can handle sha256 packs too. ok stsp@

prepare got_object_parse_tree for sha256 Since got_object_parse_tree_entry is a function that has to be as fast as possible, the idea to handle both types of hashes is to keep track of the hashing algorithm used and the length of the digest, and then eventually adding a "gap" when sending in privsep.c so that the receiving side can always read a fixed-size buffer. This is to avoid doing memcpy() which can be costly in the hot path. ok stsp@

do not hardcode SHA1 digest length

add got_hash_digest_to_str it allows to abstract over the underlying algorithm.

opaquify sorted_ids ok and improvements from tobhe@

fix grouping in commit traversal We try to group as many items as possible, but we have to make sure to not overflow max_datalen otherwise imsg will fail with ERANGE. ok stsp@

backout 4f73a04b63 "Remove unnecessary sched_yield(2)" this made tog regress hang in an infinite loop, reported by naddy. Remove unnecessary sched_yield(2). Re-applies commit 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491 which was reverted in commit 82954512f323c8a2d4f89d51be1e6b0f707b6c3a because at the time the change broke the 'search' feature. Quick testing suggests search is now working fine, so let's try again.

do not hardcode digest length (cont)

bubble up the hash algorithm

don't hardcode digest length when parsing packed trees ok stsp@

add a comment to remind us to switch back to malloc() while here also fix the function name in the error message, spotted by stsp.

zap double #include <limits.h>; spotted by Thomas Adam

adjust GOT_PACKIDX_NAMELEN for sha256 pack files ok stsp@

fix ref parsing for sha256 ok stsp@

add an algo field to struct got_packidx ok tobhe@, stsp@

add an algo field to struct got_pack Future work on sha256 will need the current hashing algorithm at hand. ok tobhe@, stsp@