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

Commit 1f476c9

Browse files
committed
Merge branch 'fix-submodule-parsing' into 'master'
Fix submodule parsing (again) Fixes gitlab-org/gitlab-ce#714. This addresses another bug in the `Repository#submodules` method, where the `.gitmodules` file is not parsed correctly if it contains unusual whitespace formatting. I did not add any new tests for this change, but I did submit a merge request to the test repo at gitlab-org/gitlab-git-test!2 to introduce unusual whitespace in the test repo's `.gitmodules` file. I have updated tests ready to go to handle the breakage inherent with a new commit in the test repo, I just need to plug in the SHAs of the merge commit and the new tag (if you create one). When the test repo changes are merged, I'll open a new MR to update gitlab_git's tests. /cc @jacobvosmaer @dzaporozhets See merge request !11
2 parents ad8ce67 + a280c7a commit 1f476c9

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)