tools.vpm: be more specific, when handling .git endings (#20110)

This commit is contained in:
Turiiya 2023-12-07 17:21:09 +01:00 committed by GitHub
parent 772f11494f
commit f0fe3df0a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -108,8 +108,8 @@ fn get_ident_from_url(raw_url string) !(string, string) {
publisher, mut name := url.path.trim_left('/').rsplit_once('/') or {
return error('failed to retrieve module name for `${url}`.')
}
name = name.trim_string_right('.git')
vpm_log(@FILE_LINE, @FN, 'raw_url: ${raw_url}; publisher: ${publisher}; name: ${name}')
name = if name.ends_with('.git') { name.replace('.git', '') } else { name }
return publisher, name
}

View File

@ -188,7 +188,7 @@ fn fetch_manifest(name string, url string, version string, is_git bool) !vmod.Ma
}
head_branch.output.all_after_last('/').all_before(' ').all_before('\t')
}
url_ := if url.ends_with('.git') { url.replace('.git', '') } else { url }
url_ := url.trim_string_right('.git')
// Scan both URLS. E.g.:
// https://github.com/publisher/module/raw/v0.7.0/v.mod
// https://gitlab.com/publisher/module/-/raw/main/v.mod