From 283fb8792e9b931fc5f8c7a6a3bdf883c4f76197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 15 Jul 2021 16:04:38 +0800 Subject: fix ignore priority --- script/workspace/workspace.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index e69c6d76..485fd5f4 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -80,11 +80,6 @@ function m.getNativeMatcher() end local pattern = {} - -- config.get 'workspace.ignoreDir' - for path in pairs(config.get 'Lua.workspace.ignoreDir') do - log.info('Ignore directory:', path) - pattern[#pattern+1] = path - end -- config.get 'files.exclude' for path, ignore in pairs(config.get 'files.exclude') do if ignore then @@ -92,16 +87,6 @@ function m.getNativeMatcher() pattern[#pattern+1] = path end end - -- config.get 'workspace.ignoreSubmodules' - if config.get 'Lua.workspace.ignoreSubmodules' then - local buf = pub.awaitTask('loadFile', furi.encode(m.path .. '/.gitmodules')) - if buf then - for path in buf:gmatch('path = ([^\r\n]+)') do - log.info('Ignore by .gitmodules:', path) - pattern[#pattern+1] = path - end - end - end -- config.get 'workspace.useGitIgnore' if config.get 'Lua.workspace.useGitIgnore' then local buf = pub.awaitTask('loadFile', furi.encode(m.path .. '/.gitignore')) @@ -123,12 +108,27 @@ function m.getNativeMatcher() end end end + -- config.get 'workspace.ignoreSubmodules' + if config.get 'Lua.workspace.ignoreSubmodules' then + local buf = pub.awaitTask('loadFile', furi.encode(m.path .. '/.gitmodules')) + if buf then + for path in buf:gmatch('path = ([^\r\n]+)') do + log.info('Ignore by .gitmodules:', path) + pattern[#pattern+1] = path + end + end + end -- config.get 'workspace.library' for path in pairs(config.get 'Lua.workspace.library') do path = m.getAbsolutePath(path) log.info('Ignore by library:', path) pattern[#pattern+1] = path end + -- config.get 'workspace.ignoreDir' + for path in pairs(config.get 'Lua.workspace.ignoreDir') do + log.info('Ignore directory:', path) + pattern[#pattern+1] = path + end m.nativeMatcher = glob.gitignore(pattern, m.matchOption, globInteferFace) m.nativeMatcher:setOption('root', m.path) -- cgit v1.2.3