/usr/share/monotone/hooks/monotone-cvs-ignore.lua is in monotone-extras 1.1-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | do
local _glob_to_pattern = function (glob)
local pattern
-- escape all special characters:
pattern = string.gsub(glob, "([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1")
-- convert the glob's ones to pattern's:
pattern = string.gsub(pattern, "%%%*", "[^/]*")
pattern = string.gsub(pattern, "%%%?", ".")
return pattern
end
local old_ignore_file = ignore_file
function ignore_file(name)
local dir, pat1, pat2
dir = string.gsub(name, "/[^/]+$", "/")
if (dir == name) then dir = "" end
pat1 = "^" .. _glob_to_pattern(dir)
local handle, msg = io.open(dir .. ".cvsignore")
if (handle) then
for line in handle:lines() do
pat2 = _glob_to_pattern(line) .. "$"
if (string.find(name, pat1 .. pat2)) then
return true
end
end
io.close(handle)
end
return old_ignore_file(name)
end
end
|