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]