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: 5 additions & 0 deletions src/not-so-smart/default.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
(** default[1] negotiator implementation

[1] "default" as defined in the canonical git implementation in C,
see https://github.com/git/git/tree/master/negotiator *)

open Sigs

type ('k, 'p, 't) psq =
Expand Down
8 changes: 4 additions & 4 deletions src/not-so-smart/fetch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ struct
in
List.fold_left fold [] have |> List.split

let fetch_v1 ?(prelude = true) ?(push_stdout = ignore) ?(push_stderr = ignore)
~capabilities ?deepen ?want:(refs = `None) ~host path flow store access
fetch_cfg pack =
let fetch_v1 ?(uses_git_transport = false) ?(push_stdout = ignore)
?(push_stderr = ignore) ~capabilities ?deepen ?want:(refs = `None) ~host
path flow store access fetch_cfg pack =
let capabilities =
(* XXX(dinosaure): HTTP ([stateless]) enforces no-done capabilities. Otherwise, you never
will receive the PACK file. *)
Expand All @@ -82,7 +82,7 @@ struct
let prelude ctx =
let open Smart in
let* () =
if prelude then
if uses_git_transport then
send ctx proto_request
(Proto_request.upload_pack ~host ~version:1 path)
else return ()
Expand Down
2 changes: 1 addition & 1 deletion src/not-so-smart/fetch.mli
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Make
(Uid : UID)
(Ref : REF) : sig
val fetch_v1 :
?prelude:bool ->
?uses_git_transport:bool ->
?push_stdout:(string -> unit) ->
?push_stderr:(string -> unit) ->
capabilities:Smart.Capability.t list ->
Expand Down
25 changes: 13 additions & 12 deletions src/not-so-smart/smart_git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ struct
module Fetch = Nss.Fetch.Make (Scheduler) (Lwt) (Flow) (Uid) (Ref)
module Push = Nss.Push.Make (Scheduler) (Lwt) (Flow) (Uid) (Ref)

let fetch_v1 ?prelude ~push_stdout ~push_stderr ~capabilities path ~resolvers
?deepen ?want endpoint store access fetch_cfg pack =
let fetch_v1 ?uses_git_transport ~push_stdout ~push_stderr ~capabilities path
~resolvers ?deepen ?want endpoint store access fetch_cfg pack =
let open Lwt.Infix in
Log.debug (fun m -> m "Try to resolve %a." Conduit.Endpoint.pp endpoint);
Conduit.resolve resolvers endpoint >>= function
Expand All @@ -340,9 +340,9 @@ struct
| 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) ->
Fetch.fetch_v1 ?uses_git_transport ~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 ->
Expand Down Expand Up @@ -411,8 +411,8 @@ struct
headers;
}
in
Fetch_http.fetch_v1 ~prelude:false ~push_stdout ~push_stderr ~capabilities
?deepen ?want ~host:endpoint path flow store access fetch_cfg
Fetch_http.fetch_v1 ~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)))
Expand Down Expand Up @@ -448,13 +448,14 @@ struct
match version, edn.scheme with
| `V1, ((`Git | `SSH _) as scheme) ->
let fetch_cfg = Nss.Fetch.configuration capabilities in
let prelude = match scheme with `Git -> true | `SSH _ -> false in
(* XXX(dinosaure): [prelude] is the only tweak needed between git:// and SSH. *)
let uses_git_transport =
match scheme with `Git -> true | `SSH _ -> false
in
let run () =
Lwt.both
(fetch_v1 ~push_stdout ~push_stderr ~prelude ~capabilities path
~resolvers ?deepen ~want endpoint store access fetch_cfg
pusher)
(fetch_v1 ~push_stdout ~push_stderr ~uses_git_transport
~capabilities path ~resolvers ?deepen ~want endpoint store
access fetch_cfg pusher)
(run ~light_load ~heavy_load stream t_pck t_idx ~src ~dst ~idx)
>>= fun (refs, idx) ->
match refs, idx with
Expand Down