Commit Diff


commit - 8b31a0aefbf1931c90d3c61209474865e0695308
commit + d6720956975e97012cad5147fc6fa9b599a72b1b
blob - d3b6994a05d5085b0c9f884e065b83e780ee138a
blob + 92c6f66d7d519ba568fc92f2cfcd067988da49b6
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
@@ -24,6 +24,7 @@ struct got_pack_privsep_child {
 struct got_pack {
 	char *path_packfile;
 	int fd;
+	enum got_hash_algorithm algo;
 	uint8_t *map;
 	off_t filesize;
 	struct got_pack_privsep_child *privsep_child;
blob - 09e7cb7ce6e9cf826f667d69280ad2dab4b4d161
blob + 7f43e610d9a73ffd8cdb88bf5a0a79062d2de48b
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
@@ -514,6 +514,7 @@ struct got_imsg_packidx {
 struct got_imsg_pack {
 	char path_packfile[PATH_MAX];
 	off_t filesize;
+	int algo;
 	/* Additionally, a file desciptor is passed via imsg. */
 } __attribute__((__packed__));
 
blob - 50de5ee871e1bce4796e0df633d7d317326f4669
blob + 329973acb13ee4e4327e1d7e515e0d23543cb25d
--- lib/privsep.c
+++ lib/privsep.c
@@ -1950,6 +1950,7 @@ got_privsep_init_pack_child(struct imsgbuf *ibuf, stru
 	    sizeof(ipack.path_packfile)) >= sizeof(ipack.path_packfile))
 		return got_error(GOT_ERR_NO_SPACE);
 	ipack.filesize = pack->filesize;
+	ipack.algo = pack->algo;
 
 	fd = dup(pack->fd);
 	if (fd == -1)
blob - 16e3d306e6c4520d50d972c00ad7ccd52541d09f
blob + 99a99106cf364e5149e36643733a0b3a5b3a51ff
--- lib/repository.c
+++ lib/repository.c
@@ -1501,6 +1501,7 @@ got_repo_cache_pack(struct got_pack **packp, struct go
 		goto done;
 	}
 	pack->filesize = sb.st_size;
+	pack->algo = got_repo_get_object_format(repo);
 
 	pack->privsep_child = NULL;
 
blob - 06caa68133ea0151e72d46cf3e44f50b61304883
blob + 4d84586f4f4ba3c3c0eb7902c012ca9549cd5424
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -142,7 +142,7 @@ open_commit(struct got_commit_object **commit, struct 
 
 	obj->size = len;
 
-	err = got_object_parse_commit(commit, buf, len, GOT_HASH_SHA1);
+	err = got_object_parse_commit(commit, buf, len, pack->algo);
 done:
 	got_object_close(obj);
 	free(buf);
@@ -1859,6 +1859,7 @@ receive_pack(struct got_pack **packp, struct imsgbuf *
 	}
 	memcpy(&ipack, imsg.data, sizeof(ipack));
 
+	pack->algo = ipack.algo;
 	pack->filesize = ipack.filesize;
 	pack->fd = dup(imsg.fd);
 	if (pack->fd == -1) {