From c2099114a8dc7576faa3e19e861400ab125902e4 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 9 Jul 2026 20:31:31 -0500 Subject: [PATCH] fix(tools/git): guard /etc fallback in detect-platform inline chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review catch on #700: the inline chain switched to /etc/mosaic/ credentials.json unconditionally when the HOME file was absent, even if /etc was also absent — diverging from _lib/credentials.sh, which keeps the $HOME default when neither candidate exists. The /etc switch is now guarded by existence, restoring lib/inline parity. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi --- packages/mosaic/framework/tools/git/detect-platform.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/mosaic/framework/tools/git/detect-platform.sh b/packages/mosaic/framework/tools/git/detect-platform.sh index e9e1901..626e1a0 100755 --- a/packages/mosaic/framework/tools/git/detect-platform.sh +++ b/packages/mosaic/framework/tools/git/detect-platform.sh @@ -88,9 +88,13 @@ get_gitea_service_for_host() { local host="$1" local cred_file="${MOSAIC_CREDENTIALS_FILE:-}" if [[ -z "$cred_file" ]]; then - # Same resolution chain as _lib/credentials.sh: profile HOME, then host-level. + # Same resolution chain as _lib/credentials.sh: profile HOME, then + # host-level /etc only if it exists; neither existing keeps the + # $HOME default (matches the lib's final := fallback). cred_file="$HOME/.config/mosaic/credentials.json" - [[ -f "$cred_file" ]] || cred_file="/etc/mosaic/credentials.json" + if [[ ! -f "$cred_file" && -f /etc/mosaic/credentials.json ]]; then + cred_file="/etc/mosaic/credentials.json" + fi fi case "$host" in