Skip to content

Commit 54ecec1

Browse files
authored
Merge pull request #107 from xhtmlboi/yocaml-git-remove-polymorphic-equal
Remove Polymorphic comparison in Yocaml_git
2 parents 8c750b1 + dea930f commit 54ecec1

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Unreleased
22

3+
#### Yocaml_git
4+
5+
- A more robust metric for `is_file` and `is_directory` in Git context (by [dinosaure](https://github.com/dinosaure))
6+
37
#### Yocaml_liquid
48

59
- ⁠First release - Add support for Shopify Liquid templating language (by [Dev-JoyA](https://github.com/Dev-JoyA))

plugins/yocaml_git/runtime.ml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,21 @@ struct
104104
match on with
105105
| `Source -> Source.lift @@ Source.is_directory ~on path
106106
| `Target ->
107-
let open Lwt.Syntax in
108-
let+ k = Store.exists store (to_kv_path path) in
109-
Ok (k = Ok (Some `Dictionary))
110-
|> Result.fold ~ok:Fun.id ~error:(Fun.const false)
107+
let open Lwt.Infix in
108+
Store.exists store (to_kv_path path)
109+
>|= Result.fold
110+
~ok:(function Some `Dictionary -> true | _ -> false)
111+
~error:(Fun.const false)
111112

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

121123
let exec ?is_success prog args =
122124
lift_result @@ Source.exec ?is_success prog args

0 commit comments

Comments
 (0)