diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-04-02 17:25:35 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-04-02 17:25:35 +0300 |
commit | 1c40f18f0260c2d8048270481d8671486313d162 (patch) | |
tree | b1163e2b97abf5122ef0a0a71c3c49a934f86c87 /lib | |
parent | aec23eaa45f6740883e93f525e0a8896dfd93834 (diff) | |
parent | 6fd1d07cfc5244e518e3ee94bf6b796cfe38c3b0 (diff) |
Merge branch 'sh-cleanup-crlf-gitmodules' into 'master'
Handle CR-LFs properly in .gitmodules file
Closes #2262
See merge request gitlab-org/gitlab-ce!18117
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/gitmodules_parser.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 "(?<name>[^"]+)"\]\z/ @@ -55,7 +57,7 @@ module Gitlab next unless text =~ /\A\s*(?<key>\w+)\s*=\s*(?<value>.*)\z/ - value = $~[:value].chomp + value = $~[:value] iterator.set_attribute($~[:key], value) end end |