Commit c3448bf5 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'remove-git-committer-hash' into 'master'

Remove unused Gitlab::Git.committer_hash

See merge request gitlab-org/gitlab!22215
parents cebe5a8d 028e3090
......@@ -35,16 +35,6 @@ module Gitlab
end
end
def committer_hash(email:, name:)
return if email.nil? || name.nil?
{
email: email,
name: name,
time: Time.now
}
end
def tag_name(ref)
ref = ref.to_s
if self.tag_ref?(ref)
......
......@@ -71,9 +71,7 @@ describe Gitlab::Git::Branch, :seed_helper do
end
let(:user) { create(:user) }
let(:committer) do
Gitlab::Git.committer_hash(email: user.email, name: user.name)
end
let(:committer) { { email: user.email, name: user.name } }
let(:params) do
parents = [rugged.head.target]
tree = parents.first.tree
......
......@@ -6,32 +6,6 @@ describe Gitlab::Git do
let(:committer_email) { 'user@example.org' }
let(:committer_name) { 'John Doe' }
describe 'committer_hash' do
it "returns a hash containing the given email and name" do
committer_hash = described_class.committer_hash(email: committer_email, name: committer_name)
expect(committer_hash[:email]).to eq(committer_email)
expect(committer_hash[:name]).to eq(committer_name)
expect(committer_hash[:time]).to be_a(Time)
end
context 'when email is nil' do
it "returns nil" do
committer_hash = described_class.committer_hash(email: nil, name: committer_name)
expect(committer_hash).to be_nil
end
end
context 'when name is nil' do
it "returns nil" do
committer_hash = described_class.committer_hash(email: committer_email, name: nil)
expect(committer_hash).to be_nil
end
end
end
describe '.ref_name' do
it 'ensure ref is a valid UTF-8 string' do
utf8_invalid_ref = Gitlab::Git::BRANCH_REF_PREFIX + "an_invalid_ref_\xE5"
......
......@@ -230,8 +230,8 @@ describe GitGarbageCollectWorker do
new_commit_sha = Rugged::Commit.create(
rugged,
message: "hello world #{SecureRandom.hex(6)}",
author: Gitlab::Git.committer_hash(email: 'foo@bar', name: 'baz'),
committer: Gitlab::Git.committer_hash(email: 'foo@bar', name: 'baz'),
author: { email: 'foo@bar', name: 'baz' },
committer: { email: 'foo@bar', name: 'baz' },
tree: old_commit.tree,
parents: [old_commit]
)
......
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