From 6fd1d07cfc5244e518e3ee94bf6b796cfe38c3b0 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 30 Mar 2018 15:15:31 -0700 Subject: Handle CR-LFs properly in .gitmodules file Any submodule lines that had a CR-LF ending would be ignored by the parser. Closes gitlab-org/gitlab-ce#2262 --- lib/gitlab/git/gitmodules_parser.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/git/gitmodules_parser.rb b/lib/gitlab/git/gitmodules_parser.rb index 4a43b9b444d..4b505312f60 100644 --- a/lib/gitlab/git/gitmodules_parser.rb +++ b/lib/gitlab/git/gitmodules_parser.rb @@ -46,6 +46,8 @@ module Gitlab iterator = State.new @content.split("\n").each_with_object(iterator) do |text, iterator| + text.chomp! + next if text =~ /^\s*#/ if text =~ /\A\[submodule "(?[^"]+)"\]\z/ @@ -55,7 +57,7 @@ module Gitlab next unless text =~ /\A\s*(?\w+)\s*=\s*(?.*)\z/ - value = $~[:value].chomp + value = $~[:value] iterator.set_attribute($~[:key], value) end end -- cgit v1.2.1