bundle: detect hash algorithm when reading refs

Much like with the dumb HTTP transport, there isn't a way to explicitly
specify the hash algorithm when dealing with a bundle, so detect the
algorithm based on the length of the object IDs in the prerequisites and
ref advertisements.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2020-06-19 17:56:00 +00:00
committed by Junio C Hamano
parent 371c4079f4
commit 6161ce7bbe
3 changed files with 30 additions and 3 deletions

View File

@ -15,6 +15,7 @@ struct ref_list {
struct bundle_header {
struct ref_list prerequisites;
struct ref_list references;
const struct git_hash_algo *hash_algo;
};
int is_bundle(const char *path, int quiet);