From f750b2cf053d68f874263ecc2a878abc6788a4ec Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 19 Nov 2025 09:15:13 +0100 Subject: [PATCH] CmdGetAuthInfo: Don't use non-git jw-build Don't try to use non-git jw-build repositories to retrieve auth info. Signed-off-by: Jan Lindemann --- src/python/jw/build/cmds/CmdGetAuthInfo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/python/jw/build/cmds/CmdGetAuthInfo.py b/src/python/jw/build/cmds/CmdGetAuthInfo.py index 34ba32c3..4f7a8906 100644 --- a/src/python/jw/build/cmds/CmdGetAuthInfo.py +++ b/src/python/jw/build/cmds/CmdGetAuthInfo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import re +import re, os from argparse import Namespace, ArgumentParser from urllib.parse import urlparse @@ -19,7 +19,11 @@ class CmdGetAuthInfo(Cmd): # export parser.add_argument('--password', help='Show password', action='store_true', default=False) def _run(self, args: Namespace) -> None: - remotes = run_cmd(['git', '-C', self.app.proj_dir('jw-build'), 'remote', '-v']) + jw_build_dir = self.app.proj_dir('jw-build') + if not os.path.isdir(jw_build_dir + '/.git'): + self.app.debug(f'jw-build directory is not a Git repo: {jw_build_dir}') + return + remotes = run_cmd(['git', '-C', jw_build_dir, 'remote', '-v']) result: dict[str, str] = {} keys = ['username', 'password'] for line in remotes.split('\n'):