diff --git a/repo/project.py b/repo/project.py index 8087352..d4a6130 100644 --- a/repo/project.py +++ b/repo/project.py @@ -3952,14 +3952,17 @@ def _ConfigureDepth(self, depth): """ # Opt.depth will be non-None if user actually passed --depth to repo init. if depth is not None: - if depth > 0: - # Positive values will set the depth. - depth = str(depth) - else: - # Negative numbers will clear the depth; passing None to SetString - # will do that. - depth = None - + try: + if int(depth) > 0: + # Positive values will set the depth. + depth = str(depth) + else: + # Negative numbers will clear the depth; passing None to SetString + # will do that. + depth = None + except ValueError: + depth = None + _warn("depth: invalid integer value: '%s'", depth) # We store the depth in the main manifest project. self.config.SetString('repo.depth', depth)