summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Kumar Singh <toanant@users.noreply.github.com>2019-10-10 18:06:26 +0530
committerSebastian Thiel <sebastian.thiel@icloud.com>2019-10-17 09:02:12 +0200
commit2ba39bd0f0b27152de78394d2a37f3f81016d848 (patch)
tree275e2b85a152d354a0c943bfb9f53dc6dce0a911
parent4ba1ceaeadd8ff39810c5f410f92051a36dd17e6 (diff)
downloadgitpython-2ba39bd0f0b27152de78394d2a37f3f81016d848.tar.gz
Fixed#731
Added check for local file url starting with `$HOME` / `~` to expand them using `os.path.expanduser`.
-rw-r--r--git/cmd.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 2d288b25..a06daaaf 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -330,6 +330,10 @@ class Git(LazyMixin):
but git stops liking them as it will escape the backslashes.
Hence we undo the escaping just to be sure.
"""
+ if url.startswith('$HOME/'):
+ url = url.replace('$HOME/', '~/')
+ if url.startswith('~'):
+ url = os.path.expanduser(url)
url = url.replace("\\\\", "\\").replace("\\", "/")
return url