|
9 | 9 | import os |
10 | 10 | import re |
11 | 11 | import warnings |
12 | | -from urllib.parse import urlsplit, urlunsplit |
13 | 12 |
|
14 | 13 | from git.cmd import ( |
15 | 14 | Git, |
|
27 | 26 | from git.objects import Submodule, RootModule, Commit |
28 | 27 | from git.refs import HEAD, Head, Reference, TagReference |
29 | 28 | from git.remote import Remote, add_progress, to_progress_instance |
30 | | -from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path |
| 29 | +from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path, remove_password_if_present |
31 | 30 | import os.path as osp |
32 | 31 |
|
33 | 32 | from .fun import rev_parse, is_git_dir, find_submodule_git_dir, touch, find_worktree_git_dir |
@@ -971,16 +970,8 @@ def _clone(cls, git, url, path, odb_default_type, progress, multi_options=None, |
971 | 970 | else: |
972 | 971 | (stdout, stderr) = proc.communicate() |
973 | 972 | cmdline = getattr(proc, 'args', '') |
974 | | - uri = cmdline[-2] |
975 | | - try: |
976 | | - url = urlsplit(uri) |
977 | | - # Remove password from the URL if present |
978 | | - if url.password: |
979 | | - edited_url = url._replace( |
980 | | - netloc=url.netloc.replace(url.password, "****")) |
981 | | - cmdline[-2] = urlunsplit(edited_url) |
982 | | - except ValueError: |
983 | | - log.debug("Unable to parse the URL %s", url) |
| 973 | + cmdline = remove_password_if_present(cmdline) |
| 974 | + |
984 | 975 | log.debug("Cmd(%s)'s unused stdout: %s", cmdline, stdout) |
985 | 976 | finalize_process(proc, stderr=stderr) |
986 | 977 |
|
|
0 commit comments