From cbd38d7e89c2a01804d1623a5e90abf99300eb11 Mon Sep 17 00:00:00 2001 From: Simon Reiser Date: Wed, 17 Dec 2025 17:37:41 +0100 Subject: [PATCH 1/2] pleasew: find repo root by traversing up from PWD Instead of looking for .plzconfig in the current directory only, traverse upwards until we find it. This replicates the behavior of getRepoRoot in src/core/utils.go. Fixes #3473 --- pleasew | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pleasew b/pleasew index 4805e88e5..3a828525e 100755 --- a/pleasew +++ b/pleasew @@ -74,12 +74,25 @@ get_profile () { # Check `PLZ_CONFIG_PROFILE` or fall back to arguments for a profile. PROFILE="${PLZ_CONFIG_PROFILE:-$(get_profile "${@}")}" +# Find repo root by traversing up until we find .plzconfig +find_repo_root() { + dir="$PWD" + while true; do + [ -f "$dir/.plzconfig" ] && echo "$dir" && return 0 + [ "$dir" = "/" ] && return 1 + dir="${dir%/*}" + [ -z "$dir" ] && dir="/" + done +} + +REPO_ROOT="$(find_repo_root)" + # Config files on order of precedence high to low. CONFIGS="$(cat <<- EOS - .plzconfig.local - ${PROFILE:+.plzconfig.${PROFILE}} - .plzconfig_${OS}_${ARCH} - .plzconfig + ${REPO_ROOT:+${REPO_ROOT}/.plzconfig.local} + ${REPO_ROOT:+${PROFILE:+${REPO_ROOT}/.plzconfig.${PROFILE}}} + ${REPO_ROOT:+${REPO_ROOT}/.plzconfig_${OS}_${ARCH}} + ${REPO_ROOT:+${REPO_ROOT}/.plzconfig} ${HOME}/.config/please/plzconfig /etc/please/plzconfig EOS From 611bc095270090a5500985d24d87cd8c40145c86 Mon Sep 17 00:00:00 2001 From: Simon Reiser Date: Thu, 18 Dec 2025 08:48:37 +0100 Subject: [PATCH 2/2] pleasew: address review feedback --- pleasew | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pleasew b/pleasew index 3a828525e..bf21ab79b 100755 --- a/pleasew +++ b/pleasew @@ -79,9 +79,8 @@ find_repo_root() { dir="$PWD" while true; do [ -f "$dir/.plzconfig" ] && echo "$dir" && return 0 - [ "$dir" = "/" ] && return 1 - dir="${dir%/*}" - [ -z "$dir" ] && dir="/" + [ "$dir" = "/" ] && return 0 + dir="$(dirname "$dir")" done }