Skip to content

Commit 36bd4d3

Browse files
committed
9pm.py: use --git-dir flag for git commands
Instead of -C which is more sensitive to file permissions. Signed-off-by: Richard Alpe <[email protected]>
1 parent ff074ff commit 36bd4d3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

9pm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,14 +687,16 @@ def setup_env(args):
687687
os.environ["NINEPM_CONFIG"] = args.config
688688

689689
def run_git_cmd(path, command):
690-
if not os.path.isdir(os.path.join(path, '.git')):
690+
gitdir = os.path.join(path, '.git')
691+
692+
if not os.path.isdir(gitdir):
691693
vcprint(pcolor.orange, f"warning, no .git dir in path ({path})")
692694
return ""
693695

694696
try:
695-
vcprint(pcolor.faint, f"Running: git -C {path} {command}")
697+
vcprint(pcolor.faint, f"Running: git --git-dir {gitdir} {command}")
696698
result = subprocess.check_output(
697-
['git', '-C', path] + command,
699+
['git', '--git-dir', gitdir] + command,
698700
stderr=subprocess.STDOUT
699701
).decode('utf-8').strip()
700702
except Exception as e:

0 commit comments

Comments
 (0)