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: cf8571bf917ac41e0024cb1c584dea3af6c19d2b (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"

      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