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