Welcome to mirror list, hosted at ThFree Co, Russian Federation.

util.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03c2c1367b09b31532a25ad94e03a07f7201e8f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

# Gitaly note: JV: no RPC's here.

module Gitlab
  module Git
    module Util
      LINE_SEP = "\n".freeze

      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