From e45e5046ba5b2cce5207a68a4378ee42c825f61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Fri, 26 Sep 2025 20:10:04 +0200 Subject: [PATCH] Prevent unnecessary submodule fetches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bence Szépkúti --- scripts/abi_check.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/abi_check.py b/scripts/abi_check.py index 67a96564c5..02fcde4ebb 100755 --- a/scripts/abi_check.py +++ b/scripts/abi_check.py @@ -204,11 +204,24 @@ class AbiChecker: stderr=subprocess.STDOUT ) self.log.debug(submodule_output.decode("utf-8")) - update_output = subprocess.check_output( - [self.git_command, "submodule", "update", "--init", '--recursive'], - cwd=git_worktree_path, - stderr=subprocess.STDOUT - ) + + try: + # Try to update the submodules using local commits + # (Git will sometimes insist on fetching the remote without --no-fetch if the submodules are shallow clones) + update_output = subprocess.check_output( + [self.git_command, "submodule", "update", "--init", '--recursive', '--no-fetch'], + cwd=git_worktree_path, + stderr=subprocess.STDOUT + ) + except subprocess.CalledProcessError as err: + self.log.debug(err.stdout.decode("utf-8")) + + # Checkout with --no-fetch failed, falling back to fetching from origin + update_output = subprocess.check_output( + [self.git_command, "submodule", "update", "--init", '--recursive'], + cwd=git_worktree_path, + stderr=subprocess.STDOUT + ) self.log.debug(update_output.decode("utf-8")) if not (os.path.exists(os.path.join(git_worktree_path, "crypto")) and version.crypto_revision):