diff --git a/lib/analyse.ml b/lib/analyse.ml index 7eaa9b56..791fc1a3 100644 --- a/lib/analyse.ml +++ b/lib/analyse.ml @@ -195,8 +195,6 @@ module Analysis = struct | Error _ as err -> Lwt.return err | Ok pkgs -> match String.split_on_char '/' path with - | [_] | ".github"::_ -> - Lwt_result.return pkgs | "packages" :: name :: package :: "files" :: _ -> Lwt_result.return (add_pkg ~path ~name ~package SignificantlyChanged pkgs) | ["packages"; name; package; "opam"] -> @@ -211,8 +209,11 @@ module Analysis = struct get_opam ~cwd:dir path >>= add_changed_pkg ~path ~name ~package ~old_content pkgs end + | "packages" :: _ -> + Fmt.failwith "Unexpected path %S in packages directory (expecting 'packages/name/name.l.m.n/{opam,files/*}')" path | _ -> - Fmt.failwith "Unexpected path %S in output (expecting 'packages/name/pkg/...')" path + (* Changes to any other path should be reviewed manually, since it's a change into repository meta data *) + Lwt_result.return pkgs ) (Ok OpamPackage.Map.empty) let has_tests opam = diff --git a/test/analyse.t b/test/analyse.t index cd8d12a0..4872b8da 100644 --- a/test/analyse.t +++ b/test/analyse.t @@ -111,6 +111,15 @@ See https://github.com/ocurrent/opam-repo-ci/issues/291 $ opam-repo-ci-local --repo="." --branch=analyze-invalid-opam-file --analyse-only --no-web-server Error ""packages/a-1/a-1.0.0.1/opam" failed to be parsed: '.' is not a valid token" -Clean up the build cache + $ rm -rf var - $ rm -rf ./var +Test that a new root directory can be created. +See https://github.com/ocurrent/opam-repo-ci/pull/397 + + $ git checkout -q -b add-a-new-dir initial-state + $ mkdir a-new-directory + $ touch a-new-directory/foo + $ git add a-new-directory/foo + $ git commit -q -m "Add a new directory" + $ opam-repo-ci-local --repo="." --branch=add-a-new-dir --analyse-only --no-web-server + { "packages": [] }