Skip to content

Commit 08ae98e

Browse files
committed
repos.delete_version: remove entry from manifest if rock is already missing
If rock_manifest could not be found, the entry in manifest is unusable: without the list of files from rock_manifest, we can't scan the repository to remove files. This means the entry in the repo manifest is a leftover from an incomplete removal. Remove the entry from the repo manifest.
1 parent df45eed commit 08ae98e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/luarocks/repos.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,14 @@ function repos.delete_version(name, version, deps_mode, quick)
523523
assert(type(deps_mode) == "string")
524524

525525
local rock_manifest, load_err = manif.load_rock_manifest(name, version)
526-
if not rock_manifest then return nil, load_err end
526+
if not rock_manifest then
527+
if not quick then
528+
local writer = require("luarocks.manif.writer")
529+
writer.remove_from_manifest(name, version, nil, deps_mode)
530+
return nil, "rock_manifest file not found for "..name.." "..version.." - removed entry from the manifest"
531+
end
532+
return nil, load_err
533+
end
527534

528535
local repo = cfg.root_dir
529536
local renames = {}

0 commit comments

Comments
 (0)