Skip to content

Commit

Permalink
Merge pull request #149 from BenWibking/update-submodules
Browse files Browse the repository at this point in the history
update submodules when doing git fetch
  • Loading branch information
zingale authored Jan 9, 2025
2 parents d1e0aef + eebd3e3 commit 6e28c54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def git_update(self):

shutil.copy(f"git.{self.name}.out", self.suite.full_web_dir)

if self.suite.updateGitSubmodules == 1:
# update submodules to those specified by the current commit
# (--init is required because there may be new submodules since the last checkout)
self.suite.log.log(f"git submodule update in {self.dir}")
_, _, rc = test_util.run(f"git submodule update --init")

if rc != 0:
self.suite.log.fail("ERROR: git submodule update was unsuccessful")

def save_head(self):
"""Save the current head of the repo"""

Expand Down
4 changes: 3 additions & 1 deletion suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def __init__(self, args):
self.useCmake = 0
self.isSuperbuild = 0
self.use_ctools = 1

self.reportCoverage = args.with_coverage

# set automatically
Expand All @@ -435,6 +435,8 @@ def __init__(self, args):
self.amrex_install_dir = "" # Cmake installation dir
self.amrex_cmake_opts = ""

self.updateGitSubmodules = 0

self.MPIcommand = ""
self.MPIhost = ""

Expand Down
3 changes: 3 additions & 0 deletions test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
isSuperbuild = < 0: pre-build AMReX and source (default)
1: CMake downloads AMReX and needs separate configure & build >
updateGitSubmodules = < 0: don't update submodules when changing git branches (default)
1: run `git submodule update --init` after changing git branches >
sourceTree = < C_Src or AMReX >
suiteName = < descriptive name (i.e. Castro) >
Expand Down

0 comments on commit 6e28c54

Please sign in to comment.