Skip to content

Commit

Permalink
Fail when git submodule fails to update instead of showing a warning …
Browse files Browse the repository at this point in the history
…and ignoring the error
  • Loading branch information
kit-ty-kate committed Aug 13, 2024
1 parent 7087731 commit c459fbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 1 addition & 3 deletions src/repository/opamGit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

Expand Down
17 changes: 6 additions & 11 deletions tests/reftests/git.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #

0 comments on commit c459fbd

Please sign in to comment.