Skip to content

Revert "Merge branch 'better_ambiguous_ref_errors' into 'master'"

This reverts commit wfb61edd3 (Merge branch 'better_ambiguous_ref_errors' into 'master', 2022-10-21). This commit introduces improved error handling in the case where there are ambiguous references. This fix caused a downstream regression in Rails' tests:

  1) Branches::CreateService#bulk_create when an ambiguous branch name is provided returns an error that branch could not be created
     Failure/Error: expect(subject[:message]).to match_array([err_msg])
       expected collection contained:  ["Failed to create branch 'ambiguous': 13:reference is ambiguous."]
       actual collection contained:    ["Branch already exists", "Failed to create branch 'ambiguous': invalid reference name 'master'"]
       the missing elements were:      ["Failed to create branch 'ambiguous': 13:reference is ambiguous."]
       the extra elements were:        ["Branch already exists", "Failed to create branch 'ambiguous': invalid reference name 'master'"]
     # ./spec/services/branches/create_service_spec.rb:66:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:413:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:405:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:401:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:58:in `with_raw_context'
     # ./spec/spec_helper.rb:401:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:241:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/flaky_tests.rb:27:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ./spec/support/caching.rb:32:in `block (2 levels) in <main>'
  2) Branches::CreateService#execute when an ambiguous branch name is provided returns an error that branch could not be created
     Failure/Error: expect(result[:message]).to eq(err_msg)
       expected: "Failed to create branch 'feature': 13:reference is ambiguous."
            got: "Failed to create branch 'feature': invalid reference name 'master'"
       (compared using ==)
     # ./spec/services/branches/create_service_spec.rb:195:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:413:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:405:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:401:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:58:in `with_raw_context'
     # ./spec/spec_helper.rb:401:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:241:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/flaky_tests.rb:27:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ./spec/support/caching.rb:32:in `block (2 levels) in <main>'

Reverts !4950 (merged).

Merge request reports