From 51ffed121515ddf8ebd19af3bc50c438a24325cb Mon Sep 17 00:00:00 2001 From: Nathan Cooper Date: Tue, 3 Mar 2026 09:16:17 -0500 Subject: [PATCH] user expansion --- fastgit/core.py | 4 ++-- nbs/00_core.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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",