diff --git a/master_changes.md b/master_changes.md index e9d9f2ab7aa..7dcc5bb41b5 100644 --- a/master_changes.md +++ b/master_changes.md @@ -86,6 +86,7 @@ users) ## Sandbox ## VCS + * Fail when git submodule fails to update instead of showing a warning and ignoring the error [#6132 @kit-ty-kate - fix #6131] ## Build * Synchronise opam-core.opam with opam-repository changes [#6043 @dra27] diff --git a/src/repository/opamGit.ml b/src/repository/opamGit.ml index 49980641c77..1b2f4c565df 100644 --- a/src/repository/opamGit.ml +++ b/src/repository/opamGit.ml @@ -179,9 +179,7 @@ module VCS : OpamVCS.VCS = struct if OpamFilename.exists (repo_root // ".gitmodules") then git repo_root [ "submodule"; "update"; "--init"; "--recursive" ] @@> fun r -> - if OpamProcess.is_failure r then - OpamConsole.warning "Git submodule update failed in %s" - (OpamFilename.Dir.to_string repo_root); + OpamSystem.raise_on_process_error r; Done () else Done () diff --git a/tests/reftests/git.test b/tests/reftests/git.test index ca50d5a0f2c..af61d7b0f80 100644 --- a/tests/reftests/git.test +++ b/tests/reftests/git.test @@ -59,22 +59,17 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 1/3: [submodule.1: git] -[WARNING] Git submodule update failed in ${BASEDIR}/OPAM/submodule/.opam-switch/sources/submodule.1 --> retrieved submodule.1 (git+file://${BASEDIR}/use-submodule) -Processing 2/3: [submodule: ls] -+ ${BASEDIR}/OPAM/opam-init/hooks/sandbox.sh "build" "ls" "vendor/some-file" (CWD=${BASEDIR}/OPAM/submodule/.opam-switch/build/submodule.1) -- ls: cannot access 'vendor/some-file': No such file or directory -[ERROR] The compilation of submodule.1 failed at "ls vendor/some-file". - -##% output ### -# ls: cannot access 'vendor/some-file': No such file or directory +[ERROR] Could not synchronize ${BASEDIR}/OPAM/submodule/.opam-switch/sources/submodule.1 from "git+file://${BASEDIR}/use-submodule": + "/usr/bin/git submodule update --init --recursive" exited with code 1 +[ERROR] Failed to get sources of submodule.1: git+file://${BASEDIR}/use-submodule +OpamSolution.Fetch_fail("git+file://${BASEDIR}/use-submodule") <><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +- The following actions failed -| - build submodule 1 +| - fetch submodule 1 +- - No changes have been performed '${OPAM} install --verbose submodule' failed. -# Return code 31 # +# Return code 40 #