Skip to content

Commit

Permalink
fix(git): comment sign detection in get_config function (#1281)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
pietrushnic committed Jan 20, 2024
1 parent 1b3df6c commit d0d410b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/lazy/manage/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function M.get_config(repo)
current_section = section:gsub('%s+"', "."):gsub('"+%s*$', "")
else
-- 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*$")
ret[current_section .. "." .. key] = value
end
Expand Down

0 comments on commit d0d410b

Please sign in to comment.