From 70b43fbe21df514c5b248dc445483b7bdd7d24d4 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Sat, 7 Aug 2021 19:27:18 -0500 Subject: CI: fix update lockfile job Ref https://github.com/nvim-treesitter/nvim-treesitter/pull/1661#issuecomment-894722369 --- lua/nvim-treesitter/install.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 3bf5b2960..01bfef4d6 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -58,10 +58,14 @@ local function get_parser_install_info(lang, validate) return install_info end +local function load_lockfile() + local filename = utils.join_path(utils.get_package_path(), "lockfile.json") + lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {} +end + local function get_revision(lang) if #lockfile == 0 then - local filename = utils.join_path(utils.get_package_path(), "lockfile.json") - lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {} + load_lockfile() end local install_info = get_parser_install_info(lang) @@ -471,7 +475,7 @@ end function M.write_lockfile(verbose, skip_langs) local sorted_parsers = {} -- Load previous lockfile - get_revision() + load_lockfile() skip_langs = skip_langs or {} for k, v in pairs(parsers.get_parser_configs()) do -- cgit v1.2.3-70-g09d2