Skip to content
This repository was archived by the owner on May 12, 2018. It is now read-only.

Commit a280c7a

Browse files
committed
Fix .gitmodules parsing
Handle whitespace variations in the .gitmodules file when parsing it to get submodule information.
1 parent 94bc336 commit a280c7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/gitlab_git/repository.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,11 @@ def parse_gitmodules(commit, content)
736736

737737
current = ""
738738
content.split("\n").each do |txt|
739-
if txt.match(/^\[/)
739+
if txt.match(/^\s*\[/)
740740
current = txt.match(/(?<=").*(?=")/)[0]
741741
results[current] = {}
742742
else
743-
match_data = txt.match(/(\w+) = (.*)/)
743+
match_data = txt.match(/(\w+)\s*=\s*(.*)/)
744744
results[current][match_data[1]] = match_data[2]
745745

746746
if match_data[1] == "path"

0 commit comments

Comments
 (0)