2018-11-09 13:39:43 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-12 10:31:36 -04:00
|
|
|
# Gitaly note: JV: no RPC's here.
|
|
|
|
|
2017-01-04 13:43:06 -05:00
|
|
|
module Gitlab
|
|
|
|
module Git
|
|
|
|
module Util
|
2019-08-31 15:25:25 -04:00
|
|
|
LINE_SEP = "\n"
|
2017-01-04 13:43:06 -05:00
|
|
|
|
|
|
|
def self.count_lines(string)
|
|
|
|
case string[-1]
|
|
|
|
when nil
|
|
|
|
0
|
|
|
|
when LINE_SEP
|
|
|
|
string.count(LINE_SEP)
|
|
|
|
else
|
|
|
|
string.count(LINE_SEP) + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|