diff --git a/src/git/mem.ml b/src/git/mem.ml index f4ccea40f..e4a4d1981 100644 --- a/src/git/mem.ml +++ b/src/git/mem.ml @@ -496,8 +496,11 @@ struct fetch ~push_stdout ~push_stderr ~resolvers edn store ?version ?capabilities ?deepen want ~src ~dst ~idx:index t_pck t_idx >>? function - | `Empty -> Lwt.return_ok None + | `Empty -> + Log.debug (fun m -> m "Got an empty PACK file."); + Lwt.return_ok None | `Pack (hash, refs) -> + Log.debug (fun m -> m "Got a PACK file: %a." Git_store.Hash.pp hash); let index = Carton.Dec.Idx.Device.project t_idx index in let pack = Cstruct_append.project t_pck dst in diff --git a/src/not-so-smart/.smart_git.ml.swp b/src/not-so-smart/.smart_git.ml.swp new file mode 100644 index 000000000..8a3d9e880 Binary files /dev/null and b/src/not-so-smart/.smart_git.ml.swp differ diff --git a/src/not-so-smart/protocol.ml b/src/not-so-smart/protocol.ml index 5c939c87b..345378967 100644 --- a/src/not-so-smart/protocol.ml +++ b/src/not-so-smart/protocol.ml @@ -435,6 +435,7 @@ module Decoder = struct else decode_first_ref ~version v decoder | None -> (* XXX(dinosaure): see [empty_clone]. *) + junk_pkt decoder; return { Advertised_refs.shallows = []; diff --git a/src/not-so-smart/smart_git.ml b/src/not-so-smart/smart_git.ml index dd3523f71..29dcf0d01 100644 --- a/src/not-so-smart/smart_git.ml +++ b/src/not-so-smart/smart_git.ml @@ -332,20 +332,25 @@ struct let fetch_v1 ?prelude ~push_stdout ~push_stderr ~capabilities path ~resolvers ?deepen ?want endpoint store access fetch_cfg pack = let open Lwt.Infix in - Conduit.resolve resolvers endpoint >>? fun flow -> - Lwt.try_bind - (fun () -> - Fetch.fetch_v1 ?prelude ~push_stdout ~push_stderr ~capabilities ?deepen - ?want ~host:endpoint path flow store access fetch_cfg - (fun (payload, off, len) -> - let v = String.sub payload off len in - pack (Some (v, 0, len)))) - (fun refs -> - pack None; - Conduit.close flow >>? fun () -> Lwt.return_ok refs) - (fun exn -> + Log.debug (fun m -> m "Try to resolve %a." Conduit.Endpoint.pp endpoint); + Conduit.resolve resolvers endpoint >>= function + | Error _ as err -> pack None; - Conduit.close flow >>= fun _ -> Lwt.fail exn) + Lwt.return err + | Ok flow -> + Lwt.try_bind + (fun () -> + Fetch.fetch_v1 ?prelude ~push_stdout ~push_stderr ~capabilities + ?deepen ?want ~host:endpoint path flow store access fetch_cfg + (fun (payload, off, len) -> + let v = String.sub payload off len in + pack (Some (v, 0, len)))) + (fun refs -> + pack None; + Conduit.close flow >>? fun () -> Lwt.return_ok refs) + (fun exn -> + pack None; + Conduit.close flow >>= fun _ -> Lwt.fail exn) module Flow_http = struct type +'a fiber = 'a Lwt.t