diff --git a/otherlibs/stdune/src/path.ml b/otherlibs/stdune/src/path.ml index fc0bf432045..8a983b76b07 100644 --- a/otherlibs/stdune/src/path.ml +++ b/otherlibs/stdune/src/path.ml @@ -570,6 +570,7 @@ let is_descendant t ~of_ = match t, of_ with | In_source_tree t, In_source_tree of_ -> Source0.is_descendant t ~of_ | In_build_dir t, In_build_dir of_ -> Build.is_descendant t ~of_ + | External t, External of_ -> External.is_descendant t ~of_ | _ -> false ;; diff --git a/otherlibs/stdune/src/path_external.ml b/otherlibs/stdune/src/path_external.ml index d97509a15e6..97e75848dd4 100644 --- a/otherlibs/stdune/src/path_external.ml +++ b/otherlibs/stdune/src/path_external.ml @@ -75,7 +75,7 @@ include ( let to_string_maybe_quoted t = String.maybe_quoted (to_string t) let is_descendant b ~of_:a = - is_root a || String.starts_with ~prefix:(to_string a ^ "/") (to_string b) + is_root a || equal a b || String.starts_with ~prefix:(to_string a ^ "/") (to_string b) ;; module Map = String.Map diff --git a/otherlibs/stdune/test/path_tests.ml b/otherlibs/stdune/test/path_tests.ml index 8352cfd6713..018cc99686c 100644 --- a/otherlibs/stdune/test/path_tests.ml +++ b/otherlibs/stdune/test/path_tests.ml @@ -129,18 +129,12 @@ true let%expect_test _ = is_descendant (e "/foo/bar") ~of_:(e "/foo"); - [%expect - {| -false -|}] + [%expect {| true |}] ;; let%expect_test _ = is_descendant (e "/foo/bar") ~of_:(e "/foo/bar"); - [%expect - {| -false -|}] + [%expect {| true |}] ;; let%expect_test _ = @@ -153,18 +147,12 @@ false let%expect_test _ = is_descendant (e "/foo/bar/") ~of_:(e "/foo/bar"); - [%expect - {| -false -|}] + [%expect {| true |}] ;; let%expect_test _ = is_descendant (e "/foo/bar") ~of_:(e "/"); - [%expect - {| -false -|}] + [%expect {| true |}] ;; let%expect_test _ =