|
28 | 28 | pass |
29 | 29 | import os |
30 | 30 | from shutil import copy2, rmtree |
| 31 | +from subprocess import CalledProcessError |
31 | 32 | from .error import KiPlotConfigurationError |
32 | 33 | from .gs import GS |
33 | 34 | from .kicad.color_theme import load_color_theme |
34 | 35 | from .kiplot import load_any_sch |
35 | 36 | from .layer import Layer |
36 | | -from .misc import W_NOTHCMP |
| 37 | +from .misc import W_NOTHCMP, W_BADGITREPO, try_decode_utf8 |
37 | 38 | from .out_any_diff import AnyDiffOptions, has_repo |
38 | 39 | from .macros import macros, document, output_class # noqa: F401 |
39 | 40 | from . import log |
@@ -297,7 +298,16 @@ def run(self, name): |
297 | 298 | git_tmp_wd = GS.mkdtemp('kiri-checkout') |
298 | 299 | logger.debug('Checking out '+hash+' to '+git_tmp_wd) |
299 | 300 | self.run_git(['worktree', 'add', '--detach', '--force', git_tmp_wd, hash]) |
300 | | - self.run_git(['submodule', 'update', '--init', '--recursive'], cwd=git_tmp_wd) |
| 301 | + try: |
| 302 | + self.run_git(['submodule', 'update', '--init', '--recursive'], cwd=git_tmp_wd, just_raise=True) |
| 303 | + except CalledProcessError as e: |
| 304 | + if b'No url found for submodule' in e.output: |
| 305 | + # Just an uninitialized submodule, report it and continue, see #888 |
| 306 | + logger.warning(W_BADGITREPO+f"Broken git repo: {e}") |
| 307 | + msg = try_decode_utf8(e.output, 'output from command', logger) |
| 308 | + logger.warning(W_BADGITREPO+msg) |
| 309 | + else: |
| 310 | + raise |
301 | 311 | # Generate SVGs for the schematic |
302 | 312 | name_sch = self.do_cache(self.sch_rel_name, git_tmp_wd, hash) |
303 | 313 | # Generate SVGs for the PCB |
|
0 commit comments