blob: ef1db3b55f07e4c3fe3697cf99ecdca8deafafc4 (
plain) (
tree)
|
|
package git
import (
"strings"
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
)
// Storer is a generic storage of objects, references and any information
// related to a particular repository. Some Storer implementations persist the
// information in an system directory (such as `.git`) and others
// implementations are in memmory being ephemeral
type Storer interface {
storer.EncodedObjectStorer
storer.ReferenceStorer
storer.ShallowStorer
config.ConfigStorer
}
// 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 {
if s == "" {
return 0
}
nEOL := strings.Count(s, "\n")
if strings.HasSuffix(s, "\n") {
return nEOL
}
return nEOL + 1
}
|