Skip to content

Commit d19c1ef

Browse files
authored
vpm: fix the direct installation of github repositories via the --git flag (#16724)
1 parent 2f9becc commit d19c1ef

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

cmd/tools/vpm.v

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -306,31 +306,33 @@ fn vpm_install_from_vcs(module_names []string, vcs_key string) {
306306
return
307307
}
308308
minfo := mod_name_info(vmod.name)
309-
println('Relocating module from "${name}" to "${vmod.name}" ( "${minfo.final_module_path}" ) ...')
310-
if os.exists(minfo.final_module_path) {
311-
eprintln('Warning module "${minfo.final_module_path}" already exsits!')
312-
eprintln('Removing module "${minfo.final_module_path}" ...')
313-
os.rmdir_all(minfo.final_module_path) or {
314-
errors++
315-
println('Errors while removing "${minfo.final_module_path}" :')
316-
println(err)
317-
continue
309+
if final_module_path != minfo.final_module_path {
310+
println('Relocating module from "${name}" to "${vmod.name}" ( "${minfo.final_module_path}" ) ...')
311+
if os.exists(minfo.final_module_path) {
312+
eprintln('Warning module "${minfo.final_module_path}" already exsits!')
313+
eprintln('Removing module "${minfo.final_module_path}" ...')
314+
os.rmdir_all(minfo.final_module_path) or {
315+
errors++
316+
println('Errors while removing "${minfo.final_module_path}" :')
317+
println(err)
318+
continue
319+
}
318320
}
319-
}
320-
os.mv(final_module_path, minfo.final_module_path) or {
321-
errors++
322-
eprintln('Errors while relocating module "${name}" :')
323-
eprintln(err)
324-
os.rmdir_all(final_module_path) or {
321+
os.mv(final_module_path, minfo.final_module_path) or {
325322
errors++
326-
eprintln('Errors while removing "${final_module_path}" :')
323+
eprintln('Errors while relocating module "${name}" :')
327324
eprintln(err)
325+
os.rmdir_all(final_module_path) or {
326+
errors++
327+
eprintln('Errors while removing "${final_module_path}" :')
328+
eprintln(err)
329+
continue
330+
}
328331
continue
329332
}
330-
continue
333+
println('Module "${name}" relocated to "${vmod.name}" successfully.')
334+
final_module_path = minfo.final_module_path
331335
}
332-
println('Module "${name}" relocated to "${vmod.name}" successfully.')
333-
final_module_path = minfo.final_module_path
334336
name = vmod.name
335337
}
336338
resolve_dependencies(name, final_module_path, module_names)

0 commit comments

Comments
 (0)