Fix error when deleting an empty list of refs

Closes #45743
This commit is contained in:
Sergey Sinev 2018-04-25 20:37:52 +03:00 committed by Stan Hu
parent 8bacfbd1cc
commit 100c687cbc
3 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Fix error when deleting an empty list of refs
merge_request:
author:
type: fixed

View file

@ -2346,7 +2346,7 @@ module Gitlab
end
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
def rugged_remove_remote(remote_name)

View file

@ -600,6 +600,10 @@ describe Gitlab::Git::Repository, seed_helper: true do
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
expect { repo.delete_refs('refs\heads\fix') }.to raise_error(Gitlab::Git::Repository::GitError)
end