summaryrefslogtreecommitdiff
path: root/blacklist-system-git2
blob: 92d266c4c32e9d784925f2019266297f7b5d4f88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- -*- Lua -*-

-- Our purpose is to blacklist the git2 module(s) found on the package
-- search path.  We do that by loading an environment variable and then
-- wrappering the third searcher as necessary.

function __gall_ll_git2_blacklister(f, ignoreme)
   local type = type
   local function replacement(modname)
      local fret, fname = f(modname)
      if type(fret) == "function" and fname == ignoreme then
	 return nil, "Blacklisted " .. fname .. "\n"
      end
      return fret, fname
   end
   return replacement
end

for fname in (os.getenv("__GALL_LL_GIT2_BLACKLIST") or ""):gmatch("([^:]+)") do
   package.searchers[3] = __gall_ll_git2_blacklister(package.searchers[3], fname)
end