Skip to content

Commit 8375116

Browse files
committed
feat(vcs/git): add verbosity argument for Git submodule command
The verbosity argument enables callers to control the supression of command output emitted by the Git submodule command. This is helpful for situations where the Git command call may take a long time, such as with many submodules registered in a repository, or a slow internet connection. The `verbosity` argument has, different than some of its caller methods, a boolean type for verbosity, as the options for verbosity are binary. Verbosity can only be supressed via the `--quiet` flag of the `git submodule update` command. Implements: #13329
1 parent e6db004 commit 8375116

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pip/_internal/vcs/git.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,16 @@ def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]:
496496
return url, rev, user_pass
497497

498498
@classmethod
499-
def update_submodules(cls, location: str) -> None:
499+
def update_submodules(cls, location: str, verbosity: int = 0) -> None:
500+
argv = ["submodule", "update", "--init", "--recursive"]
501+
502+
if verbosity <= 0:
503+
argv.append("-q")
504+
500505
if not os.path.exists(os.path.join(location, ".gitmodules")):
501506
return
502507
cls.run_command(
503-
["submodule", "update", "--init", "--recursive", "-q"],
508+
argv,
504509
cwd=location,
505510
)
506511

0 commit comments

Comments
 (0)