fix(tools/git): guard /etc fallback in detect-platform inline chain
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
This commit is contained in:
@@ -88,9 +88,13 @@ get_gitea_service_for_host() {
|
|||||||
local host="$1"
|
local host="$1"
|
||||||
local cred_file="${MOSAIC_CREDENTIALS_FILE:-}"
|
local cred_file="${MOSAIC_CREDENTIALS_FILE:-}"
|
||||||
if [[ -z "$cred_file" ]]; then
|
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"
|
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
|
fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
|||||||
Reference in New Issue
Block a user