From b3ec33b9a0f851792f98eda8b209d9cf9798d46a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 20 Oct 2026 10:08:11 +0200 Subject: clone tool: fail instead of prompting, lowercase host, update only on 1 A missing or private https repo made git ask for a username through SSH_ASKPASS, which on this desktop is pinentry-qt: a login dialog popped up and the tool waited up to its 300 s timeout. SSH_ASKPASS is now unset and GIT_TERMINAL_PROMPT=0, so the clone fails in about 0.2 s with "terminal prompts disabled". The host is lowercased before the map lookup, so GitHub.com finds GITHUB. update pulls only when it is 1, so a model passing 0 gets the question, not a pull. test-clone.sh checks all three; the new checks fail on the previous script. Co-Authored-By: Claude Opus 5.5 --- examples/tools/clone.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/tools/clone.sh') diff --git a/examples/tools/clone.sh b/examples/tools/clone.sh index f08b932..2f9defc 100755 --- a/examples/tools/clone.sh +++ b/examples/tools/clone.sh @@ -23,6 +23,10 @@ # clone instead. Check: test-clone.sh. set -uo pipefail +# A missing or private repo must fail, not wait on a login: git falls back to +# SSH_ASKPASS (a pinentry dialog on this desktop) and then the terminal. +unset SSH_ASKPASS +export GIT_TERMINAL_PROMPT=0 url=${1:-} to=${2:-} @@ -54,6 +58,7 @@ case "$url" in ;; esac host=${host%%:*} +host=${host,,} path=${path%/} repo=${path##*/} repo=${repo%.git} @@ -106,7 +111,7 @@ target=$root/$folder/$name # Never clone over an existing folder, and never under another name: offer an # update instead. ff-only so a diverged clone is reported, not merged. if [ -e "$target" ]; then - if [ -n "$update" ]; then + if [ "$update" = 1 ]; then out=$(git -C "$target" pull --ff-only 2>&1) && { echo "updated $target: $(tail -1 <<< "$out")" exit 0 -- cgit v1.2.3