When switching combinations or checking out pins the submodule
information may change or have modifications that will cause errors.
Before changing to a new combination all submodules should be removed.

Cc: Ashley E Desimone <ashley.e.desim...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Puja Pandya <puja.pan...@intel.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Cc: Prince Agyeman <prince.agye...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Signed-off-by: Erik Bjorge <erik.c.bjo...@intel.com>
---
 edkrepo/commands/checkout_pin_command.py |  5 ++---
 edkrepo/common/common_repo_functions.py  | 11 ++++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py 
b/edkrepo/commands/checkout_pin_command.py
index 9d7346a..39c5aeb 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -22,7 +22,7 @@ from 
edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import 
find_source_manifest_repo
 from edkrepo.config.config_factory import get_workspace_path, 
get_workspace_manifest
 from edkrepo_manifest_parser.edk_manifest import ManifestXml
-from project_utils.submodule import deinit_submodules, maintain_submodules
+from project_utils.submodule import deinit_full, maintain_submodules
 
 
 class CheckoutPinCommand(EdkrepoCommand):
@@ -71,8 +71,7 @@ class CheckoutPinCommand(EdkrepoCommand):
             print(SPARSE_RESET)
             reset_sparse_checkout(workspace_path, manifest_sources)
         submodule_combo = pin.general_config.current_combo
-        deinit_submodules(workspace_path, manifest, 
manifest.general_config.current_combo,
-                          pin, submodule_combo, args.verbose)
+        deinit_full(workspace_path, manifest, args.verbose)
         pin_repo_sources = 
pin.get_repo_sources(pin.general_config.current_combo)
         try:
             checkout_repos(args.verbose, args.override, pin_repo_sources, 
workspace_path, manifest)
diff --git a/edkrepo/common/common_repo_functions.py 
b/edkrepo/common/common_repo_functions.py
index 8c79f3d..59c198f 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -68,7 +68,7 @@ from edkrepo_manifest_parser.edk_manifest_validation import 
validate_manifestrep
 from edkrepo_manifest_parser.edk_manifest_validation import 
get_manifest_validation_status
 from edkrepo_manifest_parser.edk_manifest_validation import 
print_manifest_errors
 from edkrepo_manifest_parser.edk_manifest_validation import 
validate_manifestfiles
-from project_utils.submodule import deinit_submodules, maintain_submodules
+from project_utils.submodule import deinit_full, maintain_submodules
 
 CLEAR_LINE = '\x1b[K'
 DEFAULT_REMOTE_NAME = 'origin'
@@ -498,10 +498,6 @@ def checkout(combination_or_sha, verbose=False, 
override=False, log=None):
         log=log)
     initial_repo_sources = 
manifest.get_repo_sources(manifest.general_config.current_combo)
 
-    # Deinit any submodules that have been removed.
-    deinit_submodules(workspace_path, manifest, 
manifest.general_config.current_combo,
-                      manifest, submodule_combo, verbose)
-
     # Disable sparse checkout
     current_repos = initial_repo_sources
     sparse_enabled = sparse_checkout_enabled(workspace_path, 
initial_repo_sources)
@@ -524,6 +520,11 @@ def checkout(combination_or_sha, verbose=False, 
override=False, log=None):
         print(SPARSE_RESET)
         reset_sparse_checkout(workspace_path, current_repos)
 
+    # Deinit all submodules due to the potential for issues when switching
+    # branches.
+    if combo_or_sha != manifest.general_config.current_combo:
+        deinit_full(workspace_path, manifest, verbose)
+
     print(CHECKING_OUT_COMBO.format(combo_or_sha))
 
     try:
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61101): https://edk2.groups.io/g/devel/message/61101
Mute This Topic: https://groups.io/mt/74807390/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to