diff options
-rw-r--r-- | qa/qa/git/repository.rb | 2 | ||||
-rw-r--r-- | qa/spec/git/repository_spec.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index b3bad40a90f..84353e3d0c7 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -251,7 +251,7 @@ module QA end def netrc_already_contains_content? - read_netrc_content.grep(/^#{netrc_content}$/).any? + read_netrc_content.grep(/^#{Regexp.escape(netrc_content)}$/).any? end end end diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb index 776dce31d4f..fd77681797f 100644 --- a/qa/spec/git/repository_spec.rb +++ b/qa/spec/git/repository_spec.rb @@ -116,6 +116,15 @@ describe QA::Git::Repository do expect(File.read(File.join(tmp_netrc_dir, '.netrc'))) .to eq("machine foo login user password foo\n") end + + it 'adds credentials with special characters' do + password = %q(!"#$%&'()*+,-./:;<=>?) + repository.username = 'user' + repository.password = password + + expect(File.read(File.join(tmp_netrc_dir, '.netrc'))) + .to eq("machine foo login user password #{password}\n") + end end end end |