Commit ad9e0091 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'xeodon/gitlab-ce-fix/45743-master-fix-gitaly-delete-refs' into 'master'

Fix error when deleting an empty list of refs

Closes #45743

See merge request gitlab-org/gitlab-ce!19053
parents 95dacabe 100c687c
---
title: Fix error when deleting an empty list of refs
merge_request:
author:
type: fixed
...@@ -2367,7 +2367,7 @@ module Gitlab ...@@ -2367,7 +2367,7 @@ module Gitlab
end end
def gitaly_delete_refs(*ref_names) def gitaly_delete_refs(*ref_names)
gitaly_ref_client.delete_refs(refs: ref_names) gitaly_ref_client.delete_refs(refs: ref_names) if ref_names.any?
end end
def rugged_remove_remote(remote_name) def rugged_remove_remote(remote_name)
......
...@@ -600,6 +600,10 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -600,6 +600,10 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
end end
it 'does not fail when deleting an empty list of refs' do
expect { repo.delete_refs(*[]) }.not_to raise_error
end
it 'raises an error if it failed' do it 'raises an error if it failed' do
expect { repo.delete_refs('refs\heads\fix') }.to raise_error(Gitlab::Git::Repository::GitError) expect { repo.delete_refs('refs\heads\fix') }.to raise_error(Gitlab::Git::Repository::GitError)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment