Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/git/mem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added src/not-so-smart/.smart_git.ml.swp
Binary file not shown.
1 change: 1 addition & 0 deletions src/not-so-smart/protocol.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
31 changes: 18 additions & 13 deletions src/not-so-smart/smart_git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down