From 2ba39bd0f0b27152de78394d2a37f3f81016d848 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Singh Date: Thu, 10 Oct 2019 18:06:26 +0530 Subject: Fixed#731 Added check for local file url starting with `$HOME` / `~` to expand them using `os.path.expanduser`. --- git/cmd.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git/cmd.py') 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 -- cgit v1.2.1