Common library code for other vc*.nvim projects.

Add backwards compatible abspath to support pre-v0.11 versions.

Not sure how long this should be kept, but I guess it doesn't hurt much.

+12 -1
+12 -1
lua/vclib/ignore.lua
··· 39 39 40 40 local is_ignored_cache = {} 41 41 42 + -- TODO(algmyr): Consider removing this at some point. 43 + --- Absolute path, to support versions <0.11 (for now). 44 + ---@param path string 45 + local function _abspath(path) 46 + if vim.fs.abspath then 47 + return vim.fs.abspath(path) 48 + else 49 + return vim.fn.fnamemodify(path, ":p") 50 + end 51 + end 52 + 42 53 -- Check if file should be ignored as per gitignore rules. 43 54 function M.is_ignored(path) 44 55 if is_ignored_cache[path] ~= nil then 45 56 return is_ignored_cache[path] 46 57 end 47 58 48 - local absolute_path = vim.fs.normalize(vim.fs.abspath(path)) 59 + local absolute_path = vim.fs.normalize(_abspath(path)) 49 60 50 61 local vcs_root = _get_vcs_root(vim.fs.dirname(absolute_path)) 51 62 if vcs_root then