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 16, 2024
1 parent 1d62c4c commit 2a1e199
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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
16 changes: 7 additions & 9 deletions tests/reftests/git.test
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,22 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed submodule.1
Done.
### opam install submodule
### opam install submodule | '".+[/\\]git(\.exe)? ' -> '"git '
The following actions will be performed:
=== install 1 package
- install submodule 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[WARNING] Git submodule update failed in ${BASEDIR}/OPAM/submodule/.opam-switch/sources/submodule.1
-> retrieved submodule.1 (git+file://${BASEDIR}/use-submodule)
[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":
"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
# Return code 31 #
# Return code 40 #

0 comments on commit 2a1e199

Please sign in to comment.