forked from forgejo/forgejo
Implement git refs API for listing references (branches, tags and other) (#5354)
* Inital routes to git refs api * Git refs API implementation * Update swagger * Fix copyright * Make swagger happy add basic test * Fix test * Fix test again :)
This commit is contained in:
parent
294904321c
commit
08bf443016
268 changed files with 48603 additions and 10 deletions
22
vendor/gopkg.in/src-d/go-git.v4/common.go
generated
vendored
Normal file
22
vendor/gopkg.in/src-d/go-git.v4/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