Whether `url` selects the Git-transport clone path. Explicit structural markers only: `.git` suffixed URLs, scp-like `git@host:path` forms, `ssh://` URLs, or an existing local Git repository (worktree or bare). A plain HTTPS URL that is not a Git repository stays on the atomic-api path.
(url: &str, _target: &Path)
| 65 | /// repository (worktree or bare). A plain HTTPS URL that is not a Git |
| 66 | /// repository stays on the atomic-api path. |
| 67 | pub(crate) fn is_git_url(url: &str, _target: &Path) -> bool { |
| 68 | let url = url.trim(); |
| 69 | if url.ends_with(".git") || url.starts_with("git@") || url.starts_with("ssh://") { |
| 70 | return true; |
| 71 | } |
| 72 | // Local path: the SOURCE is the transport decision (CB-10B review R11) — |
| 73 | // an existing local Git repository source takes the Git-transport |
| 74 | // bootstrap regardless of whether the DESTINATION exists yet. The |
| 75 | // former implementation checked the destination (which does not exist |
| 76 | // for a fresh clone) and silently mis-routed local Git sources to the |
| 77 | // Atomic-API path. |
| 78 | if !url.contains("://") && !url.contains('@') { |
| 79 | let source = Path::new(url); |
| 80 | if source.exists() { |
| 81 | return GitRepository::open(source).is_ok(); |
| 82 | } |
| 83 | } |
| 84 | false |
| 85 | } |
| 86 | |
| 87 | /// Run `git clone <url> <path>` with inherited stdio (the user's auth |
| 88 | /// config, agents, and askpass prompts behave exactly like plain Git). |