mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-07-30 23:19:39 +02:00
Migrate to go-git/go-git v5.0.0 (#10735)
This commit is contained in:
parent
2f928316db
commit
43c09134a9
315 changed files with 15239 additions and 92420 deletions
22
vendor/github.com/go-git/go-git/v5/common.go
generated
vendored
Normal file
22
vendor/github.com/go-git/go-git/v5/common.go
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
package git
|
||||
|
||||
import "strings"
|
||||
|
||||
const defaultDotGitPath = ".git"
|
||||
|
||||
// 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue