From 8072a949f47281da8e6ef6a7794d9c5d747d9242 Mon Sep 17 00:00:00 2001 From: Rob Kimball Date: Fri, 22 Nov 2019 12:08:20 -0500 Subject: [PATCH] Avoids env var warning when path contains $/%; fix #832 --- git/repo/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git/repo/base.py b/git/repo/base.py index 106ed2ebe..05c55eddb 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -77,6 +77,7 @@ class Repo(object): re_whitespace = re.compile(r'\s+') re_hexsha_only = re.compile('^[0-9A-Fa-f]{40}$') re_hexsha_shortened = re.compile('^[0-9A-Fa-f]{4,40}$') + re_envvars = re.compile(r'(\$(\{\s?)?[a-zA-Z_]\w*(\}\s?)?|%\s?[a-zA-Z_]\w*\s?%)') re_author_committer_start = re.compile(r'^(author|committer)') re_tab_full_line = re.compile(r'^\t(.*)$') @@ -125,7 +126,7 @@ def __init__(self, path=None, odbt=GitCmdObjectDB, search_parent_directories=Fal epath = epath or path or os.getcwd() if not isinstance(epath, str): epath = str(epath) - if expand_vars and ("%" in epath or "$" in epath): + if expand_vars and re.search(self.re_envvars, epath): warnings.warn("The use of environment variables in paths is deprecated" + "\nfor security reasons and may be removed in the future!!") epath = expand_path(epath, expand_vars) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy