TreeEntry doesn't handle UTF-8 in branch names
Note: gitaly_project_raw_show
is disabled
*** PRODUCTION *** production> p = Project.find_by_full_path('think/gitlab-branch-test')
=> #<Project id:6398704 think/gitlab-branch-test>
*** PRODUCTION *** production> p.repository.blob_at('Ähh', 'README.md')
Encoding::UndefinedConversionError: U+00C4 from UTF-8 to ASCII-8BIT
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `initialize'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `new'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `tree_entry'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/git/blob.rb:156:in `find_by_gitaly'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/git/blob.rb:27:in `block in find'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client.rb:268:in `block (2 levels) in migrate'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client.rb:308:in `allow_n_plus_1_calls'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client.rb:261:in `block in migrate'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/metrics/influx_db.rb:98:in `measure'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client.rb:259:in `migrate'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/git/blob.rb:25:in `find'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/git/repository.rb:1260:in `blob_at'
from /opt/gitlab/embedded/service/gitlab-rails/app/models/repository.rb:468:in `blob_at'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/metrics/instrumentation.rb:161:in `blob_at'
from (irb):7
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:110:in `start'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:9:in `start'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:68:in `console'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:14:in `require'
from bin/rails:14:in `<main>'
*** PRODUCTION *** production> Gitlab::Git::Blob.send(:find_by_rugged, p.repository, 'Ähh', 'README.md', limit: Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE)
=> #<Gitlab::Git::Blob:0x00007f4ceba874a8 @id="3b950ceb0b32ff84d03812c470f333557ef55ce9", @name="README.md", @path="README.md", @size=63, @data="# Verify bug for cannot edit files online in Non-Ascii Branches", @mode="100644", @commit_id="Ähh", @binary=false, @loaded_size=63, @loaded_all_data=true>
*** PRODUCTION *** production> Gitlab::Git::Blob.send(:find_by_gitaly, p.repository, 'Ähh', 'README.md')
Encoding::UndefinedConversionError: U+00C4 from UTF-8 to ASCII-8BIT
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `initialize'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `new'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/gitaly_client/commit_service.rb:79:in `tree_entry'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/git/blob.rb:156:in `find_by_gitaly'
from (irb):13
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:110:in `start'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/console.rb:9:in `start'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:68:in `console'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:14:in `require'
from bin/rails:14:in `<main>'
https://gitlab.com/gitlab-org/gitlab-ce/issues/46445#note_74541861