diff options
author | Michael Mercier <michael.mercier@ryax.tech> | 2021-03-15 17:54:48 +0100 |
---|---|---|
committer | Michael Mercier <michael.mercier@ryax.tech> | 2021-03-15 18:00:05 +0100 |
commit | f7968d136276607115907267b3be89c3ff9acd03 (patch) | |
tree | 505d533c942747f57785a449df4e2a7612cd2e77 /git/repo/base.py | |
parent | f7180d50f785ec28963e12e647d269650ad89b31 (diff) | |
download | gitpython-f7968d136276607115907267b3be89c3ff9acd03.tar.gz |
Put remove password in the utils and use it also in cmd.execute
Diffstat (limited to 'git/repo/base.py')
-rw-r--r-- | git/repo/base.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/git/repo/base.py b/git/repo/base.py index 9cb84054..e68bc077 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -9,7 +9,6 @@ import logging import os import re import warnings -from urllib.parse import urlsplit, urlunsplit from git.cmd import ( Git, @@ -27,7 +26,7 @@ from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance -from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path +from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path, remove_password_if_present import os.path as osp from .fun import rev_parse, is_git_dir, find_submodule_git_dir, touch, find_worktree_git_dir @@ -971,16 +970,8 @@ class Repo(object): else: (stdout, stderr) = proc.communicate() cmdline = getattr(proc, 'args', '') - uri = cmdline[-2] - try: - url = urlsplit(uri) - # Remove password from the URL if present - if url.password: - edited_url = url._replace( - netloc=url.netloc.replace(url.password, "****")) - cmdline[-2] = urlunsplit(edited_url) - except ValueError: - log.debug("Unable to parse the URL %s", url) + cmdline = remove_password_if_present(cmdline) + log.debug("Cmd(%s)'s unused stdout: %s", cmdline, stdout) finalize_process(proc, stderr=stderr) |