GitPython 3.1.51__py3-none-any.whl → 3.1.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git/__init__.py +1 -1
- git/cmd.py +12 -7
- git/repo/base.py +4 -3
- git/util.py +9 -6
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/METADATA +1 -1
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/RECORD +10 -10
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/WHEEL +0 -0
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/licenses/AUTHORS +0 -0
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/licenses/LICENSE +0 -0
- {gitpython-3.1.51.dist-info → gitpython-3.1.52.dist-info}/top_level.txt +0 -0
git/__init__.py
CHANGED
git/cmd.py
CHANGED
|
@@ -903,29 +903,34 @@ class Git(metaclass=_GitMeta):
|
|
|
903
903
|
|
|
904
904
|
@overload
|
|
905
905
|
@classmethod
|
|
906
|
-
def polish_url(cls, url: str, is_cygwin: Literal[False] = ...) -> str: ...
|
|
906
|
+
def polish_url(cls, url: str, is_cygwin: Literal[False] = ..., expand_vars: bool = ...) -> str: ...
|
|
907
907
|
|
|
908
908
|
@overload
|
|
909
909
|
@classmethod
|
|
910
|
-
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> str: ...
|
|
910
|
+
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None, expand_vars: bool = True) -> str: ...
|
|
911
911
|
|
|
912
912
|
@classmethod
|
|
913
|
-
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> PathLike:
|
|
913
|
+
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None, expand_vars: bool = True) -> PathLike:
|
|
914
914
|
"""Remove any backslashes from URLs to be written in config files.
|
|
915
915
|
|
|
916
916
|
Windows might create config files containing paths with backslashes, but git
|
|
917
917
|
stops liking them as it will escape the backslashes. Hence we undo the escaping
|
|
918
918
|
just to be sure.
|
|
919
|
+
|
|
920
|
+
:param expand_vars:
|
|
921
|
+
Expand environment variables and an initial ``~``. Disable this for values
|
|
922
|
+
obtained from an untrusted source, such as remote URLs.
|
|
919
923
|
"""
|
|
920
924
|
if is_cygwin is None:
|
|
921
925
|
is_cygwin = cls.is_cygwin()
|
|
922
926
|
|
|
923
927
|
if is_cygwin:
|
|
924
|
-
url = cygpath(url)
|
|
928
|
+
url = cygpath(url, expand_vars=expand_vars)
|
|
925
929
|
else:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
url
|
|
930
|
+
if expand_vars:
|
|
931
|
+
url = os.path.expandvars(url)
|
|
932
|
+
if url.startswith("~"):
|
|
933
|
+
url = os.path.expanduser(url)
|
|
929
934
|
url = url.replace("\\\\", "\\").replace("\\", "/")
|
|
930
935
|
return url
|
|
931
936
|
|
git/repo/base.py
CHANGED
|
@@ -1452,8 +1452,9 @@ class Repo:
|
|
|
1452
1452
|
if multi_options:
|
|
1453
1453
|
multi = shlex.split(" ".join(multi_options))
|
|
1454
1454
|
|
|
1455
|
+
clone_url = Git.polish_url(url, expand_vars=False)
|
|
1455
1456
|
if not allow_unsafe_protocols:
|
|
1456
|
-
Git.check_unsafe_protocols(
|
|
1457
|
+
Git.check_unsafe_protocols(clone_url)
|
|
1457
1458
|
if not allow_unsafe_options:
|
|
1458
1459
|
Git.check_unsafe_options(
|
|
1459
1460
|
options=Git._option_candidates([], kwargs),
|
|
@@ -1465,7 +1466,7 @@ class Repo:
|
|
|
1465
1466
|
proc = git.clone(
|
|
1466
1467
|
multi,
|
|
1467
1468
|
"--",
|
|
1468
|
-
|
|
1469
|
+
clone_url,
|
|
1469
1470
|
clone_path,
|
|
1470
1471
|
with_extended_output=True,
|
|
1471
1472
|
as_process=True,
|
|
@@ -1505,7 +1506,7 @@ class Repo:
|
|
|
1505
1506
|
# escape the backslashes. Hence we undo the escaping just to be sure.
|
|
1506
1507
|
if repo.remotes:
|
|
1507
1508
|
with repo.remotes[0].config_writer as writer:
|
|
1508
|
-
writer.set_value("url", Git.polish_url(repo.remotes[0].url))
|
|
1509
|
+
writer.set_value("url", Git.polish_url(repo.remotes[0].url, expand_vars=False))
|
|
1509
1510
|
# END handle remote repo
|
|
1510
1511
|
return repo
|
|
1511
1512
|
|
git/util.py
CHANGED
|
@@ -382,13 +382,13 @@ def py_where(program: str, path: Optional[PathLike] = None) -> List[str]:
|
|
|
382
382
|
return progs
|
|
383
383
|
|
|
384
384
|
|
|
385
|
-
def _cygexpath(drive: Optional[str], path: str) -> str:
|
|
385
|
+
def _cygexpath(drive: Optional[str], path: str, expand_vars: bool = True) -> str:
|
|
386
386
|
if osp.isabs(path) and not drive:
|
|
387
387
|
# Invoked from `cygpath()` directly with `D:Apps\123`?
|
|
388
388
|
# It's an error, leave it alone just slashes)
|
|
389
389
|
p = path # convert to str if AnyPath given
|
|
390
390
|
else:
|
|
391
|
-
p = path and osp.normpath(osp.expandvars(osp.expanduser(path)))
|
|
391
|
+
p = path and osp.normpath(osp.expandvars(osp.expanduser(path)) if expand_vars else path)
|
|
392
392
|
if osp.isabs(p):
|
|
393
393
|
if drive:
|
|
394
394
|
# Confusing, maybe a remote system should expand vars.
|
|
@@ -416,7 +416,7 @@ _cygpath_parsers: Tuple[Tuple[Pattern[str], Callable, bool], ...] = (
|
|
|
416
416
|
)
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
def cygpath(path: str) -> str:
|
|
419
|
+
def cygpath(path: str, expand_vars: bool = True) -> str:
|
|
420
420
|
"""Use :meth:`git.cmd.Git.polish_url` instead, that works on any environment."""
|
|
421
421
|
path = os.fspath(path) # Ensure is str and not AnyPath.
|
|
422
422
|
# Fix to use Paths when 3.5 dropped. Or to be just str if only for URLs?
|
|
@@ -424,12 +424,15 @@ def cygpath(path: str) -> str:
|
|
|
424
424
|
for regex, parser, recurse in _cygpath_parsers:
|
|
425
425
|
match = regex.match(path)
|
|
426
426
|
if match:
|
|
427
|
-
|
|
427
|
+
if parser is _cygexpath:
|
|
428
|
+
path = parser(*match.groups(), expand_vars=expand_vars)
|
|
429
|
+
else:
|
|
430
|
+
path = parser(*match.groups())
|
|
428
431
|
if recurse:
|
|
429
|
-
path = cygpath(path)
|
|
432
|
+
path = cygpath(path, expand_vars=expand_vars)
|
|
430
433
|
break
|
|
431
434
|
else:
|
|
432
|
-
path = _cygexpath(None, path)
|
|
435
|
+
path = _cygexpath(None, path, expand_vars=expand_vars)
|
|
433
436
|
|
|
434
437
|
return path
|
|
435
438
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
git/__init__.py,sha256=
|
|
2
|
-
git/cmd.py,sha256
|
|
1
|
+
git/__init__.py,sha256=Bf3B3KGHpiniZ1c-Cx-Asw21tS4qW2C-YQP3-sO4W8U,8899
|
|
2
|
+
git/cmd.py,sha256=-GN7kZ2ryCgBZq654lYrWdYVjgI6N2LN_zb65zSA-XE,75228
|
|
3
3
|
git/compat.py,sha256=y1E6y6O2q5r8clSlr8ZNmuIWG9nmHuehQEsVsmBffs8,4526
|
|
4
4
|
git/config.py,sha256=VWk1i09HN_nrghQc2iTm4yLpAkPwppHnEBU74XqZl1o,37533
|
|
5
5
|
git/db.py,sha256=vIW9uWSbqu99zbuU2ZDmOhVOv1UPTmxrnqiCtRHCfjE,2368
|
|
@@ -8,7 +8,7 @@ git/exc.py,sha256=Gc7g1pHpn8OmTse30NHmJVsBJ2CYH8LxaR8y8UA3lIM,7119
|
|
|
8
8
|
git/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
git/remote.py,sha256=rCbrMMjILsX08TGYai8wdxzHCHc4ba6vPt6tP9efOog,46881
|
|
10
10
|
git/types.py,sha256=d3oDduUGjfoqffcUL_GOD-3qroF8m3r9ai6Xi9_FraM,10279
|
|
11
|
-
git/util.py,sha256=
|
|
11
|
+
git/util.py,sha256=jJlcOeHKBIL8Q5Fc6dq1mHwU9rYmxEDvdidk7cbBU24,44322
|
|
12
12
|
git/index/__init__.py,sha256=i-Nqb8Lufp9aFbmxpQBORmmQnjEVVM1Pn58fsQkyGgQ,406
|
|
13
13
|
git/index/base.py,sha256=6U-gbvhVa2YmW1v-JeT1TOW6wJHi1li5g9wume-iCmw,62260
|
|
14
14
|
git/index/fun.py,sha256=v0WnKQxaAffMZxXXC7pQOiMvRRJfODhUNKDMruxKrN4,17110
|
|
@@ -34,11 +34,11 @@ git/refs/remote.py,sha256=WTlkJtpu895jJxbknDNOwL31tivQY_AHQrvroUoFBX4,2902
|
|
|
34
34
|
git/refs/symbolic.py,sha256=7ScmZHwlqPDKX9bxVC5queSZXUgqEY7_J_Si6gDBSLw,36139
|
|
35
35
|
git/refs/tag.py,sha256=AKrFrMhkNzX8e9x5WmDRtHovbN9zYQghuKoneVW-TJg,5002
|
|
36
36
|
git/repo/__init__.py,sha256=CILSVH36fX_WxVFSjD9o1WF5LgsNedPiJvSngKZqfVU,210
|
|
37
|
-
git/repo/base.py,sha256=
|
|
37
|
+
git/repo/base.py,sha256=1HFBIKTLLjmVQXhJlesWIXP90xoNM1RTVQF2eIwLkgs,63781
|
|
38
38
|
git/repo/fun.py,sha256=PDFNkuTSGGoQc0EEEXjxHw2_KaKYvVjBZ9rrkwH5Q6Y,23462
|
|
39
|
-
gitpython-3.1.
|
|
40
|
-
gitpython-3.1.
|
|
41
|
-
gitpython-3.1.
|
|
42
|
-
gitpython-3.1.
|
|
43
|
-
gitpython-3.1.
|
|
44
|
-
gitpython-3.1.
|
|
39
|
+
gitpython-3.1.52.dist-info/licenses/AUTHORS,sha256=Iucx_CH3w7_4084yjM6C5BvKfLA8cVfYHWW2pVmpxSk,2410
|
|
40
|
+
gitpython-3.1.52.dist-info/licenses/LICENSE,sha256=hvyUwyGpr7wRUUcTURuv3tIl8lEA3MD3NQ6CvCMbi-s,1503
|
|
41
|
+
gitpython-3.1.52.dist-info/METADATA,sha256=qWOjT4R0uoWQ7C7j9752MZ9TRxrFDV8BBMYDrQkjWbM,14187
|
|
42
|
+
gitpython-3.1.52.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
43
|
+
gitpython-3.1.52.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4
|
|
44
|
+
gitpython-3.1.52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|