fix(mkrep): stop the test suite creating real repos, and confirm implicit ones
Two related defects on the `$GIT_SERVER` auto-create path added in #150. The test suite was creating repositories on a live forge. mkrep resolves a server from `$GIT_SERVER` plus `$GITEA_URL`/`$GITEA_HOST`, and this repo doubles as a real ~/.config/fish where all of them are exported, so the six sections that call a bare `mkrep <dir>` took the auto-create branch and contacted the server. That is how an empty `rootiest/repo` came to exist on git.rootiest.dev on 2026-09-14 (since deleted). It also explains why those cases looked flaky rather than broken: standalone they passed, because the repo existed and mkrep linked instead of creating, while under run-tests.fish they failed with `Error: no available login` — a throwaway XDG_CONFIG_HOME leaves `tea` with no credentials. Passing for that reason is worse than failing. The suite now neutralizes all five variables once at setup, the same shadow-to-empty pattern already used per-section for --check-existing, whose comment flagged this exact hazard. Nothing depended on the ambient value: every section wanting a server sets its own `set -lx GIT_SERVER`, and one section asserts the opposite outright. mkrep itself now confirms before an implicit create. Creating a repository on a forge is the only outward-facing thing mkrep does, and on this path an exported variable is all it takes to reach it, so `mkrep foo` — which reads as purely local — would make a repo on a server without saying so. It asks first, defaulting to no; declining leaves the local repo with no remote and still exits 0. Provenance is what gates the prompt, not the resolved value: --server, --remote and --new-remote all state outright what they will do, so none of them prompts, and --yes skips the question. Where it cannot be asked (a script, a pipe, any non-interactive shell) creation is skipped rather than assumed, with a note on stderr naming the flags that would allow it. Nine new assertions cover the skip, its stderr note, --yes, and --server not prompting. The interactive read is verified by hand under a PTY, both answers, but is not in the suite: that needs a pseudo-terminal, and the answer parsing it guards is a single `string match`.
This commit is contained in:
+2282
-2702
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user