From 7d287ba9316b9fa054d99191cb723ddb4c06af65 Mon Sep 17 00:00:00 2001 From: Yann Sionneau Date: Wed, 15 Apr 2026 14:14:44 +0200 Subject: [PATCH] Fix getting config from git config Currently the CLI will store to the Config object values from the argument parsing regardless of whether they are None or not. But if config.xxx is created, even with a None value the __getattr__ will never get called and thus will never lookup the git config value. The fix is to only store non-None values from the argument parsing to the Config object. Signed-off-by: Yann Sionneau Co-authored-by: Stephen Finucane --- git_pw/shell.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/git_pw/shell.py b/git_pw/shell.py index 431e707..9c5c3fb 100644 --- a/git_pw/shell.py +++ b/git_pw/shell.py @@ -16,7 +16,7 @@ @click.group() @click.option( '--debug', - default=False, + default=None, is_flag=True, help="Output more information about what's going on.", ) @@ -65,7 +65,7 @@ ) @click.version_option() def cli( - debug: bool, + debug: bool | None, token: str | None, username: str | None, password: str | None, @@ -97,12 +97,18 @@ def cli( """ logger.configure_verbosity(debug) - CONF.debug = debug - CONF.token = token - CONF.username = username - CONF.password = password - CONF.server = server - CONF.project = project + if debug is not None: + CONF.debug = debug + if token is not None: + CONF.token = token + if username is not None: + CONF.username = username + if password is not None: + CONF.password = password + if server is not None: + CONF.server = server + if project is not None: + CONF.project = project @cli.group()