diff --git a/fastgit/core.py b/fastgit/core.py index d92fe68..9fa14fa 100644 --- a/fastgit/core.py +++ b/fastgit/core.py @@ -13,7 +13,7 @@ # %% ../nbs/00_core.ipynb #e4c0a290 def callgit(path, *args, split=None, uname=None): - fp = Path(path).resolve() + fp = Path(path).expanduser().resolve() args = ['git', '-C', str(fp)] + list(args) if uname: args = ['/usr/bin/sudo', '-u', uname] + args res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip() @@ -27,7 +27,7 @@ def get_top(folder): # %% ../nbs/00_core.ipynb #97f78839 class Git: - def __init__(self, d): self.d = Path(d) + def __init__(self, d): self.d = Path(d).expanduser() def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs): paths = [str(p) for p in listify(kwargs.pop('__', None) or [])] diff --git a/nbs/00_core.ipynb b/nbs/00_core.ipynb index b9258da..cc53a9e 100644 --- a/nbs/00_core.ipynb +++ b/nbs/00_core.ipynb @@ -62,7 +62,7 @@ "source": [ "#| export\n", "def callgit(path, *args, split=None, uname=None):\n", - " fp = Path(path).resolve()\n", + " fp = Path(path).expanduser().resolve()\n", " args = ['git', '-C', str(fp)] + list(args)\n", " if uname: args = ['/usr/bin/sudo', '-u', uname] + args\n", " res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()\n", @@ -115,7 +115,7 @@ "source": [ "#| export\n", "class Git:\n", - " def __init__(self, d): self.d = Path(d)\n", + " def __init__(self, d): self.d = Path(d).expanduser()\n", "\n", " def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):\n", " paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]\n",