Unable to update a merge request reference head after a push
Created by @stanhu.
https://sentry.gitlap.com/gitlab/devgitlaborg/issues/114211/
Rugged::ReferenceError: failed to write reference 'refs/merge-requests/2253/head': a reference with that name already exists.
lib/gitlab/git/repository.rb:1082:in `create'
rugged.references.create(ref_path, ref, force: force)
lib/gitlab/git/repository.rb:1082:in `write_ref'
rugged.references.create(ref_path, ref, force: force)
lib/gitlab/git/repository.rb:1351:in `block in rugged_fetch_source_branch'
write_ref(local_ref, commit.sha)
lib/gitlab/git/repository.rb:1018:in `with_repo_branch_commit'
yield commit(start_branch_name)
lib/gitlab/git/repository.rb:1349:in `rugged_fetch_source_branch'
with_repo_branch_commit(source_repository, source_branch) do |commit|
...
(70 additional frame(s) were not displayed)
Gitlab::Git::Repository::GitError: could not create ref refs/merge-requests/2253/head: failed to write reference 'refs/merge-requests/2253/head': a reference with that name already exists.
lib/gitlab/git/repository.rb:1084:in `rescue in write_ref'
raise GitError, "could not create ref #{ref_path}: #{ex}"
lib/gitlab/git/repository.rb:1077:in `write_ref'
raise ArgumentError, "invalid ref_path #{ref_path.inspect}" if ref_path.include?(' ')
lib/gitlab/git/repository.rb:1351:in `block in rugged_fetch_source_branch'
write_ref(local_ref, commit.sha)
lib/gitlab/git/repository.rb:1018:in `with_repo_branch_commit'
yield commit(start_branch_name)
lib/gitlab/git/repository.rb:1349:in `rugged_fetch_source_branch'
with_repo_branch_commit(source_repository, source_branch) do |commit|
...
(70 additional frame(s) were not displayed)
could not create ref refs/merge-requests/2253/head: failed to write reference 'refs/merge-requests/2253/head': a reference with that name already exists.
Edited by Stan Hu