diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-12-12 03:22:52 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-12-12 03:22:52 +0100 |
commit | b543e4e02793a58db25148214ef149cb571792f5 (patch) | |
tree | d68b7e33aba06f67d3c3e301b4a68f09de0ded6a /common.go | |
parent | c22c181f70e0afb294513315e9975b9f3f4c1d39 (diff) | |
download | go-git-b543e4e02793a58db25148214ef149cb571792f5.tar.gz |
blame code reorganization, and mutting the test
Diffstat (limited to 'common.go')
-rw-r--r-- | common.go | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2,17 +2,19 @@ package git import "strings" -// CountLines returns the number of lines in a string à la git, this is +// countLines returns the number of lines in a string à la git, this is // The newline character is assumed to be '\n'. The empty string // contains 0 lines. If the last line of the string doesn't end with a // newline, it will still be considered a line. -func CountLines(s string) int { +func countLines(s string) int { if s == "" { return 0 } - nEol := strings.Count(s, "\n") + + nEOL := strings.Count(s, "\n") if strings.HasSuffix(s, "\n") { - return nEol + return nEOL } - return nEol + 1 + + return nEOL + 1 } |