From 3fc17eec135ab67a514c1cbb02182f7bccf6d042 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 13 Dec 2024 19:27:55 +0000 Subject: [PATCH] fix: regression in 11200 (#11204) Remove all error checking for empty projects in [$ dune subst] Signed-off-by: Rudi Grinberg --- bin/subst.ml | 4 ++++ doc/changes/11204.md | 2 ++ test/blackbox-tests/test-cases/github11200.t | 5 ----- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 doc/changes/11204.md diff --git a/bin/subst.ml b/bin/subst.ml index c4d61c63f15..9b8ed04bfda 100644 --- a/bin/subst.ml +++ b/bin/subst.ml @@ -332,6 +332,10 @@ let subst vcs = |> Memo.return) in Some (None, None, Path.Source.Set.to_list files)) + >>| Option.bind ~f:(fun ((_, _, files) as s) -> + match files with + | [] -> None + | _ :: _ -> Some s) >>= Memo.Option.iter ~f:(fun (version, commit, files) -> let+ (dune_project : Dune_project.t) = (* CR-soon rgrinberg: unify this check with the above version check *) diff --git a/doc/changes/11204.md b/doc/changes/11204.md new file mode 100644 index 00000000000..8c4fce1771f --- /dev/null +++ b/doc/changes/11204.md @@ -0,0 +1,2 @@ +- Remove useless error message when running `$ dune subst` in empty projects. + (@rgrinberg, #11204, fixes #11200) diff --git a/test/blackbox-tests/test-cases/github11200.t b/test/blackbox-tests/test-cases/github11200.t index 11648a1d314..27944c6daff 100644 --- a/test/blackbox-tests/test-cases/github11200.t +++ b/test/blackbox-tests/test-cases/github11200.t @@ -2,8 +2,3 @@ Running `dune subst` should succeed in an empty directory. Regression test for https://github.com/ocaml/dune/issues/11200 $ dune subst - File ".", line 1, characters 0-0: - Error: There is no dune-project file in the current directory, please add one - with a (name ) field in it. - Hint: 'dune subst' must be executed from the root of the project. - [1]