Cleanup#17
Merged
Merged
Conversation
The wrapper used to mirror OpenSSH's getopt_long with a list of options that take an argument, just so it could extract the destination host and call `ssh -G user@host`. But `ssh -G` already knows how to parse its own args — feeding it the same args git passed us (minus the trailing remote command) gives the same effective config. * Drop `_SSH_OPTS_WITH_ARG` and `parse_host_from_ssh_args` (~50 lines). * Drop the wrapper's per-host JSON cache file (~30 lines). Each git op costs one `ssh -G` invocation (~50ms) on top of the network fetch — negligible vs. simpler code. * Replace `_NullCM` / `_SemCM` boilerplate with `contextlib.nullcontext` and `threading.Semaphore` (already a context manager). Net: -80 lines, no behaviour change for users. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Things removed without behaviour change: * `_OWNED_ENV` marker and the dual-condition GIT_SSH_COMMAND check. The `_warmed` fast-path means we only enter `_set_git_ssh_command` once per host anyway, so checking "is it our value vs theirs" is unreachable. Just "skip if already set" is enough. * `set_verbose` / `_log` / `_verbose`. Three primitives plumbing a flag through to a few diagnostic prints. Real prewarm failures are visible as slow fetches (each pays its own auth); a verbose hook here is rarely useful. * `_atexit_registered` + `_ensure_atexit`. Just register the cleanup once at module import. It's a no-op when nothing was warmed. * `host_key()` function. Tuple keys (`(user, host, port)`) work directly as dict keys. * `_is_keepalive_configured` and `wrapper_script_path` — single-line single-call helpers, inlined. * `probe_ssh_config(user, host, port)` -> `probe_ssh_config(ssh_args)`. Both `ensure_master_for_url` and the wrapper now share the same probe function instead of the wrapper duplicating its own parser. Net: -88 lines. All 73 tests still pass; krattcam end-to-end unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
RedFox20
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forgot to push these commit cleaning up a load of stuff where Claude initially overengineered.