Commit 4f120505 authored by Stan Hu's avatar Stan Hu

Merge branch 'da-calculate-repository-checksum' into 'master'

Improve Gitlab::Git::Checksum#calculate

See merge request gitlab-org/gitlab-ee!5140
parents 8e8c03f4 9e59bd43
......@@ -37,15 +37,17 @@ module Gitlab
if status&.zero?
refs = output.split("\n")
refs.inject(nil) do |checksum, ref|
value = Digest::SHA1.hexdigest(ref)
result = refs.inject(nil) do |checksum, ref|
value = Digest::SHA1.hexdigest(ref).hex
if checksum.nil?
value
else
(checksum.hex ^ value.hex).to_s(16)
checksum ^ value
end
end
result.to_s(16)
else
# Empty repositories return with a non-zero status and an empty output.
if output&.empty?
......
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