Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix URL encoding for SSH git URLs in subtree commands

Uri.to_string percent-encodes special characters like @, which breaks
SSH URLs like git@host:path. Use Uri.pct_decode to restore the original
URL string.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+11 -4
+11 -4
lib/git.ml
··· 1 + (* Convert Uri.t to string for git commands, handling SSH URLs properly. 2 + Uri.to_string percent-encodes special characters like @, but SSH URLs 3 + like git@host:path need to be passed through unencoded. *) 4 + let uri_to_git_url url = 5 + let s = Uri.to_string url in 6 + Uri.pct_decode s 7 + 1 8 type cmd_result = { exit_code : int; stdout : string; stderr : string } 2 9 3 10 type error = ··· 84 91 let parent = Fpath.parent target in 85 92 let cwd = Eio.Path.(fs / Fpath.to_string parent) in 86 93 let target_name = Fpath.basename target in 87 - let url_str = Uri.to_string url in 94 + let url_str = uri_to_git_url url in 88 95 run_git_ok ~proc ~cwd [ "clone"; "--branch"; branch; url_str; target_name ] 89 96 |> Result.map ignore 90 97 ··· 160 167 if exists ~fs ~repo ~prefix then Error (Subtree_prefix_exists prefix) 161 168 else 162 169 let cwd = path_to_eio ~fs repo in 163 - let url_str = Uri.to_string url in 170 + let url_str = uri_to_git_url url in 164 171 run_git_ok ~proc ~cwd 165 172 [ "subtree"; "add"; "--prefix"; prefix; url_str; branch; "--squash" ] 166 173 |> Result.map ignore ··· 169 176 if not (exists ~fs ~repo ~prefix) then Error (Subtree_prefix_missing prefix) 170 177 else 171 178 let cwd = path_to_eio ~fs repo in 172 - let url_str = Uri.to_string url in 179 + let url_str = uri_to_git_url url in 173 180 run_git_ok ~proc ~cwd 174 181 [ "subtree"; "pull"; "--prefix"; prefix; url_str; branch; "--squash" ] 175 182 |> Result.map ignore ··· 178 185 if not (exists ~fs ~repo ~prefix) then Error (Subtree_prefix_missing prefix) 179 186 else 180 187 let cwd = path_to_eio ~fs repo in 181 - let url_str = Uri.to_string url in 188 + let url_str = uri_to_git_url url in 182 189 run_git_ok ~proc ~cwd 183 190 [ "subtree"; "push"; "--prefix"; prefix; url_str; branch ] 184 191 |> Result.map ignore