Skip to content

Commit 2f0b2a7

Browse files
authored
user expansion (#4)
1 parent fada9f7 commit 2f0b2a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fastgit/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# %% ../nbs/00_core.ipynb #e4c0a290
1515
def callgit(path, *args, split=None, uname=None):
16-
fp = Path(path).resolve()
16+
fp = Path(path).expanduser().resolve()
1717
args = ['git', '-C', str(fp)] + list(args)
1818
if uname: args = ['/usr/bin/sudo', '-u', uname] + args
1919
res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()
@@ -27,7 +27,7 @@ def get_top(folder):
2727

2828
# %% ../nbs/00_core.ipynb #97f78839
2929
class Git:
30-
def __init__(self, d): self.d = Path(d)
30+
def __init__(self, d): self.d = Path(d).expanduser()
3131

3232
def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):
3333
paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]

nbs/00_core.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"source": [
6363
"#| export\n",
6464
"def callgit(path, *args, split=None, uname=None):\n",
65-
" fp = Path(path).resolve()\n",
65+
" fp = Path(path).expanduser().resolve()\n",
6666
" args = ['git', '-C', str(fp)] + list(args)\n",
6767
" if uname: args = ['/usr/bin/sudo', '-u', uname] + args\n",
6868
" res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()\n",
@@ -115,7 +115,7 @@
115115
"source": [
116116
"#| export\n",
117117
"class Git:\n",
118-
" def __init__(self, d): self.d = Path(d)\n",
118+
" def __init__(self, d): self.d = Path(d).expanduser()\n",
119119
"\n",
120120
" def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):\n",
121121
" paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]\n",

0 commit comments

Comments
 (0)