Skip to content

Commit

Permalink
Update to git-kv.0.1.2 and workaround git-kv bug
Browse files Browse the repository at this point in the history
Git-kv 0.1.1 has a bug in its last_modified implementation, and the
current semantics has an odd interaction with change_and_push that we
need to work around.
  • Loading branch information
reynir committed Jan 14, 2025
1 parent 1fbb78d commit 3f8544c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
(lwt (>= 5.7.0))
(mimic (>= 0.0.9))
(cstruct (>= 6.2.0))
(git-kv (>= 0.0.5))
(git-kv (>= 0.1.2))
(git-unix (>= 3.16.1))
(mirage-clock (>= 4.2.0))
(yocaml (= :version))
Expand Down
13 changes: 13 additions & 0 deletions plugins/yocaml_git/yocaml_git.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ let run (module Source : Required.SOURCE) (module Clock : Mirage_clock.PCLOCK)
let* context = match context with `SSH -> Ssh.context () in
let* store = Git_kv.connect context remote in
let module Store = Git_kv.Make (Clock) in
let module Store = struct
include Store
(* last_modified and change_and_push have a weird interaction;
so we show the old last_modified *)
let last_modified new_store key =
let* r = last_modified store key in
match r with
| Error `Not_found _ ->
last_modified new_store key
| _ ->
Lwt.return r
end
in
Store.change_and_push ?author ?author_email:email ?message store (fun store ->
let module Config = struct
let store = store
Expand Down
2 changes: 1 addition & 1 deletion yocaml_git.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ depends: [
"lwt" {>= "5.7.0"}
"mimic" {>= "0.0.9"}
"cstruct" {>= "6.2.0"}
"git-kv" {>= "0.0.5"}
"git-kv" {>= "0.1.2"}
"git-unix" {>= "3.16.1"}
"mirage-clock" {>= "4.2.0"}
"yocaml" {= version}
Expand Down

0 comments on commit 3f8544c

Please sign in to comment.