diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-20 10:08:11 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-20 10:08:11 +0200 |
| commit | b3ec33b9a0f851792f98eda8b209d9cf9798d46a (patch) | |
| tree | 0ac7f942c8cae64d40c62868cd994a0dd01e38da /examples/tools/test-clone.sh | |
| parent | f6a2524658e113561a102f86997f9e236f22e9d8 (diff) | |
| download | desktop-assistant-b3ec33b9a0f851792f98eda8b209d9cf9798d46a.tar.gz desktop-assistant-b3ec33b9a0f851792f98eda8b209d9cf9798d46a.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'examples/tools/test-clone.sh')
| -rwxr-xr-x | examples/tools/test-clone.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/tools/test-clone.sh b/examples/tools/test-clone.sh index ff45b6d..02879a2 100755 --- a/examples/tools/test-clone.sh +++ b/examples/tools/test-clone.sh @@ -32,6 +32,7 @@ mkdir -p "$tmp/bin" cat > "$tmp/bin/git" <<'EOF' #!/bin/bash printf '%s\n' "$*" >> "$GIT_LOG" +printf 'prompt=%s askpass=%s\n' "${GIT_TERMINAL_PROMPT-}" "${SSH_ASKPASS-unset}" >> "$GIT_LOG" [ "$1" = clone ] && mkdir -p "${@: -1}" exit 0 EOF @@ -51,8 +52,13 @@ out=$("$here/clone.sh" https://github.com/a/b.git) check "github clone" "$out" "cloned https://github.com/a/b.git into $CLONE_ROOT/GITHUB/a-b" check "seed" "$(cat "$CLONE_MAP")" \ "$(printf '%s\t%s\n' github.com GITHUB gitlab.com GITLAB forge.slackware.nl FORGE)" +check "no prompts" "$(count 'prompt=0 askpass=unset')" "1" check "clone argv" "$(count "clone -- https://github.com/a/b.git $CLONE_ROOT/GITHUB/a-b")" "1" +# Host case does not matter. +out=$("$here/clone.sh" https://GitHub.com/a/up) +check "host case" "$out" "cloned https://GitHub.com/a/up into $CLONE_ROOT/GITHUB/a-up" + # Trailing slash and .git are not part of the repo name. out=$("$here/clone.sh" https://gitlab.com/a/c.git/) check "gitlab repo" "$out" "cloned https://gitlab.com/a/c.git into $CLONE_ROOT/GITLAB/a-c" @@ -96,6 +102,8 @@ check "no duplicate map line" "$(mapcount 'codeberg.org')" "1" out=$("$here/clone.sh" https://github.com/a/b.git) contains "already asks" "$out" "already cloned at $CLONE_ROOT/GITHUB/a-b" check "already no reclone" "$(count "clone -- https://github.com/a/b.git")" "1" +out=$("$here/clone.sh" https://github.com/a/b.git "" 0) +contains "update=0 asks" "$out" "already cloned" out=$("$here/clone.sh" https://github.com/a/b.git "" 1) contains "update says" "$out" "updated $CLONE_ROOT/GITHUB/a-b" check "update argv" "$(count "-C $CLONE_ROOT/GITHUB/a-b pull --ff-only")" "1" |
