Skip to content

Commit dbac5f9

Browse files
committed
Remove a file:// prefix from urls on Windows
1 parent d9e2a7b commit dbac5f9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/resolvers/hg.cr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,18 @@ module Shards
325325
path = local_path
326326
FileUtils.rm_r(path) if File.exists?(path)
327327
Dir.mkdir_p(path)
328-
hg_retry(err: "Failed to clone #{hg_url}") do
328+
329+
source = hg_url
330+
# Remove a "file://" from the beginning, otherwise the path might be invalid
331+
# on Windows.
332+
source = source[7..] if source.starts_with?("file://")
333+
334+
hg_retry(err: "Failed to clone #{source}") do
329335
# We checkout the working directory so that "." is meaningful.
330336
#
331337
# An alternative would be to use the `@` bookmark, but only as long
332338
# as nothing new is committed.
333-
run_in_current_folder "hg clone --quiet -- #{Process.quote(hg_url)} #{Process.quote(path)}"
339+
run_in_current_folder "hg clone --quiet -- #{Process.quote(source)} #{Process.quote(path)}"
334340
end
335341
end
336342

0 commit comments

Comments
 (0)