mirror of
https://github.com/vlang/v.git
synced 2025-09-12 17:07:11 -04:00
tools.vpm: improve handling of urls that end with .git (#19758)
This commit is contained in:
parent
bb463246b6
commit
55db150fe1
@ -43,7 +43,7 @@ fn vpm_install(requested_modules []string, opts []string) {
|
||||
eprintln('Errors while parsing module url "${raw_url}" : ${err}')
|
||||
continue
|
||||
}
|
||||
mod_name := url.path.all_after_last('/')
|
||||
mod_name := url.path.all_after_last('/').replace('.git', '')
|
||||
if mod_name in installed_modules {
|
||||
already_installed << mod_name
|
||||
i_deleted << i
|
||||
@ -150,7 +150,7 @@ fn vpm_install_from_vcs(modules []string, vcs &VCS) {
|
||||
}
|
||||
// Module identifier based on URL.
|
||||
// E.g.: `https://github.com/owner/awesome-v-project` -> `owner/awesome_v_project`
|
||||
mut ident := url.path#[1..].replace('-', '_')
|
||||
mut ident := url.path#[1..].replace('-', '_').replace('.git', '')
|
||||
owner, repo_name := ident.split_once('/') or {
|
||||
errors++
|
||||
eprintln('Errors while retrieving module name for: "${url}"')
|
||||
|
@ -63,6 +63,9 @@ fn test_install_already_existent() {
|
||||
}
|
||||
assert mod.name == 'markdown'
|
||||
assert mod.dependencies == []string{}
|
||||
// The same module but with the `.git` extension added.
|
||||
os.execute_or_exit('${v} install https://github.com/vlang/markdown.git')
|
||||
assert res.output.contains('already exists')
|
||||
}
|
||||
|
||||
fn test_install_once() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user