File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
lua/mason-core/installer/registry/providers
tests/mason-core/installer/registry/providers Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 6060function M .get_versions (purl )
6161 --- @type string ?
6262 local repository_url = _ .path ({ " qualifiers" , " repository_url" }, purl )
63+ local rev = _ .path ({ " qualifiers" , " rev" }, purl )
6364 if repository_url then
65+ if rev == " true" then
66+ -- When ?rev=true we're targeting a commit SHA. It's not feasible to retrieve all commit SHAs for a
67+ -- repository so we fail instead.
68+ return Result .failure " Unable to retrieve commit SHAs."
69+ end
70+
6471 --- @type Result ?
6572 local git_tags = _ .cond {
6673 {
Original file line number Diff line number Diff line change @@ -136,4 +136,16 @@ describe("cargo provider :: versions", function()
136136 assert .spy (providers .github .get_all_tags ).was_called (1 )
137137 assert .spy (providers .github .get_all_tags ).was_called_with " rust-lang/rust-analyzer"
138138 end )
139+
140+ it (" should not provide git commit SHAs" , function ()
141+ local result = cargo .get_versions (purl {
142+ qualifiers = {
143+ repository_url = " https://github.com/rust-lang/rust-analyzer" ,
144+ rev = " true" ,
145+ },
146+ })
147+
148+ assert .is_false (result :is_success ())
149+ assert .equals (" Unable to retrieve commit SHAs." , result :err_or_nil ())
150+ end )
139151end )
You can’t perform that action at this time.
0 commit comments