attempt to serialize git commit (does not compile)

This commit is contained in:
Hannes Mehnert 2022-09-07 10:33:21 +02:00
parent 99dcf500c1
commit b6218b979b

View file

@ -22,6 +22,8 @@ module Make
let compare = compare (* TODO remove polymorphic compare *) let compare = compare (* TODO remove polymorphic compare *)
end) end)
module Git_commit = Git.Commit.Make(Store.Git.Hash)
let hash_to_string = function let hash_to_string = function
| `MD5 -> "md5" | `MD5 -> "md5"
| `SHA1 -> "sha1" | `SHA1 -> "sha1"
@ -495,7 +497,9 @@ stamp: %S
Logs.err (fun m -> m "error %s while updating git" msg); Logs.err (fun m -> m "error %s while updating git" msg);
Lwt.return None Lwt.return None
| Ok (commit, msg) -> | Ok (commit, msg) ->
Logs.info (fun m -> m "git: %s" msg); let l = Encore.to_lavoisier Git_commit.format in
let bytes = Encore.Lavoisier.emit_string commit l in
Logs.info (fun m -> m "git: %s (%d bytes)" msg (String.length bytes));
let commit_id = commit_id commit let commit_id = commit_id commit
and modified = modified commit and modified = modified commit
in in
@ -686,7 +690,10 @@ stamp: %S
Git.pull store upstream >>= function Git.pull store upstream >>= function
| Error `Msg msg -> Lwt.fail_with msg | Error `Msg msg -> Lwt.fail_with msg
| Ok (commit, msg) -> | Ok (commit, msg) ->
Logs.info (fun m -> m "git: %s" msg); (* let l = Encore.to_lavoisier Git_commit.format in
let bytes = Encore.Lavoisier.emit_string commit l in *)
let bytes = "foo" in
Logs.info (fun m -> m "git: %s (%d bytes)" msg (String.length bytes));
Serve.create commit store >>= fun serve -> Serve.create commit store >>= fun serve ->
Paf.init ~port:(Key_gen.port ()) (Stack.tcp stack) >>= fun t -> Paf.init ~port:(Key_gen.port ()) (Stack.tcp stack) >>= fun t ->
let update store = download_archives disk http_ctx store in let update store = download_archives disk http_ctx store in