#14

Add streamlined clone and diff aliases

MergedxlabMembermerged intofrom

Summary

  • add try clone as the simplest clone entrypoint, sharing arguments and execution with try repo clone
  • accept OWNER/NAME and Trylle HTTPS references while passing scp-style Trylle SSH URLs unchanged to system Git so explicit or default SSH usernames keep working
  • add hidden try review and try r aliases alongside try d for try diff
  • cover both clone entrypoints, all requested repository forms, Git invocation behavior, and hidden aliases

Verification

  • cargo fmt --all -- --check
  • cargo test --locked --all-features

Activity

4
trylle-botreviewed4mo ago
trylle-bot4mo ago

First-pass review (automated). Not approving or requesting changes — flagging one concrete consistency issue and one naming note for a human to weigh. The change is well-scoped and the test coverage (both entrypoints × all repo forms, hidden-alias checks, scp-URL classifier unit test) is genuinely thorough.

What changed

  • New top-level try clone command sharing CloneArgs and execution with try repo clone; the old inline RepoCommand::Clone { .. } body is extracted into a shared run_clone (src/trylle/mod.rs).
  • run_clone gains a fast path: if the input looks like a Trylle scp-style SSH URL it is passed to system Git verbatim (no API lookup, no credential helper); otherwise the previous OWNER/NAME + Trylle-HTTPS → API-clone-URL flow runs unchanged.
  • Hidden review / r aliases added to diff alongside the existing d.

Risk areas

  • is_trylle_scp_style_clone_url hardcodes trylle.com (src/trylle/mod.rs:1209), ignoring the configurable API endpoint. The endpoint is user-configurable via TRYLLE_API_ENDPOINT / TRYLLE_API_URL / config file (src/trylle/api.rs:257), and the rest of the clone path honors it — platform_git_http_url builds from cfg.api_endpoint. The scp classifier does not. Consequence on a custom/self-hosted endpoint: an scp-style SSH URL to that host fails the trylle.com check, so instead of being passed to Git unchanged it falls into resolve_repo → repo_parts, which strips everything before : and reinterprets host:owner/name as plain OWNER/NAME, then clones via the configured API endpoint — silently discarding the user's explicit host and SSH username. That directly undercuts the PR's stated goal that "explicit or default SSH usernames keep working," for any non-default host. The unit test only exercises trylle.com, so this gap isn't covered.
  • try review semantics (src/config/cli.rs:481): review/r are hidden aliases for the diff viewer, but the CLI already has a PR-review surface (try pr review, pr review-comments). A user typing try review 14 expecting to review PR #14 gets the local diff tool instead. It's hidden so it won't clutter help, but the name overlaps a distinct existing concept — worth a conscious call on whether review should alias diff.

Suggested follow-ups

  • Derive the accepted SSH host(s) from cfg.api_endpoint (or the configured web host) instead of the trylle.com literal, and add a classifier/clone test with a non-default endpoint so the custom-host case is pinned.
  • Optionally, decide whether an unrecognized scp-style URL should error clearly ("not a recognized Trylle SSH host") rather than being quietly reparsed as OWNER/NAME — the current silent fallthrough hides the misroute described above.

No other correctness concerns spotted in this pass; the refactor preserves the prior credential-helper/token behavior for the API path.

xlab merged commit 7fe7b0c into master3mo ago

Branch feat/clone-alias has been merged.

Checking branch