fix(git): comment sign detection in get_config function

- Modify the condition in the get_config function to correctly ignore
  comments and blank lines.
- Update the regular expression to exclude lines starting with '#' or
  ';'.
- This change ensures that only valid key-value pairs are added to the
  configuration table.
This commit is contained in:
Piotr Król 2024-01-17 17:45:12 +01:00
commit 33fab46082
No known key found for this signature in database
GPG key ID: 9C8D5703340C0F1C

View file

@ -217,7 +217,7 @@ function M.get_config(repo)
current_section = section:gsub('%s+"', "."):gsub('"+%s*$', "") current_section = section:gsub('%s+"', "."):gsub('"+%s*$', "")
else else
-- Ignore comments and blank lines -- Ignore comments and blank lines
if not line:match("^%s*#") and line:match("%S") then if not line:match("^%s*[#;]") and line:match("%S") then
local key, value = line:match("^%s*(%S+)%s*=%s*(.+)%s*$") local key, value = line:match("^%s*(%S+)%s*=%s*(.+)%s*$")
ret[current_section .. "." .. key] = value ret[current_section .. "." .. key] = value
end end