Skip to content

Revert UserCommitFiles via Git plumbing commands

Patrick Steinhardt requested to merge revert-99a6249d into master

This reverts merge request !5565 (merged), which introduced the logic to implement UserCommitFiles via Git plumbing commands. This conversion is causing multiple test failures downstream which are directly in the vicinity of this RPC:

  1) Gitlab::BackgroundMigration::BackfillSnippetRepositories#perform when user name is invalid behaves like migration_bot user commits files 
     Failure/Error: expect(last_commit.author_name).to eq migration_bot.name
     NoMethodError:
       undefined method `author_name' for nil:NilClass
     Shared Example Group: "migration_bot user commits files" called from ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:261
     # ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:92:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:415:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:406:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:402:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:61:in `with_raw_context'
     # ./spec/spec_helper.rb:402:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/migration.rb:53:in `block (2 levels) in <main>'
     # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
  2) Gitlab::BackgroundMigration::BackfillSnippetRepositories#perform when both user name and snippet file_name are invalid updates the file_name only when it is invalid
     Failure/Error: expect(blob_at(invalid_snippet, 'snippetfile1.txt')).to be
       expected nil to evaluate to true
     # ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:296:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:415:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:406:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:402:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:61:in `with_raw_context'
     # ./spec/spec_helper.rb:402:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/migration.rb:53:in `block (2 levels) in <main>'
     # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
  3) Gitlab::BackgroundMigration::BackfillSnippetRepositories#perform when both user name and snippet file_name are invalid increases the number of retries temporarily from 2 to 3
     Failure/Error: expect(service).to receive(:create_commit).with(Snippet.find(invalid_snippet.id)).exactly(described_class::MAX_RETRIES + 1).times.and_call_original
       (#<Gitlab::BackgroundMigration::BackfillSnippetRepositories:0x00007fc410686e98 @snippet_relation=#<ActiveRecord::Relation [#<PersonalSnippet id:1 $1>, #<PersonalSnippet id:2 $2>, #<PersonalSnippet id:3 $3>, #<PersonalSnippet id:4 $4>, #<PersonalSnippet id:5 $5>]>, @invalid_path_error=false, @invalid_signature_error=false, @commit_attrs={:branch_name=>"main", :message=>"Initial commit"}, @logger=#<Gitlab::BackgroundMigration::Logger:0x00007fc41296dec0 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fc41296de20 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007fc41296dd80 @shift_period_suffix="%Y%m%d", @shift_size=1048576, @shift_age=0, @filename=#<Pathname:/builds/gitlab-org/gitlab/log/migrations.log>, @dev=#<File:/builds/gitlab-org/gitlab/log/migrations.log>, @binmode=false, @mon_data=#<Monitor:0x00007fc41296dd30>, @mon_data_owner_object_id=12288720>>, @empty_file_name="snippetfile1.txt">).create_commit(#<PersonalSnippet id:4 $4>)
           expected: 3 times with arguments: (#<PersonalSnippet id:4 $4>)
           received: 2 times with arguments: (#<PersonalSnippet id:4 $4>)
     # ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:314:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:415:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:406:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:402:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:61:in `with_raw_context'
     # ./spec/spec_helper.rb:402:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/migration.rb:53:in `block (2 levels) in <main>'
     # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
  4) Gitlab::BackgroundMigration::BackfillSnippetRepositories#perform when both user name and snippet file_name are invalid behaves like migration_bot user commits files 
     Failure/Error: expect(last_commit.author_name).to eq migration_bot.name
     NoMethodError:
       undefined method `author_name' for nil:NilClass
     Shared Example Group: "migration_bot user commits files" called from ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:300
     # ./spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb:92:in `block (4 levels) in <main>'
     # ./spec/spec_helper.rb:415:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:406:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:402:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:61:in `with_raw_context'
     # ./spec/spec_helper.rb:402:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/migration.rb:53:in `block (2 levels) in <main>'
     # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
Finished in 2 minutes 4.5 seconds (files took 37.61 seconds to load)
4 examples, 4 failures

Merge request reports