Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### Unreleased

#### Yocaml_git

- A more robust metric for `is_file` and `is_directory` in Git context (by [dinosaure](https://github.com/dinosaure))

#### Yocaml_liquid

- ⁠First release - Add support for Shopify Liquid templating language (by [Dev-JoyA](https://github.com/Dev-JoyA))
Expand Down
18 changes: 10 additions & 8 deletions plugins/yocaml_git/runtime.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ struct
match on with
| `Source -> Source.lift @@ Source.is_directory ~on path
| `Target ->
let open Lwt.Syntax in
let+ k = Store.exists store (to_kv_path path) in
Ok (k = Ok (Some `Dictionary))
|> Result.fold ~ok:Fun.id ~error:(Fun.const false)
let open Lwt.Infix in
Store.exists store (to_kv_path path)
>|= Result.fold
~ok:(function Some `Dictionary -> true | _ -> false)
~error:(Fun.const false)

let is_file ~on path =
match on with
| `Source -> Source.lift @@ Source.is_file ~on path
| `Target ->
let open Lwt.Syntax in
let+ k = Store.exists store (to_kv_path path) in
Ok (k = Ok (Some `Value))
|> Result.fold ~ok:Fun.id ~error:(Fun.const false)
let open Lwt.Infix in
Store.exists store (to_kv_path path)
>|= Result.fold
~ok:(function Some `Value -> true | _ -> false)
~error:(Fun.const false)

let exec ?is_success prog args =
lift_result @@ Source.exec ?is_success prog args
Expand Down