ArgumentError: 3:revision can't contain whitespace.

https://new-sentry.gitlab.net/organizations/gitlab/issues/480586

GRPC::InvalidArgument: 3:revision can't contain whitespace.
  config/initializers/enumerator_next_patch.rb:9:in `block (2 levels) in <module:EnumeratorNextPatch>'
    gitlab_patch_backtrace_marker { super(*args) }
  lib/gitlab/gitaly_client/call.rb:43:in `block (3 levels) in instrument_stream'
    value = recording_request { response.next }
  lib/gitlab/gitaly_client/call.rb:55:in `recording_request'
    yield
  lib/gitlab/gitaly_client/call.rb:43:in `block (2 levels) in instrument_stream'
    value = recording_request { response.next }
  lib/gitlab/gitaly_client/call.rb:42:in `loop'
    loop do
...
(175 additional frame(s) were not displayed)

ArgumentError: 3:revision can't contain whitespace.
  lib/gitlab/git/wraps_gitaly_errors.rb:11:in `rescue in wrapped_gitaly_errors'
    raise ArgumentError, e
  lib/gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'
    def wrapped_gitaly_errors(&block)
  lib/gitlab/git/repository.rb:377:in `log'
    wrapped_gitaly_errors do
  lib/gitlab/git/commit.rb:47:in `where'
    repo.log(options)
  app/models/repository.rb:167:in `commits'
    commits = Gitlab::Git::Commit.where(options)
...
(160 additional frame(s) were not displayed)

Note See the previous attempt: !79531 (merged). This MR was reverted, because ref_name can include ranges.

Edited by Vasilii Iakliushin